[
  {
    "path": ".github/workflows/ci.yml",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# NOTE https://infra.apache.org/github-actions-secrets.html\n\nname: CI\n\non:\n  push:\n    branches:\n      - master\n      - main\n    paths-ignore:\n      - '**.md'\n      - '.travis.yml'\n      - 'Jenkinsfile'\n  pull_request:\n    branches:\n      - master\n      - main\n    paths-ignore:\n      - '**.md'\n      - '.travis.yml'\n      - 'Jenkinsfile'\n  workflow_dispatch:\n\npermissions:\n  contents: read\n  \njobs:\n  build:\n    name: Build with ${{ matrix.profile }}\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        profile: [ 'OWB', 'Weld' ]\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          persist-credentials: false\n      - name: Set up JDK 17\n        uses: actions/setup-java@v3\n        with:\n          distribution: 'temurin'\n          java-version: 17\n      - name: Cache Maven packages\n        uses: actions/cache@v3\n        with:\n          path: ~/.m2\n          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n          restore-keys: ${{ runner.os }}-m2\n      - name: Build\n        run: mvn clean install -P${{ matrix.profile }}\n\n        \n"
  },
  {
    "path": ".github/workflows/integration.yml",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# NOTE https://infra.apache.org/github-actions-secrets.html\n\nname: Integration\n\non:\n  workflow_dispatch:\n  schedule:\n    - cron: '0 6 * * *'\n\npermissions:\n  contents: read\n  \njobs:\n  build:\n    name: Build with ${{ matrix.profile }}\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        profile: [ 'tomee-build-managed', 'wildfly-build-managed', 'payara-build-managed' ]\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          persist-credentials: false\n      - name: Set up JDK 17\n        uses: actions/setup-java@v3\n        with:\n          distribution: 'temurin'\n          java-version: 17\n      - name: Cache Maven packages\n        uses: actions/cache@v3\n        with:\n          path: ~/.m2\n          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n          restore-keys: ${{ runner.os }}-m2\n      - name: Build\n        run: mvn clean install -P${{ matrix.profile }}\n"
  },
  {
    "path": ".gitignore",
    "content": "target\n*.iml\n*.iws\n*.ipr\n.project\n.classpath\n.settings\n.metadata\n.svn\n.idea\n.checkstyle\natlassian-ide-plugin.xml\n.sonar-ide.properties\n*.patch\ndeltaspike/core/impl/data\ndeltaspike/modules/jsf/impl/data\ndeltaspike/modules/security/impl/data\n*.log\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: java\ndist: trusty\ncache:\n  directories:\n    - '$HOME/.m2/repository'\ninstall:\n# Skip the first maven execution for downloading dependencies by using this command\n  - /bin/true\nscript:\n  - ./build.sh\nenv:\n  global:\n    - MAVEN_SKIP_RC=true\nmatrix:\n  fast_finish: true\n  include:\n    - env: PROFILES=tomee-build-managed\n      jdk: oraclejdk8\n# Must run with newer OpenEJB for the OpenEJB conatiner control tests\n    - env: PROFILES=tomee8-build-managed,OpenEJB-TomEE\n      jdk: oraclejdk8\n# Must run with newer OpenEJB for the OpenEJB conatiner control tests\n    - env: PROFILES=tomee7-build-managed,OpenEJB-TomEE\n      jdk: oraclejdk8\n    - env: PROFILES=OWB\n      jdk: oraclejdk8\n    - env: PROFILES=Weld3\n      jdk: oraclejdk8\n    - env: PROFILES=OWB2\n      jdk: oraclejdk8\n    - env: PROFILES=Weld2\n      jdk: oraclejdk8\n    - env: PROFILES=OWB15\n      jdk: oraclejdk8\n    - env: PROFILES=Weld1\n      jdk: oraclejdk8\n################################################\n# The following are tests that compile Java8 bytecode and only check if Deltaspike is capable of running on a newer JVM\n################################################\n    - env: PROFILES=OWB2 JDK=9\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 9 -L BCL\n# Add new certificates for JDK10\n# https://www.deps.co/guides/travis-ci-latest-java/\n    - env: PROFILES=OWB2 JDK=10\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 10 -L GPL\n        - rm \"${JAVA_HOME}/lib/security/cacerts\"\n        - ln -s /etc/ssl/certs/java/cacerts \"${JAVA_HOME}/lib/security/cacerts\"\n    - env: PROFILES=OWB2 JDK=11\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 11 -L BCL\n    - env: PROFILES=OWB2 JDK=12\n      before_install:\n      - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n      - . ./install-jdk.sh -F 12 -L GPL\n    - env: PROFILES=OWB2 JDK=13\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 13 -L GPL\n    - env: PROFILES=OWB2 JDK=14\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 14 -L GPL\n################################################\n# The following are tests that compile to Java9+ bytecode and check if Deltaspike is buildable with newer JDKs as well as if it is capable of handling classes of newer bytecode versions\n################################################\n    - env: PROFILES=OWB2 JDK=9 BUILD_JDK=9\n      before_install:\n      - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n      - . ./install-jdk.sh -F 9 -L GPL\n    - env: PROFILES=OWB2 JDK=10 BUILD_JDK=10\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 10 -L GPL\n        - rm \"${JAVA_HOME}/lib/security/cacerts\"\n        - ln -s /etc/ssl/certs/java/cacerts \"${JAVA_HOME}/lib/security/cacerts\"\n    - env: PROFILES=OWB2 JDK=11 BUILD_JDK=11\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 11 -L BCL\n    - env: PROFILES=OWB2 JDK=12 BUILD_JDK=12\n      before_install:\n      - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n      - . ./install-jdk.sh -F 12 -L GPL\n    - env: PROFILES=OWB2 JDK=13 BUILD_JDK=13\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 13 -L GPL\n    - env: PROFILES=OWB2 JDK=14 BUILD_JDK=14\n      before_install:\n        - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh\n        - . ./install-jdk.sh -F 14 -L GPL\n  allow_failures:\n    - env: PROFILES=OWB2 JDK=14 BUILD_JDK=14\n    - env: PROFILES=OWB2 JDK=14\n# Not sure why, but these profiles fail in the JSF tests\n    - env: PROFILES=tomee8-build-managed,OpenEJB-TomEE\n      jdk: oraclejdk8\n    - env: PROFILES=tomee7-build-managed,OpenEJB-TomEE\n      jdk: oraclejdk8\n# Fails because it thinks an alternative is not a proper alternative?\n    - env: PROFILES=Weld2\n      jdk: oraclejdk8\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n"
  },
  {
    "path": "README.md",
    "content": "# Apache DeltaSpike\n\n[![Build Status](https://github.com/apache/deltaspike/workflows/DeltaSpike%20CI/badge.svg)](https://github.com/apache/deltaspike/actions/workflows/ds-ci.yml)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n* [Documentation](https://deltaspike.apache.org)\n* [Mailing Lists](http://deltaspike.apache.org/community.html#Mailinglists)\n* [Contribution Guide](http://deltaspike.apache.org/source.html)\n* [JIRA](https://issues.apache.org/jira/browse/DELTASPIKE)\n* [Apache License v2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n\n**Apache DeltaSpike** is a suite of portable CDI Extensions intended to make application development easier when working with CDI and Java EE.  \n\nContexts and Dependency Injection is a specification, published as: \n* JSR-299 (CDI-1.0) http://docs.jboss.org/cdi/spec/1.0/html/ \n* JSR-346 (CDI-1.2) http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html \n* JSR-365 (CDI-2.0) http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html\n* Jakarta CDI-3.0 and later https://jakarta.ee/specifications/cdi/\n\nApache DeltaSpike is compatible with all those specification versions.\nUntil Apache DeltaSpike 1.9.x we did target the ``javax`` package.\n\nThe current Apache DeltaSpike-2.0.x releases target the ``jakarta`` namespace.\n\nNote that Apache DeltaSpike is **not** a CDI container itself, but a set of portable Extensions for it!\n\n\nSome of the key features of Apache DeltaSpike include:\n\n- A core module that supports component configuration, type safe messaging and internationalization, and exception handling.\n- A suite of utilities to make programmatic bean lookup easier.\n- A plugin for Java SE to bootstrap both JBoss Weld, Apache OpenWebBeans and other CDI containers outside of a JavaEE server.\n- JSF integration, including backporting of JSF 2.2 features for Java EE 6.\n- JPA integration and transaction support.\n- A Data module, to create an easy to use repository pattern on top of JPA.\n- Scheduler integration\n\nTesting support is also provided, to allow you to do low level unit testing of your CDI enabled projects. \n\n## Getting Started\n\nThe easiest way to get started with DeltaSpike is to use Maven or Gradle as a build tool, as described in [configuring in your project](http://deltaspike.apache.org/documentation/configure.html)\n\n## Requirements to Build\n\n- Git\n- JDK 8\n- Maven\n\nJust run `mvn clean install` from the top level directory, `deltaspike` to build the source code.\n"
  },
  {
    "path": "buildall.sh",
    "content": "#!/bin/sh\n#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n#\n# this is a small helper script for building a few container constellations locally\n# you can easily check the output via $> tail mvn-*.log | less\n#\n#####################################################################################\n\nrm mvn-*log\n\n\n# CDI-2.0, EE8\n\n# works fine with Java11\nmvn clean install -POWB | tee mvn-owb4.0.3.log\nmvn clean install -PWeld -Dweld.version=5.1.7.Final | tee mvn-weld5.1.7.log\n\n# requires Java 17\nmvn clean install -Ptomee-build-managed -Dtomee.version=10.1.5 | tee mvn-tomee10.1.5.log\nmvn clean install -Pwildfly-build-managed -Pwildfly.version=31.0.0.Final | tee mvn-wildfly-31.0.0.log\n\n# and now for the result check\ntail mvn-*.log | less\n"
  },
  {
    "path": "deltaspike/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n\n"
  },
  {
    "path": "deltaspike/NOTICE",
    "content": "Apache DeltaSpike\r\nCopyright 2011 - 2018 The Apache Software Foundation\r\n\r\nThis product includes software developed by \r\nThe Apache Software Foundation (http://www.apache.org/).\r\n\r\n"
  },
  {
    "path": "deltaspike/README.md",
    "content": "title: Apache DeltaSpike\n\nNotice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n\n\nAbout Apache DeltaSpike\n-----------------------\nApache DeltaSpike is a CDI Extensions Project which contains\nthe best mature features of JBoss Seam3, Apache MyFaces CODI\nand other CDI Extensions projects.\n\n\nLicense\n-------\nApache DeltaSpike is licensed under ALv2.\nSee the LICENSE file for the full license text.\n\n\nBuilding Apache DeltaSpike\n--------------------\nDeltaSpike is container agnostic. It just needs a working CDI container\nintegration via Arquillian [1]. The different containers get activated\nvia Maven Profiles. The following profiles exist so far:\n\n * OWB\n * Weld\n\nFor building DeltaSpike with JBoss Weld [2] (Reference Implementation)\ninvoke the following commandline:\n\n$> mvn clean install -PWeld\n\nFor building DeltaSpike with Apache OpenWebBeans [3] execute the\nfollowing command\n\n$> mvn clean install -POWB\n\n\n\n[1] http://www.jboss.org/arquillian\n[2] http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html/\n[3] http://openwebbeans.apache.org\n"
  },
  {
    "path": "deltaspike/cdictrl/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.cdictrl</groupId>\n        <artifactId>cdictrl-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>deltaspike-cdictrl-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike CDI ContainerControl API</name>\n\n    <description>\n        This project provides a way to genericly run CDI containers\n        from inside of unit tests or Java SE applications.\n    </description>\n\n    <dependencies>\n        <dependency>\n            <groupId>jakarta.annotation</groupId>\n            <artifactId>jakarta.annotation-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.inject</groupId>\n            <artifactId>jakarta.inject-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.enterprise</groupId>\n            <artifactId>jakarta.enterprise.cdi-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.interceptor</groupId>\n            <artifactId>jakarta.interceptor-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n        </dependency>\n    </dependencies>\n</project>\n"
  },
  {
    "path": "deltaspike/cdictrl/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.api;\n\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.util.Map;\n\n\n/**\n * <p>A CdiTestContainer provides access to an underlying JSR-299 (CDI)\n * Container. It allows starting and stopping the container and to start\n * and stop the built-in contexts of that container.</p>\n *\n * <p>The intention is to provide a portable control for CDI containers in\n * Java SE environments. It is <b>not</b> intended for environments in which the\n * CDI container is under full control of the server already, e.g. in\n * EE-containers.</p>\n */\npublic interface CdiContainer\n{\n    /**\n     * <p>Booting the CdiTestContainer will scan the whole classpath\n     * for Beans and extensions available.\n     * The container might throw a DeploymentException or similar on startup.</p>\n     *\n     * <p><b>Note:</b> booting the container does <i>not</i> automatically\n     * start all CDI Contexts! Depending on the underlying CDI container you\n     * might need to invoke {@link #getContextControl()} and execute\n     * {@link ContextControl#startContext(Class)} or\n     * {@link ContextControl#startContexts()}</p>\n     */\n    void boot();\n\n    /**\n     * <p>Like {@link #boot()} but allows to pass in a configuration Map\n     * for the container.</p>\n     * <p>Please note that the configuration is container implementation dependent!</p>\n     *\n     * @param properties\n     */\n    void boot(Map<?,?> properties);\n    \n    /**\n     * This will shutdown the underlying CDI container and stop all contexts.\n     */\n    void shutdown();\n    \n\n    /**\n     * @return the {@link BeanManager} or <code>null</code> it not available\n     */\n    BeanManager getBeanManager();\n\n    /**\n     * @return ContextControl for the started Container. <code>null</code> if the container is not yet started\n     */\n    ContextControl getContextControl();\n\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainerLoader.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.api;\n\nimport java.util.Iterator;\nimport java.util.ServiceLoader;\n\n/**\n * <p>This class provides access to the ContainerControl.</p>\n * <p>It uses the {@code java.util.ServiceLoader} mechanism  to \n * automatically pickup the container providers from the classpath.</p>\n * <p>Usage:\n * <pre>\n *     CdiContainer container = CdiContainerLoader.getCdiContainer();\n *     container.boot();\n *     ...\n * </pre>\n * </p>\n * <p>CdiContainerLoader internally uses the {@link java.util.ServiceLoader}\n * to automatically detect the container implementation which should be used.\n * </p>\n */\npublic final class CdiContainerLoader\n{\n    private static CdiContainer cdiContainer = null;\n\n    private CdiContainerLoader()\n    {\n        // private ct to prevent instantiation\n    }\n\n\n    /**\n     * @return the {@link CdiContainer} implementation available on the classpath\n     * @throws IllegalStateException if none or multiple CdiContainer implementations\n     *         are found on the classpath.\n     */\n    public static synchronized CdiContainer getCdiContainer()\n    {\n        if (cdiContainer == null)\n        {\n            // there is no dependency to any cdi implementation, we do all dynamically\n            ServiceLoader<CdiContainer> cdiContainerLoader = ServiceLoader.load(CdiContainer.class);\n            Iterator<CdiContainer> cdiIt = cdiContainerLoader.iterator();\n            if (cdiIt.hasNext())\n            {\n                cdiContainer = cdiIt.next();\n            }\n            else\n            {\n                throw new IllegalStateException(\"Could not find an implementation of \" + CdiContainer.class.getName() +\n                    \" available in the classpath!\");\n            }\n\n            if (cdiIt.hasNext())\n            {\n                String foundContainers = getContainerDetails();\n                throw new IllegalStateException(\"Too many implementations of \" + CdiContainer.class.getName() +\n                    \" found in the classpath! Details: \" + foundContainers);\n            }\n        }\n        return cdiContainer;\n    }\n\n    private static String getContainerDetails()\n    {\n        StringBuilder result = new StringBuilder();\n\n        Class containerClass;\n        for (CdiContainer cdiContainer : ServiceLoader.load(CdiContainer.class))\n        {\n            containerClass = cdiContainer.getClass();\n            result.append(containerClass.getProtectionDomain().getCodeSource().getLocation().toExternalForm());\n            result.append(containerClass.getName());\n\n            result.append(System.getProperty(\"line.separator\"));\n        }\n\n        return result.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/api/src/main/java/org/apache/deltaspike/cdise/api/ContextControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.api;\n\nimport java.lang.annotation.Annotation;\n\n/**\n * Control native CDI Container Contexts.\n * Just inject this interface and you gain manual access over built-in Contexts.\n * The respective integration code will provide a &064;Dependent scoped instance\n * which itself is stateless.\n *\n * The {@link #startContext(Class)} and {@link #stopContext(Class)} only affect\n * the current Thread. When leaving a Thread each started context needs to get\n * stopped as well (best practice is to do that in a <i>finally</i> block.\n *\n * If a container supports controlling the Session Context then each Thread will\n * get a new 'dummy' storage assigned. It is not intended to 'attach' to a real\n * Session but to allow the re-use of existing beans.\n *\n * Many containers make heavy use of ThreadLocals. Thus it might be necessary to\n * call\n * <pre>\n *     contextControl.startContext(ApplicationScoped.class);\n * </pre>\n * to 'attach' or 'activate' the ApplicationContext within your current Thread.\n */\npublic interface ContextControl\n{\n    /**\n     * This will start all container built-in Contexts\n     */\n    void startContexts();\n\n    /**\n     * Stop all container built-in Contexts and destroy all beans properly\n     */\n    void stopContexts();\n\n    /**\n     * Start the specified scope. This only works for scopes which are handled\n     * by the CDI container itself. Custom scoped of 3rd party\n     * Context implementations shall be started directly (they are portable anyway).\n     *\n     * @param scopeClass e.g. RequestScoped.class\n     */\n    void startContext(Class<? extends Annotation> scopeClass);\n\n    /**\n     * Stop the specified scope. This only works for scopes which are handled\n     * by the CDI container itself. Custom scoped of 3rd party\n     * Context implementations shall be stopped directly (they are portable anyway).\n     *\n     * @param scopeClass e.g. RequestScoped.class\n     */\n    void stopContext(Class<? extends Annotation> scopeClass);\n\n\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-openejb/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n    <!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.cdictrl</groupId>\n        <artifactId>cdictrl-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>deltaspike-cdictrl-openejb</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike CDI OpenEJB-ContainerControl</name>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>deltaspike-cdictrl-tck</artifactId>\n            <version>${project.version}</version>\n            <scope>test</scope>\n        </dependency>\n\n    </dependencies>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-impl</artifactId>\n                <version>${openejb.owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-ejb</artifactId>\n                <version>${openejb.owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-ee</artifactId>\n                <version>${openejb.owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-spi</artifactId>\n                <version>${openejb.owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-web</artifactId>\n                <version>${openejb.owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-ee-common</artifactId>\n                <version>${openejb.owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <profiles>\n        <profile>\n            <id>default</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.tomee</groupId>\n                    <artifactId>openejb-core</artifactId>\n                    <version>${tomee.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.xml.bind</groupId>\n                    <artifactId>jakarta.xml.bind-api</artifactId>\n                    <version>3.0.1</version>\n                    <exclusions>\n                        <exclusion> <!-- Is already included in java-ee-api -->\n                            <artifactId>jakarta.activation</artifactId>\n                            <groupId>jakarta.activation-api</groupId>\n                        </exclusion>\n                    </exclusions>\n                </dependency>\n                <dependency>\n                    <groupId>org.glassfish.jaxb</groupId>\n                    <artifactId>jaxb-runtime</artifactId>\n                    <version>3.0.2</version>\n                    <scope>runtime</scope>\n                    <exclusions>\n                        <exclusion> <!-- Is already included in java-ee-api -->\n                            <artifactId>jakarta.activation</artifactId>\n                            <groupId>jakarta.activation-api</groupId>\n                        </exclusion>\n                    </exclusions>\n                </dependency>\n\n            </dependencies>\n        </profile>\n\n        <profile>\n            <id>tomee-build-managed</id>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.tomee</groupId>\n                    <artifactId>openejb-core</artifactId>\n                    <version>${tomee.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.xml.bind</groupId>\n                    <artifactId>jakarta.xml.bind-api</artifactId>\n                    <version>3.0.1</version>\n                    <exclusions>\n                        <exclusion> <!-- Is already included in java-ee-api -->\n                            <artifactId>jakarta.activation</artifactId>\n                            <groupId>jakarta.activation-api</groupId>\n                        </exclusion>\n                    </exclusions>\n                </dependency>\n                <dependency>\n                    <groupId>org.glassfish.jaxb</groupId>\n                    <artifactId>jaxb-runtime</artifactId>\n                    <version>3.0.2</version>\n                    <scope>runtime</scope>\n                    <exclusions>\n                        <exclusion> <!-- Is already included in java-ee-api -->\n                            <artifactId>jakarta.activation</artifactId>\n                            <groupId>jakarta.activation-api</groupId>\n                        </exclusion>\n                    </exclusions>\n                </dependency>\n            </dependencies>\n        </profile>\n\n    </profiles>\n\n    <build>\n        <plugins>\n            <plugin>\n                <artifactId>maven-dependency-plugin</artifactId>\n                <groupId>org.apache.maven.plugins</groupId>\n                <executions>\n                    <execution>\n                        <id>unpack-context</id>\n                        <phase>generate-sources</phase>\n                        <goals>\n                            <goal>unpack</goal>\n                        </goals>\n                        <configuration>\n                            <excludes>**\\/META-INF\\/**,**\\/OpenWebBeansContainerControl.class</excludes>\n                            <artifactItems>\n                                <artifactItem>\n                                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                                    <artifactId>deltaspike-cdictrl-owb</artifactId>\n                                    <version>${project.version}</version>\n                                    <outputDirectory>${project.build.directory}/classes/</outputDirectory>\n                                </artifactItem>\n                            </artifactItems>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>unpack</id>\n                        <phase>process-test-classes</phase>\n                        <goals>\n                            <goal>unpack</goal>\n                        </goals>\n                        <configuration>\n                            <artifactItems>\n                                <artifactItem>\n                                    <groupId>org.apache.deltaspike.test</groupId>\n                                    <artifactId>deltaspike-cdictrl-tck</artifactId>\n                                    <version>${project.version}</version>\n                                    <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>\n                                </artifactItem>\n                            </artifactItems>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n\n</project>\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-openejb/src/main/java/org/apache/deltaspike/cdise/openejb/OpenEjbContainerControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.openejb;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.openejb.OpenEjbContainer;\nimport org.apache.openejb.core.LocalInitialContext;\nimport org.apache.openejb.core.LocalInitialContextFactory;\nimport org.apache.webbeans.config.WebBeansContext;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\n/**\n * OpenEJB specific implementation of {@link org.apache.deltaspike.cdise.api.CdiContainer}.\n */\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class OpenEjbContainerControl implements CdiContainer\n{\n    private static final Logger LOG = Logger.getLogger(OpenEjbContainerControl.class.getName());\n\n    // global container config\n    private static final Properties PROPERTIES = new Properties();\n\n    static\n    {\n        // global properties\n        PROPERTIES.setProperty(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());\n        PROPERTIES.setProperty(LocalInitialContext.ON_CLOSE, LocalInitialContext.Close.DESTROY.name());\n        try\n        {\n            OpenEjbContainerControl.class.getClassLoader().loadClass(\"org.apache.openejb.server.ServiceManager\");\n            PROPERTIES.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, \"true\");\n        }\n        catch (final Exception e)\n        {\n            // ignored\n        }\n    }\n\n\n    private ContextControl ctxCtrl = null;\n    private Bean<ContextControl> ctxCtrlBean = null;\n    private CreationalContext<ContextControl> ctxCtrlCreationalContext = null;\n\n    private Context context = null;\n    \n    private BeanManager beanManager;\n\n    @Override\n    public  BeanManager getBeanManager()\n    {\n        return beanManager;\n    }\n\n    @Override\n    public synchronized void boot()\n    {\n        boot(null);\n    }\n\n    @Override\n    public synchronized void boot(Map<?, ?> properties)\n    {\n        if (context == null)\n        {\n            // this immediately boots the container\n            final Properties p = new Properties();\n            p.putAll(PROPERTIES);\n            if (properties != null) // override with user config\n            {\n                p.putAll(properties);\n            }\n\n            try\n            {\n                context = new InitialContext(p);\n            }\n            catch (final NamingException e)\n            {\n                throw new RuntimeException(e);\n            }\n\n            beanManager = WebBeansContext.currentInstance().getBeanManagerImpl();\n        }\n    }\n\n    @Override\n    public synchronized void shutdown()\n    {\n        if (ctxCtrl != null)\n        {\n            try\n            {\n                ctxCtrl.stopContexts();\n            }\n            catch (Exception e)\n            {\n                // contexts likely already stopped\n            }\n            ctxCtrlBean.destroy(ctxCtrl, ctxCtrlCreationalContext);\n        }\n\n        if (context != null)\n        {\n            try\n            {\n                context.close();\n            }\n            catch (final NamingException e)\n            {\n                // no-op\n            }\n            context = null;\n        }\n\n        ctxCtrl = null;\n        ctxCtrlBean = null;\n        ctxCtrlCreationalContext = null;\n        beanManager = null;\n    }\n\n    @Override\n    public synchronized ContextControl getContextControl()\n    {\n        if (ctxCtrl == null)\n        {\n            BeanManager beanManager = getBeanManager();\n\n            if (beanManager == null)\n            {\n                LOG.warning(\"If the CDI-container was started by the environment, you can't use this helper.\" +\n                        \"Instead you can resolve ContextControl manually \" +\n                        \"(e.g. via BeanProvider.getContextualReference(ContextControl.class) ). \" +\n                        \"If the container wasn't started already, you have to use CdiContainer#boot before.\");\n\n                return null;\n            }\n            Set<Bean<?>> beans = beanManager.getBeans(ContextControl.class);\n            ctxCtrlBean = (Bean<ContextControl>) beanManager.resolve(beans);\n\n            ctxCtrlCreationalContext = getBeanManager()\n                    .createCreationalContext(ctxCtrlBean);\n\n            ctxCtrl = (ContextControl)\n                    getBeanManager().getReference(ctxCtrlBean, ContextControl.class, ctxCtrlCreationalContext);\n        }\n        return ctxCtrl;\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-openejb/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-openejb/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n\norg.apache.deltaspike.cdise.openejb.OpenEjbContainerControl\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-openejb/src/test/java/org/apache/deltaspike/cdise/openejb/OpenEJbContainerControlConfigurationTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.openejb;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.openejb.bean.Foo;\nimport org.apache.openejb.loader.SystemInstance;\nimport org.apache.openejb.spi.ContainerSystem;\nimport org.junit.Test;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport javax.naming.NamingException;\nimport javax.sql.DataSource;\nimport java.sql.Connection;\nimport java.sql.SQLException;\nimport java.util.HashMap;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\n\npublic class OpenEJbContainerControlConfigurationTest\n{\n    @Test\n    public void ensureDataSourceExist()\n    {\n        final CdiContainer container = CdiContainerLoader.getCdiContainer();\n        container.boot(new HashMap<Object, Object>()\n        {{\n            put(\"foo\", \"new://Resource?type=DataSource\");\n            put(\"foo.JdbcUrl\", \"jdbc:hsqldb:mem:foo\");\n            put(\"foo.JtaManaged\", \"false\");\n        }});\n\n        try\n        {\n            final DataSource ds = DataSource.class.cast(SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(\"java:openejb/Resource/foo\"));\n            Connection c = null;\n            try {\n                c = ds.getConnection();\n                assertEquals(\"jdbc:hsqldb:mem:foo\", c.getMetaData().getURL());\n            }\n            catch (SQLException e)\n            {\n                fail(e.getMessage());\n            }\n            finally\n            {\n                try\n                {\n                    if (c != null) {\n                        c.close();\n                    }\n                }\n                catch (SQLException e)\n                {\n                    // no-op\n                }\n            }\n        }\n        catch (final NamingException e)\n        {\n            fail(e.getMessage());\n        }\n        finally\n        {\n            container.shutdown();\n        }\n    }\n\n    @Test\n    public void basicInjection() // useless because of tcks but nice to have when working on this specific container\n    {\n        final CdiContainer container = CdiContainerLoader.getCdiContainer();\n        container.boot();\n\n        try\n        {\n            final BeanManager beanManager = container.getBeanManager();\n            assertEquals(\"foo\", Foo.class.cast(beanManager.getReference(beanManager.resolve(beanManager.getBeans(Foo.class)), Foo.class, null)).name());\n        }\n        finally\n        {\n            container.shutdown();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-openejb/src/test/java/org/apache/deltaspike/cdise/openejb/bean/Foo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.openejb.bean;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class Foo\n{\n    public String name() {\n        return \"foo\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n    <!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.cdictrl</groupId>\n        <artifactId>cdictrl-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>deltaspike-cdictrl-owb</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike CDI OWB-ContainerControl</name>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>test-utils</artifactId>\n            <version>${project.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>deltaspike-cdictrl-tck</artifactId>\n            <version>${project.version}</version>\n            <scope>test</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n        </dependency>\n\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <artifactId>maven-dependency-plugin</artifactId>\n                <groupId>org.apache.maven.plugins</groupId>\n                <executions>\n                    <execution>\n                        <id>unpack</id>\n                        <phase>process-test-classes</phase>\n                        <goals>\n                            <goal>unpack</goal>\n                        </goals>\n                        <configuration>\n                            <artifactItems>\n                                <artifactItem>\n                                    <groupId>org.apache.deltaspike.test</groupId>\n                                    <artifactId>deltaspike-cdictrl-tck</artifactId>\n                                    <version>${project.version}</version>\n                                    <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>\n                                </artifactItem>\n                            </artifactItems>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n\n    <profiles>\n        <profile>\n            <id>OWB</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>jakarta.annotation</groupId>\n                    <artifactId>jakarta.annotation-api</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.inject</groupId>\n                    <artifactId>jakarta.inject-api</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.enterprise</groupId>\n                    <artifactId>jakarta.enterprise.cdi-api</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.interceptor</groupId>\n                    <artifactId>jakarta.interceptor-api</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.owb;\n\nimport java.util.Enumeration;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.servlet.ServletContext;\nimport jakarta.servlet.http.HttpSession;\n\n/**\n * A simple mock HttpSession\n */\n@Vetoed // ignore this as CDI bean\npublic class MockHttpSession implements HttpSession\n{\n    private String sessionId;\n\n    private Map<String, Object> sessionMap = new ConcurrentHashMap<String, Object>();\n\n    public MockHttpSession(String sessionId)\n    {\n        this.sessionId = sessionId;\n    }\n\n    public long getCreationTime()\n    {\n        return 0;\n    }\n\n    public String getId()\n    {\n        return sessionId;\n    }\n\n    public long getLastAccessedTime()\n    {\n        return 0;\n    }\n\n    public ServletContext getServletContext()\n    {\n        return null;\n    }\n\n    public void setMaxInactiveInterval(int interval)\n    {\n    }\n\n    public int getMaxInactiveInterval()\n    {\n        return 0;\n    }\n\n    public Object getAttribute(String name)\n    {\n        return this.sessionMap.get(name);\n    }\n\n    public Object getValue(String name)\n    {\n        return getAttribute(name);\n    }\n\n    public Enumeration getAttributeNames()\n    {\n        return null;\n    }\n\n    public String[] getValueNames()\n    {\n        return new String[0];\n    }\n\n    public void setAttribute(String name, Object value)\n    {\n        this.sessionMap.put(name, value);\n    }\n\n    public void putValue(String name, Object value)\n    {\n        setAttribute(name, value);\n    }\n\n    public void removeAttribute(String name)\n    {\n        this.sessionMap.remove(name);\n    }\n\n    public void removeValue(String name)\n    {\n        removeAttribute(name);\n    }\n\n    public void invalidate()\n    {\n        this.sessionMap.clear();\n    }\n\n    public boolean isNew()\n    {\n        return false;\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n\n        MockHttpSession that = (MockHttpSession) o;\n\n        if (sessionId != null ? !sessionId.equals(that.sessionId) : that.sessionId != null)\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return sessionId != null ? sessionId.hashCode() : 0;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"MockHttpSession{\" +\n                \"sessionId='\" + sessionId + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockServletContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.owb;\n\nimport java.io.InputStream;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.util.Enumeration;\nimport java.util.EventListener;\nimport java.util.Hashtable;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.servlet.Filter;\nimport jakarta.servlet.FilterRegistration;\nimport jakarta.servlet.RequestDispatcher;\nimport jakarta.servlet.Servlet;\nimport jakarta.servlet.ServletContext;\nimport jakarta.servlet.ServletContextEvent;\nimport jakarta.servlet.ServletException;\nimport jakarta.servlet.ServletRegistration;\nimport jakarta.servlet.SessionCookieConfig;\nimport jakarta.servlet.SessionTrackingMode;\nimport jakarta.servlet.descriptor.JspConfigDescriptor;\n\n/**\n * Mock ServletContext needed to startup the container.\n *\n */\n@Vetoed // ignore this as CDI bean\npublic class MockServletContext implements ServletContext\n{\n    private static MockServletContext instance = new MockServletContext();\n\n\n    private Hashtable attributes = new Hashtable();\n\n\n    private MockServletContext()\n    {\n        // this class is only accessible via getInstance\n    }\n\n    public static synchronized MockServletContext getInstance()\n    {\n        return instance;\n    }\n\n    public static ServletContextEvent getServletContextEvent()\n    {\n        return new ServletContextEvent(getInstance());\n    }\n\n\n\n\n\n\n    public Object getAttribute(String name)\n    {\n        return attributes.get(name);\n    }\n\n    public Enumeration getAttributeNames()\n    {\n        return attributes.keys();\n    }\n\n    public ServletContext getContext(String uripath)\n    {\n        return this;\n    }\n\n    public String getContextPath()\n    {\n        return \"mockContextpath\";\n    }\n\n    public String getInitParameter(String name)\n    {\n        return null;\n    }\n\n    public Enumeration getInitParameterNames()\n    {\n        return new StringTokenizer(\"\"); // 'standard' empty Enumeration\n    }\n\n    public int getMajorVersion()\n    {\n        return 2;\n    }\n\n    public String getMimeType(String file)\n    {\n        return null;\n    }\n\n    public int getMinorVersion()\n    {\n        return 0;\n    }\n\n    public RequestDispatcher getNamedDispatcher(String name)\n    {\n        return null;\n    }\n\n    public String getRealPath(String path)\n    {\n        return \"mockRealPath\";\n    }\n\n    public RequestDispatcher getRequestDispatcher(String path)\n    {\n        return null;\n    }\n\n    public URL getResource(String path) throws MalformedURLException\n    {\n        return null;\n    }\n\n    public InputStream getResourceAsStream(String path)\n    {\n        return null;\n    }\n\n    public Set getResourcePaths(String path)\n    {\n        return null;\n    }\n\n    public String getServerInfo()\n    {\n        return \"mockServer\";\n    }\n\n    public Servlet getServlet(String name) throws ServletException\n    {\n        return null;\n    }\n\n    public String getServletContextName()\n    {\n        return null;\n    }\n\n    public Enumeration getServletNames()\n    {\n        return null;\n    }\n\n    public Enumeration getServlets()\n    {\n        return null;\n    }\n\n    public void log(String msg)\n    {\n        // nothing to do\n    }\n\n    public void log(Exception exception, String msg)\n    {\n        // nothing to do\n    }\n\n    public void log(String message, Throwable throwable)\n    {\n        // nothing to do\n    }\n\n    public void removeAttribute(String name)\n    {\n        attributes.remove(name);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public void setAttribute(String name, Object object)\n    {\n        attributes.put(name, object);\n    }\n\n    @Override\n    public boolean setInitParameter(String name, String value)\n    {\n        return false;\n    }\n\n    @Override\n    public ServletRegistration.Dynamic addServlet(String servletName, String className)\n        throws IllegalArgumentException, IllegalStateException\n    {\n        return null;\n    }\n\n    @Override\n    public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet)\n        throws IllegalArgumentException, IllegalStateException\n    {\n        return null;\n    }\n\n    @Override\n    public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> clazz)\n        throws IllegalArgumentException, IllegalStateException\n    {\n        return null;\n    }\n\n    @Override\n    public ServletRegistration.Dynamic addJspFile(String jspName, String jspFile)\n    {\n        return null;\n    }\n\n    @Override\n    public <T extends Servlet> T createServlet(Class<T> clazz) throws ServletException\n    {\n        return null;\n    }\n\n    @Override\n    public ServletRegistration getServletRegistration(String servletName)\n    {\n        return null;\n    }\n\n    @Override\n    public Map<String, ? extends ServletRegistration> getServletRegistrations()\n    {\n        return null;\n    }\n\n    @Override\n    public FilterRegistration.Dynamic addFilter(String filterName, String className)\n        throws IllegalArgumentException, IllegalStateException\n    {\n        return null;\n    }\n\n    @Override\n    public FilterRegistration.Dynamic addFilter(String filterName, Filter filter)\n        throws IllegalArgumentException, IllegalStateException\n    {\n        return null;\n    }\n\n    @Override\n    public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)\n        throws IllegalArgumentException, IllegalStateException\n    {\n        return null;\n    }\n\n    @Override\n    public <T extends Filter> T createFilter(Class<T> clazz) throws ServletException\n    {\n        return null;\n    }\n\n    @Override\n    public FilterRegistration getFilterRegistration(String filterName)\n    {\n        return null;\n    }\n\n    @Override\n    public Map<String, ? extends FilterRegistration> getFilterRegistrations()\n    {\n        return null;\n    }\n\n    @Override\n    public void addListener(Class<? extends EventListener> listenerClass)\n    {\n\n    }\n\n    @Override\n    public void addListener(String className)\n    {\n\n    }\n\n    @Override\n    public <T extends EventListener> void addListener(T t)\n    {\n\n    }\n\n    @Override\n    public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException\n    {\n        return null;\n    }\n\n    @Override\n    public void declareRoles(String... roleNames)\n    {\n\n    }\n\n    @Override\n    public String getVirtualServerName()\n    {\n        return null;\n    }\n\n    @Override\n    public int getSessionTimeout()\n    {\n        return 0;\n    }\n\n    @Override\n    public void setSessionTimeout(int sessionTimeout)\n    {\n\n    }\n\n    @Override\n    public String getRequestCharacterEncoding()\n    {\n        return null;\n    }\n\n    @Override\n    public void setRequestCharacterEncoding(String encoding)\n    {\n\n    }\n\n    @Override\n    public String getResponseCharacterEncoding()\n    {\n        return null;\n    }\n\n    @Override\n    public void setResponseCharacterEncoding(String encoding)\n    {\n\n    }\n\n    @Override\n    public SessionCookieConfig getSessionCookieConfig()\n    {\n        return null;\n    }\n\n    @Override\n    public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)\n    {\n\n    }\n\n    @Override\n    public Set<SessionTrackingMode> getDefaultSessionTrackingModes()\n    {\n        return null;\n    }\n\n    @Override\n    public int getEffectiveMajorVersion() throws UnsupportedOperationException\n    {\n        return 0;\n    }\n\n    @Override\n    public int getEffectiveMinorVersion() throws UnsupportedOperationException\n    {\n        return 0;\n    }\n\n    @Override\n    public Set<SessionTrackingMode> getEffectiveSessionTrackingModes()\n    {\n        return null;\n    }\n\n    @Override\n    public ClassLoader getClassLoader()\n    {\n        return null;\n    }\n\n    @Override\n    public JspConfigDescriptor getJspConfigDescriptor()\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.owb;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.webbeans.config.WebBeansContext;\nimport org.apache.webbeans.spi.ContainerLifecycle;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\n/**\n * OpenWebBeans specific implementation of {@link org.apache.deltaspike.cdise.api.CdiContainer}.\n */\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class OpenWebBeansContainerControl implements CdiContainer\n{\n    private static final Logger LOG = Logger.getLogger(OpenWebBeansContainerControl.class.getName());\n\n    private ContainerLifecycle lifecycle;\n\n    private ContextControl ctxCtrl = null;\n    private Bean<ContextControl> ctxCtrlBean = null;\n    private CreationalContext<ContextControl> ctxCtrlCreationalContext = null;\n\n    @Override\n    public BeanManager getBeanManager()\n    {\n        if (lifecycle == null)\n        {\n            return null;\n        }\n        return lifecycle.getBeanManager();\n    }\n\n    @Override\n    public synchronized void boot()\n    {\n        lifecycle = WebBeansContext.currentInstance().getService(ContainerLifecycle.class);\n\n        Object mockServletContextEvent = null;\n        if (OpenWebBeansContextControl.isServletApiAvailable())\n        {\n            mockServletContextEvent = OwbHelper.getMockServletContextEvent();\n        }\n\n        lifecycle.startApplication(mockServletContextEvent);\n    }\n\n    @Override\n    public void boot(Map<?, ?> properties)\n    {\n        // we do not yet support any configuration.\n        boot();\n    }\n\n    @Override\n    public synchronized void shutdown()\n    {\n        if (ctxCtrl != null)\n        {\n            try\n            {\n                ctxCtrl.stopContexts();\n            }\n            catch (Exception e)\n            {\n                // contexts likely already stopped\n            }\n            ctxCtrlBean.destroy(ctxCtrl, ctxCtrlCreationalContext);\n            ctxCtrl = null;\n        }\n\n        if (lifecycle != null) \n        {\n            Object mockServletContextEvent = null;\n            if (OpenWebBeansContextControl.isServletApiAvailable())\n            {\n                mockServletContextEvent = OwbHelper.getMockServletContextEvent();\n            }\n\n            lifecycle.stopApplication(mockServletContextEvent);\n        }\n        lifecycle = null;\n    }\n\n    @Override\n    public synchronized ContextControl getContextControl()\n    {\n        if (ctxCtrl == null)\n        {\n            BeanManager beanManager = getBeanManager();\n\n            if (beanManager == null)\n            {\n                LOG.warning(\"If the CDI-container was started by the environment, you can't use this helper.\" +\n                        \"Instead you can resolve ContextControl manually \" +\n                        \"(e.g. via BeanProvider.getContextualReference(ContextControl.class) ). \" +\n                        \"If the container wasn't started already, you have to use CdiContainer#boot before.\");\n\n                return null;\n            }\n            Set<Bean<?>> beans = beanManager.getBeans(ContextControl.class);\n            ctxCtrlBean = (Bean<ContextControl>) beanManager.resolve(beans);\n            ctxCtrlCreationalContext = getBeanManager().createCreationalContext(ctxCtrlBean);\n            ctxCtrl = (ContextControl)\n                    getBeanManager().getReference(ctxCtrlBean, ContextControl.class, ctxCtrlCreationalContext);\n        }\n        return ctxCtrl;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"OpenWebBeansContainerControl\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContextControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.owb;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.ConversationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Singleton;\n\nimport java.lang.annotation.Annotation;\n\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.webbeans.config.WebBeansContext;\nimport org.apache.webbeans.spi.ContextsService;\n\n/**\n * OWB specific impl of the {@link ContextControl}\n */\n@Dependent\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class OpenWebBeansContextControl implements ContextControl\n{\n\n    /**\n     * we cannot directly link to MockHttpSession as this would lead to\n     * NoClassDefFound errors for cases where no servlet-api is on the classpath.\n     * E.g in pure SE environments.\n     */\n    private static ThreadLocal<Object> mockSessions = new ThreadLocal<Object>();\n\n\n    @Override\n    public void startContexts()\n    {\n        ContextsService contextsService = getContextsService();\n\n        startSingletonScope();\n        startApplicationScope();\n        startSessionScope();\n        startRequestScope();\n        startConversationScope();\n    }\n\n    public void stopContexts()\n    {\n        stopSessionScope();\n        stopConversationScope();\n        stopRequestScope();\n        stopApplicationScope();\n        stopSingletonScope();\n    }\n\n    @Override\n    public void startContext(Class<? extends Annotation> scopeClass)\n    {\n        if (scopeClass.isAssignableFrom(ApplicationScoped.class))\n        {\n            startApplicationScope();\n        }\n        else if (scopeClass.isAssignableFrom(SessionScoped.class))\n        {\n            startSessionScope();\n        }\n        else if (scopeClass.isAssignableFrom(RequestScoped.class))\n        {\n            startRequestScope();\n        }\n        else if (scopeClass.isAssignableFrom(ConversationScoped.class))\n        {\n            startConversationScope();\n        }\n    }\n\n    public void stopContext(Class<? extends Annotation> scopeClass)\n    {\n        if (scopeClass.isAssignableFrom(ApplicationScoped.class))\n        {\n            stopApplicationScope();\n        }\n        else if (scopeClass.isAssignableFrom(SessionScoped.class))\n        {\n            stopSessionScope();\n        }\n        else if (scopeClass.isAssignableFrom(RequestScoped.class))\n        {\n            stopRequestScope();\n        }\n        else if (scopeClass.isAssignableFrom(ConversationScoped.class))\n        {\n            stopConversationScope();\n        }\n    }\n\n    static boolean isServletApiAvailable()\n    {\n        try\n        {\n            Class servletClass = Class.forName(\"jakarta.servlet.http.HttpSession\");\n            return servletClass != null;\n        }\n        catch (ClassNotFoundException e)\n        {\n            return false;\n        }\n    }\n\n\n    /*\n    * start scopes\n    */\n\n    private void startSingletonScope()\n    {\n        ContextsService contextsService = getContextsService();\n        Object mockServletContext = null;\n        if (isServletApiAvailable())\n        {\n            mockServletContext = OwbHelper.getMockServletContext();\n        }\n        contextsService.startContext(Singleton.class, mockServletContext);\n    }\n\n    private void startApplicationScope()\n    {\n        ContextsService contextsService = getContextsService();\n        Object mockServletContext = null;\n        if (isServletApiAvailable())\n        {\n            mockServletContext = OwbHelper.getMockServletContext();\n        }\n        contextsService.startContext(ApplicationScoped.class, mockServletContext);\n    }\n\n    private void startSessionScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        Object mockSession = null;\n        if (isServletApiAvailable())\n        {\n            mockSession = mockSessions.get();\n            if (mockSession == null)\n            {\n                // we simply use the ThreadName as 'sessionId'\n                mockSession = OwbHelper.getMockSession(Thread.currentThread().getName());\n                mockSessions.set(mockSession);\n            }\n        }\n        contextsService.startContext(SessionScoped.class, mockSession);\n    }\n\n    private void startRequestScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        contextsService.startContext(RequestScoped.class, null);\n    }\n\n    private void startConversationScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        contextsService.startContext(ConversationScoped.class, null);\n    }\n\n    /*\n     * stop scopes\n     */\n\n    private void stopSingletonScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        Object mockServletContext = null;\n        if (isServletApiAvailable())\n        {\n            mockServletContext = OwbHelper.getMockServletContext();\n        }\n        contextsService.endContext(Singleton.class, mockServletContext);\n    }\n\n    private void stopApplicationScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        Object mockServletContext = null;\n        if (isServletApiAvailable())\n        {\n            mockServletContext = OwbHelper.getMockServletContext();\n        }\n        contextsService.endContext(ApplicationScoped.class, mockServletContext);\n    }\n\n    private void stopSessionScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        Object mockSession = null;\n        if (isServletApiAvailable())\n        {\n            mockSession = mockSessions.get();\n            mockSessions.set(null);\n            mockSessions.remove();\n        }\n        contextsService.endContext(SessionScoped.class, mockSession);\n    }\n\n    private void stopRequestScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        contextsService.endContext(RequestScoped.class, null);\n    }\n\n    private void stopConversationScope()\n    {\n        ContextsService contextsService = getContextsService();\n\n        contextsService.endContext(ConversationScoped.class, null);\n    }\n\n    private ContextsService getContextsService()\n    {\n        WebBeansContext webBeansContext = WebBeansContext.currentInstance();\n        return webBeansContext.getContextsService();\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OwbHelper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.owb;\n\nimport jakarta.servlet.ServletContextEvent;\n\n/**\n * A few utility methods for OWB\n */\npublic class OwbHelper\n{\n    private OwbHelper()\n    {\n        // just to prevent initialisation\n    }\n\n    public static Object getMockSession(String sessionId)\n    {\n        return new MockHttpSession(sessionId);\n    }\n\n    public static Object getMockServletContextEvent()\n    {\n        return new ServletContextEvent(MockServletContext.getInstance());\n    }\n\n    public static Object getMockServletContext()\n    {\n        return MockServletContext.getInstance();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n\norg.apache.deltaspike.cdise.owb.OpenWebBeansContainerControl\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-weld/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n~ Licensed to the Apache Software Foundation (ASF) under one\n~ or more contributor license agreements. See the NOTICE file\n~ distributed with this work for additional information\n~ regarding copyright ownership. The ASF licenses this file\n~ to you under the Apache License, Version 2.0 (the\n~ \"License\"); you may not use this file except in compliance\n~ with the License. You may obtain a copy of the License at\n~\n~ http://www.apache.org/licenses/LICENSE-2.0\n~\n~ Unless required by applicable law or agreed to in writing,\n~ software distributed under the License is distributed on an\n~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n~ KIND, either express or implied. See the License for the\n~ specific language governing permissions and limitations\n~ under the License.\n-->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.cdictrl</groupId>\n        <artifactId>cdictrl-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>deltaspike-cdictrl-weld</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike CDI Weld-ContainerControl</name>\n\n    <dependencyManagement>\n        <dependencies>\n            <!-- This will ensure that there will always be correct Weld API version for any build -->\n            <dependency>\n                <groupId>org.jboss.weld</groupId>\n                <artifactId>weld-core-bom</artifactId>\n                <version>${weld.version}</version>\n                <type>pom</type>\n                <scope>import</scope>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.jboss.weld.se</groupId>\n            <artifactId>weld-se-core</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        \n        <!-- Version will de derived from BOM in parent-code -->\n        <dependency>\n            <groupId>org.jboss.weld</groupId>\n            <artifactId>weld-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.el</groupId>\n            <artifactId>jakarta.el-api</artifactId>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>test-utils</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n    \n    <!--Following profiles add TCK tests for CDICTRL when running with Weld1/2/3 profiles--> \n    <!--This eliminated the tests when running on Wildfly container as it makes no sense there-->\n    <profiles>\n        <profile>\n            <id>Weld</id>\n            <build>\n                <plugins>\n                    <plugin>\n                        <artifactId>maven-dependency-plugin</artifactId>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <executions>\n                            <execution>\n                                <id>unpack</id>\n                                <phase>process-test-classes</phase>\n                                <goals>\n                                    <goal>unpack</goal>\n                                </goals>\n                                <configuration>\n                                    <artifactItems>\n                                        <artifactItem>\n                                            <groupId>org.apache.deltaspike.test</groupId>\n                                            <artifactId>deltaspike-cdictrl-tck</artifactId>\n                                            <version>${project.version}</version>\n                                            <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>\n                                        </artifactItem>\n                                    </artifactItems>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>     \n    </profiles>\n</project>\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/WeldContainerControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.weld;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.jboss.weld.Container;\nimport org.jboss.weld.environment.se.Weld;\nimport org.jboss.weld.environment.se.WeldContainer;\nimport org.jboss.weld.util.reflection.Formats;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\n\nimport jakarta.enterprise.context.ConversationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\n\n/**\n * Weld specific implementation of {@link org.apache.deltaspike.cdise.api.CdiContainer}.\n */\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class WeldContainerControl implements CdiContainer\n{\n    private static final Logger LOG = Logger.getLogger(WeldContainerControl.class.getName());\n\n    private Weld weld;\n    private WeldContainer weldContainer;\n\n    private Bean<ContextControl> ctxCtrlBean = null;\n    private CreationalContext<ContextControl> ctxCtrlCreationalContext = null;\n    private ContextControl ctxCtrl = null;\n\n\n    @Override\n    public BeanManager getBeanManager()\n    {\n        if (weldContainer == null)\n        {\n            return null;\n        }\n\n        return weldContainer.getBeanManager();\n    }\n\n\n    @Override\n    public synchronized void boot()\n    {\n        weld = new Weld();\n        weldContainer = weld.initialize();\n    }\n\n    @Override\n    public void boot(Map<?, ?> properties)\n    {\n        weld = new Weld();\n\n        // setProperties only exists from Weld-2.x onwards\n        setProperties(weld, convertProperties(properties));\n\n        weldContainer = weld.initialize();\n    }\n\n    private void setProperties(Weld weld, Map<String, Object> properties)\n    {\n        if (properties == null || properties.isEmpty())\n        {\n            return;\n        }\n\n        Method setPropertiesMethod = extractMethod(Weld.class, \"setProperties\", Map.class);\n        if (setPropertiesMethod != null)\n        {\n            if (!setPropertiesMethod.isAccessible())\n            {\n                setPropertiesMethod.setAccessible(true);\n            }\n\n            try\n            {\n                setPropertiesMethod.invoke(weld, properties);\n            }\n            catch (IllegalAccessException | InvocationTargetException e)\n            {\n                throw new RuntimeException(e);\n            }\n        }\n        else\n        {\n            LOG.warning(\"No setProperties method available on this version of Weld - ignoring passed in properties!\");\n        }\n    }\n\n    /**\n     * Extract a method with the given name and parameterTypes.\n     * Return {@code null} if no such visible method exists on the given class.\n     *\n     * @param clazz\n     * @param methodName\n     * @param parameterTypes\n     * @return\n     */\n    private static Method extractMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)\n    {\n        try\n        {\n            return clazz != null ? clazz.getMethod(methodName, parameterTypes) : null;\n        }\n        catch (NoSuchMethodException e)\n        {\n            return null;\n        }\n    }\n\n\n    @Override\n    public synchronized  void shutdown()\n    {\n        if (ctxCtrl != null)\n        {\n            try\n            {\n                // stops all built-in contexts except for ApplicationScoped as that one is handled by Weld\n                ctxCtrl.stopContext(ConversationScoped.class);\n                ctxCtrl.stopContext(RequestScoped.class);\n                ctxCtrl.stopContext(SessionScoped.class);\n                ctxCtrlBean.destroy(ctxCtrl, ctxCtrlCreationalContext);\n            }\n            catch (Exception e)\n            {\n                // contexts likely already stopped\n            }\n        }\n        try\n        {\n            weld.shutdown();\n        }\n        catch (Exception e)\n        {\n            // something caused weld to shutdown already.\n        }\n        weld = null;\n        ctxCtrl = null;\n        ctxCtrlBean = null;\n        ctxCtrlCreationalContext = null;\n\n    }\n\n    @Override\n    public synchronized ContextControl getContextControl()\n    {\n        if (ctxCtrl == null)\n        {\n            BeanManager beanManager = getBeanManager();\n\n            if (beanManager == null)\n            {\n                LOG.warning(\"If the CDI-container was started by the environment, you can't use this helper.\" +\n                        \"Instead you can resolve ContextControl manually \" +\n                        \"(e.g. via BeanProvider.getContextualReference(ContextControl.class) ). \" +\n                        \"If the container wasn't started already, you have to use CdiContainer#boot before.\");\n\n                return null;\n            }\n            Set<Bean<?>> beans = beanManager.getBeans(ContextControl.class);\n            ctxCtrlBean = (Bean<ContextControl>) beanManager.resolve(beans);\n\n            ctxCtrlCreationalContext = getBeanManager().createCreationalContext(ctxCtrlBean);\n\n            ctxCtrl = (ContextControl)\n                    getBeanManager().getReference(ctxCtrlBean, ContextControl.class, ctxCtrlCreationalContext);\n        }\n        return ctxCtrl;\n    }\n\n\n    @Override\n    public String toString()\n    {\n        return \"WeldContainerControl [Weld \" + Formats.version(Container.class.getPackage()) + ']';\n    }\n    \n    private static Map<String, Object> convertProperties(final Map<?, ?> map)\n    {\n        if (map == null)\n        {\n            return Collections.emptyMap();\n        }\n        return map.entrySet().stream()\n                .collect(Collectors.toMap(\n                        entry -> String.valueOf(entry.getKey()),\n                        Map.Entry::getValue\n                ));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/WeldContextControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.weld;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.ConversationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.enterprise.inject.Instance;\nimport jakarta.inject.Inject;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.jboss.weld.context.ApplicationContext;\nimport org.jboss.weld.context.bound.BoundConversationContext;\nimport org.jboss.weld.context.bound.BoundRequestContext;\nimport org.jboss.weld.context.bound.BoundSessionContext;\nimport org.jboss.weld.context.bound.MutableBoundRequest;\n\n/**\n * Weld specific impl of the {@link org.apache.deltaspike.cdise.api.ContextControl}\n */\n@Dependent\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class WeldContextControl implements ContextControl\n{\n    private static ThreadLocal<RequestContextHolder> requestContexts = new ThreadLocal<RequestContextHolder>();\n    private static ThreadLocal<Map<String, Object>> sessionMaps = new ThreadLocal<Map<String, Object>>();\n\n\n\n    @Inject\n    private ApplicationContext applicationContext;\n\n    @Inject\n    private BoundSessionContext sessionContext;\n\n    @Inject\n    private Instance<BoundRequestContext> requestContextFactory;\n\n    @Inject\n    private BoundConversationContext conversationContext;\n\n\n\n    @Override\n    public void startContexts()\n    {\n        startApplicationScope();\n        startSessionScope();\n        startRequestScope();\n        startConversationScope(null);\n    }\n\n    @Override\n    public void startContext(Class<? extends Annotation> scopeClass)\n    {\n        if (scopeClass.isAssignableFrom(ApplicationScoped.class))\n        {\n            startApplicationScope();\n        }\n        else if (scopeClass.isAssignableFrom(SessionScoped.class))\n        {\n            startSessionScope();\n        }\n        else if (scopeClass.isAssignableFrom(RequestScoped.class))\n        {\n            startRequestScope();\n        }\n        else if (scopeClass.isAssignableFrom(ConversationScoped.class))\n        {\n            startConversationScope(null);\n        }\n    }\n\n    /**\n     * Stops Conversation, Request and Session contexts.\n     * Does NOT stop Application context, only invalidates \n     * App scoped beans, as in Weld this context always active and clears\n     * automatically on shutdown.\n     *\n     * {@inheritDoc}\n     */\n    @Override\n    public void stopContexts()\n    {\n        stopConversationScope();\n        stopRequestScope();\n        stopSessionScope();\n        stopApplicationScope();\n    }\n\n    @Override\n    public void stopContext(Class<? extends Annotation> scopeClass)\n    {\n        if (scopeClass.isAssignableFrom(ApplicationScoped.class))\n        {\n            stopApplicationScope();\n        }\n        else if (scopeClass.isAssignableFrom(SessionScoped.class))\n        {\n            stopSessionScope();\n        }\n        else if (scopeClass.isAssignableFrom(RequestScoped.class))\n        {\n            stopRequestScope();\n        }\n        else if (scopeClass.isAssignableFrom(ConversationScoped.class))\n        {\n            stopConversationScope();\n        }\n    }\n\n    /*\n     * This is a no-op method. In Weld Application Context is active as soon as the container starts\n     */\n    private void startApplicationScope()\n    {\n        // No-op, in Weld Application context is always active\n    }\n\n    /**\n     * Weld Application context is active from container start to its shutdown\n     * This method merely clears out all ApplicationScoped beans BUT the context\n     * will still be active which may result in immediate re-creation of some beans.\n     */\n    private void stopApplicationScope()\n    {\n        // Welds ApplicationContext gets cleaned at shutdown.\n        // Weld App context should be always active\n        if (applicationContext.isActive())\n        {\n            // destroys the bean instances, but the context stays active\n            applicationContext.invalidate();\n        }\n    }\n\n    void startRequestScope()\n    {\n        RequestContextHolder rcHolder = requestContexts.get();\n        if (rcHolder == null)\n        {\n            rcHolder = new RequestContextHolder(requestContextFactory.get(), new HashMap<String, Object>());\n            requestContexts.set(rcHolder);\n            rcHolder.getBoundRequestContext().associate(rcHolder.getRequestMap());\n            rcHolder.getBoundRequestContext().activate();\n        }\n    }\n\n    void stopRequestScope()\n    {\n        RequestContextHolder rcHolder = requestContexts.get();\n        if (rcHolder != null && rcHolder.getBoundRequestContext().isActive())\n        {\n            rcHolder.getBoundRequestContext().invalidate();\n            rcHolder.getBoundRequestContext().deactivate();\n            rcHolder.getBoundRequestContext().dissociate(rcHolder.getRequestMap());\n            requestContexts.set(null);\n            requestContexts.remove();\n        }\n    }\n\n    private void startSessionScope()\n    {\n        Map<String, Object> sessionMap = sessionMaps.get();\n        if (sessionMap == null)\n        {\n            sessionMap = new HashMap<String, Object>();\n            sessionMaps.set(sessionMap);\n        }\n\n        sessionContext.associate(sessionMap);\n        sessionContext.activate();\n\n    }\n\n    private void stopSessionScope()\n    {\n        if (sessionContext.isActive())\n        {\n            sessionContext.invalidate();\n            sessionContext.deactivate();\n            sessionContext.dissociate(sessionMaps.get());\n\n            sessionMaps.set(null);\n            sessionMaps.remove();\n        }\n    }\n\n    void startConversationScope(String cid)\n    {\n        RequestContextHolder rcHolder = requestContexts.get();\n        if (rcHolder == null)\n        {\n            startRequestScope();\n            rcHolder = requestContexts.get();\n        }\n        conversationContext.associate(new MutableBoundRequest(rcHolder.requestMap, sessionMaps.get()));\n        conversationContext.activate(cid);\n    }\n\n    void stopConversationScope()\n    {\n        RequestContextHolder rcHolder = requestContexts.get();\n        if (rcHolder == null)\n        {\n            startRequestScope();\n            rcHolder = requestContexts.get();\n        }\n        if (conversationContext.isActive())\n        {\n            conversationContext.invalidate();\n            conversationContext.deactivate();\n            conversationContext.dissociate(new MutableBoundRequest(rcHolder.getRequestMap(), sessionMaps.get()));\n        }\n    }\n\n\n    private static class RequestContextHolder\n    {\n        private final BoundRequestContext boundRequestContext;\n        private final Map<String, Object> requestMap;\n\n        private RequestContextHolder(BoundRequestContext boundRequestContext, Map<String, Object> requestMap)\n        {\n            this.boundRequestContext = boundRequestContext;\n            this.requestMap = requestMap;\n        }\n\n        public BoundRequestContext getBoundRequestContext()\n        {\n            return boundRequestContext;\n        }\n\n        public Map<String, Object> getRequestMap()\n        {\n            return requestMap;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-weld/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"http://java.sun.com/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xmlns:weld=\"http://jboss.org/schema/weld/beans\"\n       xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd\">\n    <weld:scan>\n        <weld:exclude name=\"org.apache.deltaspike.cdise.weld.WeldContainerControl\"/>\n    </weld:scan>\n</beans>\n"
  },
  {
    "path": "deltaspike/cdictrl/impl-weld/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n\norg.apache.deltaspike.cdise.weld.WeldContainerControl\n"
  },
  {
    "path": "deltaspike/cdictrl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>parent</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../parent/pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>cdictrl-project</artifactId>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike ContainerControl parent</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl-owb</module>\n        <module>impl-weld</module>\n        <module>impl-openejb</module>\n        <module>tck</module>\n    </modules>\n\n</project>\n"
  },
  {
    "path": "deltaspike/cdictrl/tck/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.cdictrl</groupId>\n        <artifactId>cdictrl-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.test</groupId>\n    <artifactId>deltaspike-cdictrl-tck</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike CDI ContainerControl TCK</name>\n\n    <description>\n        The TCK for testing ContainerControl implementations\n    </description>\n\n    <!--\n     * Howto debug TCK tests:\n     *\n     * Go to the implementation you like to debug, e.g. cd ../impl-owb/\n     * and start maven in the surefire-debug mode:\n     * $ mvn test -Dmaven.surefire.debug\n     *\n     * This will start maven and force surefire to open port 5005 for debugging.\n     * Now simply start your IDE with remote debugging port 5005.\n     *\n     * If you like to debug a special test, you can define the\n     * test to run with the -Dtest= option:\n     * $ mvn test -Dmaven.surefire.debug -Dtest=ContainerCtrlTckTest\n    -->\n\n    <dependencies>\n        <dependency>\n            <groupId>jakarta.annotation</groupId>\n            <artifactId>jakarta.annotation-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.inject</groupId>\n            <artifactId>jakarta.inject-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.enterprise</groupId>\n            <artifactId>jakarta.enterprise.cdi-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.interceptor</groupId>\n            <artifactId>jakarta.interceptor-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>compile</scope>\n            <optional>true</optional>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>test-utils</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.tck;\n\n\nimport java.util.Set;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.cdise.tck.beans.Car;\nimport org.apache.deltaspike.cdise.tck.beans.CarRepair;\nimport org.apache.deltaspike.cdise.tck.beans.TestUser;\nimport org.apache.deltaspike.test.control.LockedImplementation;\nimport org.apache.deltaspike.test.control.LockedVersionRange;\nimport org.apache.deltaspike.test.control.VersionControlRule;\nimport org.apache.deltaspike.test.utils.Implementation;\nimport org.junit.Assert;\nimport org.junit.Rule;\nimport org.junit.Test;\n\n/**\n * TCK test for the {@link org.apache.deltaspike.cdise.api.CdiContainer}\n */\npublic class ContainerCtrlTckTest\n{\n    private static final Logger log = Logger.getLogger(ContainerCtrlTckTest.class.getName());\n    private static final int NUM_THREADS = 10;\n\n    @Rule\n    public VersionControlRule versionControlRule = new VersionControlRule();\n\n    @Test\n    public void testContainerBoot()\n    {\n        CdiContainer cc = CdiContainerLoader.getCdiContainer();\n        Assert.assertNotNull(cc);\n\n        cc.boot();\n        cc.getContextControl().startContexts();\n\n        BeanManager bm = cc.getBeanManager();\n        Assert.assertNotNull(bm);\n        \n        Set<Bean<?>> beans = bm.getBeans(CarRepair.class);\n        Bean<?> bean = bm.resolve(beans);\n        \n        CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));\n        Assert.assertNotNull(carRepair);\n\n        Assert.assertNotNull(carRepair.getCar());\n        Assert.assertNotNull(carRepair.getCar().getUser());\n\n        cc.shutdown();\n    }\n\n    @Test\n    public void testParallelThreadExecution() throws Exception\n    {\n        final CdiContainer cc = CdiContainerLoader.getCdiContainer();\n        Assert.assertNotNull(cc);\n\n        cc.boot();\n        cc.getContextControl().startContexts();\n\n        final BeanManager bm = cc.getBeanManager();\n        Assert.assertNotNull(bm);\n\n        final AtomicInteger numErrors = new AtomicInteger(0);\n        final ContextControl contextControl = cc.getContextControl();\n\n        Runnable runnable = new Runnable()\n        {\n            @Override\n            public void run()\n            {\n                try\n                {\n                    contextControl.startContext(SessionScoped.class);\n                    contextControl.startContext(RequestScoped.class);\n\n\n                    Set<Bean<?>> beans = bm.getBeans(CarRepair.class);\n                    Bean<?> bean = bm.resolve(beans);\n\n                    CarRepair carRepair = (CarRepair)\n                            bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));\n                    Assert.assertNotNull(carRepair);\n\n                    for (int i = 0; i < 100000; i++)\n                    {\n                        // we need the threads doing something ;)\n                        Assert.assertNotNull(carRepair.getCar());\n                        Assert.assertNotNull(carRepair.getCar().getUser());\n                        Assert.assertNull(carRepair.getCar().getUser().getName());\n                    }\n                    contextControl.stopContext(RequestScoped.class);\n                    contextControl.stopContext(SessionScoped.class);\n                }\n                catch (Throwable e)\n                {\n                    log.log(Level.SEVERE, \"An exception happened on a new worker thread\", e);\n                    numErrors.incrementAndGet();\n                }\n            }\n        };\n\n\n        Thread[] threads = new Thread[NUM_THREADS];\n        for (int i = 0 ; i < NUM_THREADS; i++)\n        {\n            threads[i] = new Thread(runnable);\n        }\n\n        for (int i = 0 ; i < NUM_THREADS; i++)\n        {\n            threads[i].start();\n        }\n\n        for (int i = 0 ; i < NUM_THREADS; i++)\n        {\n            threads[i].join();\n        }\n\n        Assert.assertEquals(\"An error happened while executing parallel threads\", 0, numErrors.get());\n\n\n        cc.shutdown();\n    }\n\n    /**\n     * Stops and starts: application-, session- and request-scope.\n     * <p/>\n     * application-scoped instance has a ref to\n     * request-scoped instance which has a ref to\n     * session-scoped instance.\n     * <p/>\n     * If the deepest ref has the expected value, all levels in between were resetted correctly.\n     */\n    @Test\n    public void testRestartContexts()\n    {\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        Assert.assertNotNull(cdiContainer);\n\n        cdiContainer.boot();\n        cdiContainer.getContextControl().startContexts();\n\n        BeanManager beanManager = cdiContainer.getBeanManager();\n        Assert.assertNotNull(beanManager);\n\n        Set<Bean<?>> beans = beanManager.getBeans(CarRepair.class);\n        Bean<?> bean = beanManager.resolve(beans);\n\n        CarRepair carRepair = (CarRepair)\n            beanManager.getReference(bean, CarRepair.class, beanManager.createCreationalContext(bean));\n\n        Assert.assertNotNull(carRepair);\n\n        Car car = carRepair.getCar();\n\n        Assert.assertNotNull(car);\n        Assert.assertNotNull(car.getUser());\n\n\n        carRepair.getCar().getUser().setName(\"tester\");\n        Assert.assertEquals(\"tester\", car.getUser().getName());\n\n        Assert.assertFalse(CarRepair.isPreDestroyCalled());\n        Assert.assertFalse(Car.isPreDestroyCalled());\n        Assert.assertFalse(TestUser.isPreDestroyCalled());\n\n        cdiContainer.getContextControl().stopContexts();\n\n        Assert.assertTrue(CarRepair.isPreDestroyCalled());\n        Assert.assertTrue(Car.isPreDestroyCalled());\n        Assert.assertTrue(TestUser.isPreDestroyCalled());\n\n        try\n        {\n            car.getUser();\n\n            // accessing the car should have triggered a ContextNotActiveException\n            Assert.fail();\n        }\n        catch (ContextNotActiveException e)\n        {\n            //do nothing - exception expected\n        }\n\n        cdiContainer.getContextControl().startContexts();\n\n        carRepair = (CarRepair)\n            beanManager.getReference(bean, CarRepair.class, beanManager.createCreationalContext(bean));\n\n        Assert.assertNotNull(carRepair.getCar());\n        Assert.assertNotNull(carRepair.getCar().getUser());\n        Assert.assertNull(carRepair.getCar().getUser().getName());\n\n        cdiContainer.shutdown();\n    }\n\n    @LockedImplementation(versions = {\n            @LockedVersionRange(implementation = Implementation.WELD11, versionRange = \"[1.1.14,1.2)\"),\n            @LockedVersionRange(implementation = Implementation.WELD20, versionRange = \"[2.0.1.Final,2.1)\")\n        })\n    @Test\n    public void testShutdownWithInactiveContexts()\n    {\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        Assert.assertNotNull(cdiContainer);\n\n        cdiContainer.boot();\n        cdiContainer.getContextControl().startContexts();\n\n        // now do some random stuff\n        BeanManager beanManager = cdiContainer.getBeanManager();\n        Assert.assertNotNull(beanManager);\n\n        Set<Bean<?>> beans = beanManager.getBeans(CarRepair.class);\n        Bean<?> bean = beanManager.resolve(beans);\n\n        CarRepair carRepair = (CarRepair)\n                beanManager.getReference(bean, CarRepair.class, beanManager.createCreationalContext(bean));\n\n        Assert.assertNotNull(carRepair);\n\n        Car car = carRepair.getCar();\n\n        Assert.assertNotNull(car);\n        Assert.assertNotNull(car.getUser());\n\n\n        carRepair.getCar().getUser().setName(\"tester\");\n        Assert.assertEquals(\"tester\", car.getUser().getName());\n\n        Assert.assertFalse(CarRepair.isPreDestroyCalled());\n        Assert.assertFalse(Car.isPreDestroyCalled());\n        Assert.assertFalse(TestUser.isPreDestroyCalled());\n\n        cdiContainer.getContextControl().stopContexts();\n\n        Assert.assertTrue(CarRepair.isPreDestroyCalled());\n        Assert.assertTrue(Car.isPreDestroyCalled());\n        Assert.assertTrue(TestUser.isPreDestroyCalled());\n\n        cdiContainer.shutdown();\n    }\n\n    @Test\n    public void testNewRequests()\n    {\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        Assert.assertNotNull(cdiContainer);\n\n        cdiContainer.boot();\n        cdiContainer.getContextControl().startContext(SessionScoped.class);\n        cdiContainer.getContextControl().startContext(RequestScoped.class);\n\n        BeanManager beanManager = cdiContainer.getBeanManager();\n        Assert.assertNotNull(beanManager);\n\n        TestUser testUser = resolveInstance(beanManager, TestUser.class);\n\n        Assert.assertNotNull(testUser);\n        testUser.setName(\"tester\");\n\n\n        CarRepair carRepair = resolveInstance(beanManager, CarRepair.class);\n\n        Assert.assertNotNull(carRepair);\n\n        Car car = carRepair.getCar();\n\n        Assert.assertNotNull(car);\n        Assert.assertNotNull(car.getUser());\n        Assert.assertEquals(\"tester\", car.getUser().getName());\n\n\n        carRepair.getCar().getUser().setName(\"tck-tester\");\n        Assert.assertEquals(\"tck-tester\", testUser.getName());\n\n        cdiContainer.getContextControl().stopContext(RequestScoped.class);\n        cdiContainer.getContextControl().startContext(RequestScoped.class);\n\n        try\n        {\n            testUser = resolveInstance(beanManager, TestUser.class);\n\n            Assert.assertNotNull(testUser);\n            Assert.assertNotNull(testUser.getName());\n            Assert.assertEquals(\"tck-tester\", testUser.getName());\n        }\n        catch (ContextNotActiveException e)\n        {\n            Assert.fail(e.getMessage());\n        }\n\n        try\n        {\n            carRepair = resolveInstance(beanManager, CarRepair.class);\n\n            Assert.assertNotNull(carRepair);\n\n            car = carRepair.getCar();\n\n            Assert.assertNotNull(car);\n            Assert.assertNotNull(car.getUser());\n            Assert.assertNotNull(car.getUser().getName());\n            Assert.assertEquals(\"tck-tester\", car.getUser().getName());\n        }\n        catch (ContextNotActiveException e)\n        {\n            Assert.fail(e.getMessage());\n        }\n\n        cdiContainer.shutdown();\n    }\n\n    private <T> T resolveInstance(BeanManager beanManager, Class<T> beanClass)\n    {\n        Set<Bean<?>> beans = beanManager.getBeans(beanClass);\n        Bean<?> bean = beanManager.resolve(beans);\n\n        return (T) beanManager.getReference(bean, beanClass, beanManager.createCreationalContext(bean));\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/Car.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.tck.beans;\n\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Inject;\n\n@RequestScoped\npublic class Car\n{\n    private static ThreadLocal<Boolean> preDestroyCalled = new ThreadLocal<Boolean>();\n\n    @Inject\n    private TestUser user;\n\n    @PostConstruct\n    protected void onPostConstruct()\n    {\n        //reset it\n        preDestroyCalled.remove();\n        preDestroyCalled.set(false);\n    }\n\n    @PreDestroy\n    protected void onPreDestroy()\n    {\n        preDestroyCalled.set(true);\n    }\n\n    public TestUser getUser()\n    {\n        return user;\n    }\n\n    public static boolean isPreDestroyCalled()\n    {\n        return preDestroyCalled.get();\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/CarRepair.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.tck.beans;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class CarRepair\n{\n    private static ThreadLocal<Boolean> preDestroyCalled = new ThreadLocal<Boolean>();\n\n    @Inject\n    private Car car;\n\n    @PostConstruct\n    protected void onPostConstruct()\n    {\n        //reset it\n        preDestroyCalled.remove();\n        preDestroyCalled.set(false);\n    }\n\n    @PreDestroy\n    protected void onPreDestroy()\n    {\n        preDestroyCalled.set(true);\n    }\n\n    public Car getCar()\n    {\n        return car;\n    }\n\n    public static boolean isPreDestroyCalled()\n    {\n        return preDestroyCalled.get();\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/TestUser.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.cdise.tck.beans;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.SessionScoped;\nimport java.io.Serializable;\n\n@SessionScoped\npublic class TestUser implements Serializable\n{\n    private static final long serialVersionUID = -4171521313675763849L;\n    private static ThreadLocal<Boolean> preDestroyCalled = new ThreadLocal<Boolean>();\n\n    private String name;\n\n    @PostConstruct\n    protected void onPostConstruct()\n    {\n        //reset it\n        preDestroyCalled.remove();\n        preDestroyCalled.set(false);\n    }\n\n    @PreDestroy\n    protected void onPreDestroy()\n    {\n        preDestroyCalled.set(true);\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public static boolean isPreDestroyCalled()\n    {\n        return preDestroyCalled.get();\n    }\n}\n"
  },
  {
    "path": "deltaspike/cdictrl/tck/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/checkstyle-rules/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>deltaspike-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike</groupId>\n    <artifactId>checkstyle-rules</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike CheckStyle-rules</name>\n\n</project>\n\n"
  },
  {
    "path": "deltaspike/checkstyle-rules/src/main/resources/deltaspike/asf-header.txt",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n"
  },
  {
    "path": "deltaspike/checkstyle-rules/src/main/resources/deltaspike/default-checks.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE module PUBLIC\n    \"-//Puppy Crawl//DTD Check Configuration 1.2//EN\"\n    \"http://www.puppycrawl.com/dtds/configuration_1_2.dtd\">\n\n<!--\n  Checkstyle configuration that checks the OpenWebBeans coding conventions.\n-->\n\n<module name=\"Checker\">\n\n    <!-- Checks that a package.html file exists for each package.     -->\n    <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->\n    <!-- module name=\"PackageHtml\"/ -->\n\n    <!-- Checks whether files end with a new line.                        -->\n    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->\n    <!-- module name=\"NewlineAtEndOfFile\"/ -->\n\n    <!-- Checks that property files contain the same keys.         -->\n    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->\n    <!-- module name=\"Translation\"/ -->\n\n    <!-- Checks for Headers                              -->\n    <!-- See http://checkstyle.sf.net/config_header.html -->\n    <module name=\"Header\">\n        <property name=\"headerFile\" value=\"${checkstyle.header.file}\"/>\n        <property name=\"fileExtensions\" value=\"java\"/>\n    </module>\n\n    <!-- Checks for Size Violations.                    -->\n    <!-- See http://checkstyle.sf.net/config_sizes.html -->\n    <module name=\"FileLength\">\n        <property name=\"max\" value=\"3500\" />\n        <property name=\"fileExtensions\" value=\"java\"/>\n    </module>\n\n    <!-- Checks for whitespace                               -->\n    <!-- See http://checkstyle.sf.net/config_whitespace.html -->\n    <module name=\"FileTabCharacter\"/>\n\n    <!-- allow usage of CHECKSTYLE:OFF and CHECKSTYLE:ON -->\n    <module name=\"SuppressionCommentFilter\"/>\n\n\n    <module name=\"TreeWalker\">\n\n        <module name=\"FileContentsHolder\"/>\n\n        <property name=\"cacheFile\" value=\"${checkstyle.cache.file}\"/>\n\n        <!-- Checks for Javadoc comments.                     -->\n        <!-- See http://checkstyle.sf.net/config_javadoc.html -->\n        <!-- module name=\"JavadocMethod\"/ -->\n        <!-- module name=\"JavadocType\"/ -->\n        <!-- module name=\"JavadocVariable\"/ -->\n\n\n        <!-- Checks for Naming Conventions.                  -->\n        <!-- See http://checkstyle.sf.net/config_naming.html -->\n        <module name=\"MemberName\">\n          <property name=\"format\" value=\"^[a-z][a-zA-Z0-9]*$\"/>\n        </module>\n\n        <module name=\"ConstantName\">\n          <!-- Normal rules, except that:\n             -  * any name can start with an underscore.\n             -  * \"log\" is allowed; this is a traditional name for log objects\n             -  * names ending with \"ThreadLocal\" are allowed so that threadlocal vars don't have to be\n             -    all-caps. They are static final, but are not really constants. Yes, type prefixes\n             -    on variable names sucks (\"hungarian notation\") but checkstyle doesn't allow \n             -    name rules to vary by the type of the constant, and no other alternative seems\n             -    any better.\n             -->\n          <property name=\"format\" \n             value=\"^((log)|(logger)|([a-z][a-zA-Z]*ThreadLocal)|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*))$\"/>\n        </module>\n\n        <module name=\"LocalVariableName\"/>\n        <module name=\"MethodName\"/>\n        <module name=\"PackageName\"/>\n        <module name=\"LocalFinalVariableName\"/>\n        <module name=\"ParameterName\"/>\n        <module name=\"StaticVariableName\"/>\n        <module name=\"TypeName\"/>\n\n        <!-- Checks for imports                              -->\n        <!-- See http://checkstyle.sf.net/config_import.html -->\n        <module name=\"AvoidStarImport\">\n            <property name=\"excludes\" value=\"java.io,java.net,java.util,jakarta.enterprise.inject.spi,jakarta.enterprise.context\"/>\n        </module>\n        <module name=\"IllegalImport\"/>\n        <module name=\"RedundantImport\"/>\n        <module name=\"UnusedImports\"/>\n\n\n        <module name=\"LineLength\">\n          <property name=\"max\" value=\"150\" />\n          <property name=\"ignorePattern\" value=\"@version|@see\"/>\n        </module>\n        <module name=\"MethodLength\">\n          <property name=\"max\" value=\"200\" />\n        </module>\n        <module name=\"ParameterNumber\">\n          <property name=\"max\" value=\"10\" />\n        </module>\n\n\n        <!-- Modifier Checks                                    -->\n        <!-- See http://checkstyle.sf.net/config_modifiers.html -->\n        <!-- module name=\"ModifierOrder\"/ -->\n        <!-- module name=\"RedundantModifier\"/ -->\n\n        <!-- Checks for blocks. You know, those {}'s         -->\n        <!-- See http://checkstyle.sf.net/config_blocks.html -->\n        <!-- module name=\"EmptyBlock\"/ -->\n        <module name=\"NeedBraces\"/>\n        <module name=\"LeftCurly\">\n          <property name=\"option\" value=\"nl\"/>\n        </module>\n        <module name=\"RightCurly\">\n          <property name=\"option\" value=\"alone\"/>\n        </module>\n\n        <!-- Checks for common coding problems               -->\n        <!-- See http://checkstyle.sf.net/config_coding.html -->\n        <module name=\"EmptyStatement\"/>\n        <module name=\"EqualsHashCode\"/>\n        <module name=\"InnerAssignment\"/>\n        <module name=\"DefaultComesLast\"/>\n        <module name=\"MissingSwitchDefault\"/>\n        <module name=\"FallThrough\"/>\n        <module name=\"MultipleVariableDeclarations\"/>\n\n        <!-- Checks for class design                         -->\n        <!-- See http://checkstyle.sf.net/config_design.html -->\n        <!-- module name=\"DesignForExtension\"/ -->\n        <module name=\"com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck\">\n            <property name=\"severity\" value=\"ignore\"/>\n        </module>\n        \n        <!-- module name=\"FinalClass\"/ -->\n        <!-- module name=\"HideUtilityClassConstructor\"/ -->\n        <!-- module name=\"InterfaceIsType\"/ -->\n        <!-- module name=\"VisibilityModifier\"/ -->\n        <module name=\"com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck\">\n            <property name=\"packageAllowed\" value=\"false\"/>\n            <property name=\"protectedAllowed\" value=\"true\"/>\n            <property name=\"publicMemberPattern\" value=\"^serialVersionUID\"/>\n            <property name=\"severity\" value=\"warning\"/>\n        </module>\n\n\n        <!-- Miscellaneous other checks.                   -->\n        <!-- See http://checkstyle.sf.net/config_misc.html -->\n        <!-- module name=\"ArrayTypeStyle\"/ -->\n        <!-- module name=\"FinalParameters\"/ -->\n        <!-- Line with Trailing Spaces (disabled as it's to noisy)\n        <module name=\"GenericIllegalRegexp\">\n            <property name=\"format\" value=\"\\s+$\"/>\n            <property name=\"message\" value=\"Line has trailing spaces.\"/>\n        </module>\n          -->\n        <module name=\"UpperEll\"/>\n\n        <module name=\"WhitespaceAround\">\n            <property name=\"tokens\" value=\"\"/>\n        </module>\n        <module name=\"StringLiteralEquality\"/>\n        <module name=\"NoFinalizer\"/>\n        <module name=\"MissingOverride\"/>\n        <module name=\"HideUtilityClassConstructor\"/>\n        <module name=\"EqualsAvoidNull\"/>\n        <module name=\"DeclarationOrder\"/>\n        <!--module name=\"MultipleStringLiterals\"/-->\n        <module name=\"OneStatementPerLine\"/>\n        <module name=\"Indentation\"/>\n        <module name=\"ModifierOrder\"/>\n        <module name=\"RedundantModifier\"/>\n    </module>\n\n</module>\n\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/common/DeltaSpike.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.common;\n\nimport java.lang.annotation.Documented;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport jakarta.inject.Qualifier;\n\n/**\n * Common qualifier to manage co-existence of DeltaSpike features and Java EE features.\n */\n@Target( { TYPE, METHOD, PARAMETER, FIELD })\n@Retention(value = RetentionPolicy.RUNTIME)\n@Documented\n@Qualifier\npublic @interface DeltaSpike\n{\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/BeforeHandles.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control;\n\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marker annotation for a method to be considered an Exception Handler, handles the exception in the BEFORE traversal\n * of the exception chain.\n * <p>\n * Handlers methods typically have this form:<br />\n * <pre>public void handle(@BeforeHandles <i>@OptionalQualifier</i> ExceptionEvent&lt;<i>TypeOfTheException</i>&gt; evt)\n * </pre>.\n * </p>\n *\n * If a handler method has a return type, it is ignored.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.PARAMETER)\n@Documented\npublic @interface BeforeHandles\n{\n    /**\n     * Precedence relative to callbacks for the same type. Handler with a higher ordinal is invoked before a handler\n     * with a lower ordinal.\n     */\n    int ordinal() default 0;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/ExceptionHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marker for types containing Exception Handler methods.\n *\n * @see BeforeHandles\n * @see Handles\n */\n@Stereotype\n\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.TYPE)\n@Documented\npublic @interface ExceptionHandler\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/ExceptionHandlingFlow.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control;\n\n/**\n * Enum of exception handling states. Used in the dispatcher to determine how to markHandled.\n */\npublic enum ExceptionHandlingFlow\n{\n    HANDLED,\n    HANDLED_AND_CONTINUE,\n    SKIP_CAUSE,\n    ABORT,\n    THROW_ORIGINAL,\n    THROW\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/ExceptionStackItem.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.Serializable;\nimport java.util.Arrays;\n\n/**\n * Container for the exception and it's stack trace.\n */\n@SuppressWarnings(\"CdiManagedBeanInconsistencyInspection\")\n@Vetoed\npublic final class ExceptionStackItem implements Serializable\n{\n    private static final long serialVersionUID = 5162936095781886477L;\n\n    private final Throwable throwable;\n    private final StackTraceElement[] stackTraceElements;\n\n    public ExceptionStackItem(final Throwable cause)\n    {\n        this(cause, cause.getStackTrace());\n    }\n\n    public ExceptionStackItem(Throwable throwable, StackTraceElement[] stackTraceElements)\n    {\n        this.stackTraceElements = stackTraceElements.clone();\n        this.throwable = throwable;\n    }\n\n    public StackTraceElement[] getStackTraceElements()\n    {\n        return stackTraceElements.clone();\n    }\n\n    public Throwable getThrowable()\n    {\n        return throwable;\n    }\n\n    @Override\n    public String toString()\n    {\n        return new StringBuilder().\n                append(\"throwable: \").append(throwable).append(\", \").\n                append(\"stackTraceElements: \").append(Arrays.toString(stackTraceElements)).\n                toString();\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n\n        ExceptionStackItem that = (ExceptionStackItem) o;\n\n        if (!Arrays.equals(stackTraceElements, that.stackTraceElements))\n        {\n            return false;\n        }\n        if (!throwable.equals(that.throwable))\n        {\n            return false;\n        }\n\n        return true;\n\n    }\n\n    @Override\n    public int hashCode()\n    {\n        int result = throwable.hashCode();\n        result = 31 * result + Arrays.hashCode(stackTraceElements);\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/HandlerMethod.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Set;\n\n/**\n * Metadata interface for an exception handler method. It is the responsibility of the\n * implementation to support {@link jakarta.enterprise.inject.spi.InjectionPoint}s and to\n * validate those {@link jakarta.enterprise.inject.spi.InjectionPoint}s.\n *\n * @param <T> Exception for which this handler is responsible\n */\npublic interface HandlerMethod<T extends Throwable>\n{\n    /**\n     * Obtains the set of handled event qualifiers.\n     */\n    Set<Annotation> getQualifiers();\n\n    /**\n     * Obtains the handled event type.\n     */\n    Type getExceptionType();\n\n    /**\n     * Flag indicating this handler should be invoked during the before traversal.\n     */\n    boolean isBeforeHandler();\n\n    /**\n     * Calls the handler method, passing the given event object.\n     *\n     * @param event event to pass to the handler.\n     * @param beanManager The BeanManager to use\n     */\n    void notify(ExceptionEvent<T> event, BeanManager beanManager) throws Exception;\n\n    /**\n     * Obtains the precedence of the handler, relative to other handlers for the same type. Handler with a higher\n     * ordinal is invoked before a handler with a lower ordinal.\n     */\n    int getOrdinal();\n\n    /**\n     * Basic {@link Object#equals(Object)} but must use all of the get methods from this interface to\n     * maintain compatibility.\n     *\n     * @param o Object being compared to this.\n     * @return true or false based on standard equality.\n     */\n    @Override\n    boolean equals(Object o);\n\n    @Override\n    int hashCode();\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/Handles.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marker annotation for a method to be considered an Exception Handler.\n *\n * <p>\n * Handlers typically have this form:\n * <pre>\n * public void handle(@Handles <i>@OptionalQualifier</i> ExceptionEvent&lt;<i>TypeOfTheException</i>&gt; evt)</pre>\n * </p>\n *\n * If a handler method has a return type, it is ignored.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.PARAMETER)\n@Documented\npublic @interface Handles\n{\n    /**\n     * Precedence relative to handlers for the same type. Handler with a higher ordinal is invoked before a handler with\n     * a lower ordinal.\n     */\n    int ordinal() default 0; //TODO discuss Precedence\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/event/ExceptionEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control.event;\n\n/**\n * Payload for an exception to be handled. Implementations of this interface should not expose internals and should\n * remain immutable.\n *\n * @param <T> Exception type this event represents\n */\npublic interface ExceptionEvent<T extends Throwable>\n{\n    /**\n     * The exception causing this event.\n     */\n    T getException();\n\n    /**\n     * Instructs the dispatcher to abort further processing of handlers.\n     */\n    void abort();\n\n    /**\n     * Instructs the dispatcher to throw the original exception after handler processing.\n     */\n    void throwOriginal();\n\n    /**\n     * Instructs the dispatcher to terminate additional handler processing and mark the event as handled.\n     */\n    void handled();\n\n    /**\n     * Default instruction to dispatcher, continues handler processing.\n     */\n    void handledAndContinue();\n\n    /**\n     * Similar to {@link ExceptionEvent#handledAndContinue()},\n     * but instructs the dispatcher to markHandled to the next element\n     * in the cause chain without processing additional handlers for this cause chain element.\n     */\n    void skipCause();\n\n    /**\n     * Instructs the dispatcher to allow this handler to be invoked again.\n     */\n    void unmute();\n\n    /**\n     * Rethrow the exception, but use the given exception instead of the original.\n     *\n     * @param t Exception to be thrown in place of the original.\n     */\n    void rethrow(Throwable t);\n\n    /**\n     * Check to see if this exception has been handled.\n     */\n    boolean isMarkedHandled();\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/event/ExceptionStackEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control.event;\n\nimport org.apache.deltaspike.core.api.exception.control.ExceptionStackItem;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.Serializable;\nimport java.sql.SQLException;\nimport java.util.ArrayDeque;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Deque;\n\n/**\n * Information about the current exception and exception cause container.  This object is not immutable.\n */\n@SuppressWarnings(\"CdiManagedBeanInconsistencyInspection\")\n@Vetoed\npublic class ExceptionStackEvent implements Serializable\n{\n    private static final long serialVersionUID = -6069790756478700680L;\n\n    private boolean root;\n    private boolean last;\n    private int initialStackSize;\n    private Throwable next;\n    private Collection<ExceptionStackItem> remaining;\n    private Deque<ExceptionStackItem> exceptionStackItems;\n    // private Deque<ExceptionStackItem> origExceptionStackItems; // TODO: Later\n    private Collection<Throwable> causes;\n    private Throwable current;\n\n    /**\n     * Builds the stack from the given exception.\n     *\n     * @param exception Caught exception\n     */\n    public ExceptionStackEvent(final Throwable exception)\n    {\n        if (exception == null)\n        {\n            throw new IllegalArgumentException(\"exception must not be null\");\n        }\n\n        Throwable e = exception;\n        exceptionStackItems = new ArrayDeque<ExceptionStackItem>();\n\n        do\n        {\n            exceptionStackItems.addFirst(new ExceptionStackItem(e));\n            if (e instanceof SQLException)\n            {\n                SQLException sqlException = (SQLException) e;\n\n                while (sqlException.getNextException() != null)\n                {\n                    sqlException = sqlException.getNextException();\n                    exceptionStackItems.addFirst(new ExceptionStackItem(sqlException));\n                }\n            }\n            e = e.getCause();\n        }\n        while (e != null);\n\n        initialStackSize = exceptionStackItems.size();\n        causes = createThrowableCollection(exceptionStackItems);\n        // TODO: Later this.origExceptionStackItems = new ArrayDeque<ExceptionStackItem>(exceptionStackItems);\n        init();\n\n    }\n\n    private void init()\n    {\n        root = exceptionStackItems.size() == initialStackSize;\n\n        if (!exceptionStackItems.isEmpty())\n        {\n            current = exceptionStackItems.removeFirst().getThrowable();\n            remaining = Collections.unmodifiableCollection(exceptionStackItems);\n        }\n        else\n        {\n            remaining = Collections.emptyList();\n            current = null;\n        }\n\n        last = remaining.isEmpty();\n        next = (last) ? null : exceptionStackItems.peekFirst().getThrowable();\n    }\n\n    private Collection<ExceptionStackItem> createExceptionStackFrom(Collection<Throwable> throwables)\n    {\n        final Deque<ExceptionStackItem> returningCollection = new ArrayDeque<ExceptionStackItem>(throwables.size());\n\n        for (Throwable t : throwables)\n        {\n            returningCollection.addFirst(new ExceptionStackItem(t));\n        }\n\n        return returningCollection;\n    }\n\n    private Collection<Throwable> createThrowableCollection(final Collection<ExceptionStackItem> exceptionStackItems)\n    {\n        // allow current\n        final Deque<Throwable> returningCollection = new ArrayDeque<Throwable>(exceptionStackItems.size() + 1);\n\n        for (ExceptionStackItem item : exceptionStackItems)\n        {\n            returningCollection.addFirst(item.getThrowable());\n        }\n\n        return returningCollection;\n    }\n\n    public Collection<Throwable> getCauseElements()\n    {\n        return Collections.unmodifiableCollection(causes);\n    }\n\n    /**\n     * Test if iteration is finished\n     *\n     * @return finished with iteration\n     */\n    public boolean isLast()\n    {\n        return last;\n    }\n\n    public Throwable getNext()\n    {\n        return next;\n    }\n\n    public Collection<Throwable> getRemaining()\n    {\n        return Collections.unmodifiableCollection(createThrowableCollection(remaining));\n    }\n\n    /**\n     * Tests if the current exception is the root exception\n     *\n     * @return Returns true if iteration is at the root exception (top of the inverted stack)\n     */\n    public boolean isRoot()\n    {\n        return root;\n    }\n\n    /**\n     * Current exception in the iteration\n     *\n     * @return current exception\n     */\n    public Throwable getCurrent()\n    {\n        return current;\n    }\n\n    /**\n     * Internal only.\n     *\n     * @param elements new stack.\n     */\n    public void setCauseElements(Collection<Throwable> elements)\n    {\n        exceptionStackItems = new ArrayDeque<ExceptionStackItem>(createExceptionStackFrom(elements));\n        init();\n    }\n\n    /**\n     * Internal only.\n     */\n    public void skipCause()\n    {\n        init();\n    }\n\n    /**\n     * Done later\n     * The original exception stack if it has been changed.\n     *\n     * @return The original exception stack\n\n    public Deque<ExceptionStackItem> getOrigExceptionStackItems() {\n    }\n     */\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/control/event/ExceptionToCatchEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.exception.control.event;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Entry point event into the Exception Control system.  This object is nearly immutable, the only mutable portion\n * is the handled flag.\n */\n@SuppressWarnings(\"CdiManagedBeanInconsistencyInspection\")\n@Vetoed\npublic class ExceptionToCatchEvent implements Serializable\n{\n    private static final long serialVersionUID = 2646115104528108266L;\n\n    private Throwable exception;\n    private boolean handled;\n    private transient Set<Annotation> qualifiers;\n    private boolean optional;\n\n    /**\n     * Constructor that adds qualifiers for the handler(s) to run.\n     * Typically only integrators will be using this constructor.\n     *\n     * @param exception  Exception to handle\n     * @param qualifiers qualifiers to use to narrow the handlers called\n     */\n    public ExceptionToCatchEvent(Throwable exception, Annotation... qualifiers)\n    {\n        this.exception = exception;\n        this.qualifiers = new HashSet<Annotation>();\n        Collections.addAll(this.qualifiers, qualifiers);\n        this.optional = false;\n    }\n\n    /**\n     * Basic constructor without any qualifiers defined.\n     *\n     * @param exception Exception to handle.\n     */\n    public ExceptionToCatchEvent(Throwable exception)\n    {\n        this.exception = exception;\n        this.qualifiers = Collections.emptySet();\n        this.optional = false;\n    }\n\n    public Throwable getException()\n    {\n        return exception;\n    }\n\n    /**\n     * Internal only.\n     *\n     * @param handled new value\n     */\n    public void setHandled(boolean handled)\n    {\n        this.handled = handled;\n    }\n\n    /**\n     * Test to see if the exception has already been processed by an\n     * {@link org.apache.deltaspike.core.api.exception.control.ExceptionHandler}.\n     *\n     * @return true if the exception has already been processed by a handler; false otherwise\n     */\n    public boolean isHandled()\n    {\n        return handled;\n    }\n\n    /**\n     * Qualifiers with which the instance was created.\n     *\n     * @return Qualifiers with which the instance was created.\n     */\n    public Set<Annotation> getQualifiers()\n    {\n        return Collections.unmodifiableSet(qualifiers);\n    }\n\n    public boolean isOptional()\n    {\n        return optional;\n    }\n\n    public void setOptional(boolean optional)\n    {\n        this.optional = optional;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/lifecycle/Destroyed.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.lifecycle;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport jakarta.inject.Qualifier;\n\n/**\n * Qualifier for events which are fired when servlet objects are destroyed.\n */\n@Qualifier\n@Target({ TYPE, METHOD, PARAMETER, FIELD })\n@Retention(RUNTIME)\n@Documented\npublic @interface Destroyed\n{\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/lifecycle/Initialized.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.lifecycle;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport jakarta.inject.Qualifier;\n\n/**\n * Qualifier for events which are fired when servlet objects are created.\n */\n@Qualifier\n@Target({ TYPE, METHOD, PARAMETER, FIELD })\n@Retention(RUNTIME)\n@Documented\npublic @interface Initialized\n{\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/AlternativeLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link jakarta.enterprise.inject.Alternative}.\n */\npublic class AlternativeLiteral extends AnnotationLiteral<Alternative> implements Alternative\n{\n    private static final long serialVersionUID = -4865048799125718216L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/AnyLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for the {@link jakarta.enterprise.inject.Any} annotation.\n */\npublic class AnyLiteral extends AnnotationLiteral<Any> implements Any\n{\n    private static final long serialVersionUID = -8623640277155878657L;\n}"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/ApplicationScopedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link ApplicationScoped}\n */\npublic class ApplicationScopedLiteral extends AnnotationLiteral<ApplicationScoped> implements ApplicationScoped\n{\n    private static final long serialVersionUID = 6582580975876369665L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/ConversationScopedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.context.ConversationScoped;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link ConversationScoped}\n */\npublic class ConversationScopedLiteral extends AnnotationLiteral<ConversationScoped> implements ConversationScoped\n{\n    private static final long serialVersionUID = -7672396348051568920L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/DefaultLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link Default}\n */\npublic class DefaultLiteral extends AnnotationLiteral<Default> implements Default\n{\n    private static final long serialVersionUID = 3240069236025230401L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/DeltaSpikeLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\nimport org.apache.deltaspike.core.api.common.DeltaSpike;\n\n/**\n * Literal for the {@link org.apache.deltaspike.core.api.common.DeltaSpike} annotation.\n */\npublic class DeltaSpikeLiteral extends AnnotationLiteral<DeltaSpike> implements DeltaSpike\n{\n    public static final DeltaSpike INSTANCE = new DeltaSpikeLiteral();\n    \n    private static final long serialVersionUID = 1835916508118085812L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/DependentScopeLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link Dependent}\n */\npublic class DependentScopeLiteral extends AnnotationLiteral<Dependent> implements Dependent\n{\n    private static final long serialVersionUID = -7408316864366401212L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/DestroyedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\nimport org.apache.deltaspike.core.api.lifecycle.Destroyed;\n\n/**\n * Annotation literal for {@link Destroyed}.\n */\npublic class DestroyedLiteral extends AnnotationLiteral<Destroyed> implements Destroyed\n{\n\n    public static final Destroyed INSTANCE = new DestroyedLiteral();\n\n    private static final long serialVersionUID = 8310730593030223981L;\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/InitializedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\nimport org.apache.deltaspike.core.api.lifecycle.Initialized;\n\n/**\n * Annotation literal for {@link Initialized}.\n */\npublic class InitializedLiteral extends AnnotationLiteral<Initialized> implements Initialized\n{\n\n    public static final Initialized INSTANCE = new InitializedLiteral();\n\n    private static final long serialVersionUID = 2392444150652655120L;\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/InjectableResourceLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResource;\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResourceProvider;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\npublic class InjectableResourceLiteral extends AnnotationLiteral<InjectableResource> implements InjectableResource\n{\n    private static final long serialVersionUID = 1705986508118055892L;\n\n    private final Class<? extends InjectableResourceProvider> resourceProvider;\n    private final String location;\n\n    public InjectableResourceLiteral(Class<? extends InjectableResourceProvider> resourceProvider, String location)\n    {\n        this.resourceProvider = resourceProvider;\n        this.location = location;\n    }\n\n    @Override\n    public String location()\n    {\n        return this.location;\n    }\n\n    @Override\n    public Class<? extends InjectableResourceProvider> resourceProvider()\n    {\n        return this.resourceProvider;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/ModelLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link jakarta.enterprise.inject.Model} annotation.\n */\npublic class ModelLiteral extends AnnotationLiteral<Model> implements Model\n{\n    private static final long serialVersionUID = -1828119201454843678L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/NamedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\nimport jakarta.inject.Named;\n\n/**\n * Literal for {@link jakarta.inject.Named} qualifier.\n */\npublic class NamedLiteral extends AnnotationLiteral<Named> implements Named\n{\n    private static final long serialVersionUID = -1457223276475846060L;\n\n    private final String value;\n\n    public NamedLiteral(String value)\n    {\n        this.value = value;\n    }\n\n    public NamedLiteral()\n    {\n        value = \"\";\n    }\n\n    @Override public String value()\n    {\n        return value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/NewLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.New;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link New}\n */\npublic class NewLiteral extends AnnotationLiteral<New> implements New\n{\n    private static final long serialVersionUID = -4134892777333672942L;\n\n    private final Class<?> value;\n\n    public NewLiteral()\n    {\n        this(New.class);\n    }\n\n    public NewLiteral(Class<?> value)\n    {\n        this.value = value;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Class<?> value()\n    {\n        return value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/RequestScopedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link RequestScoped}\n */\npublic class RequestScopedLiteral extends AnnotationLiteral<RequestScoped> implements RequestScoped\n{\n    private static final long serialVersionUID = -6365776352042023537L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/SessionScopeLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link SessionScoped}\n */\npublic class SessionScopeLiteral extends AnnotationLiteral<SessionScoped> implements SessionScoped\n{\n    private static final long serialVersionUID = -1425877068082208121L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/SingletonLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\nimport jakarta.inject.Singleton;\n\n/**\n * Literal for {@link jakarta.inject.Singleton}\n */\npublic class SingletonLiteral extends AnnotationLiteral<Singleton> implements Singleton\n{\n    private static final long serialVersionUID = 2387772903537960411L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/SpecializesLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link Specializes}\n */\npublic class SpecializesLiteral extends AnnotationLiteral<Specializes> implements Specializes\n{\n    private static final long serialVersionUID = 5092179521672196834L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/literal/TypedLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link jakarta.enterprise.inject.Typed}\n */\npublic class TypedLiteral extends AnnotationLiteral<Typed> implements Typed\n{\n    private static final long serialVersionUID = 6805980497117269525L;\n\n    private final Class<?>[] value;\n\n    public TypedLiteral()\n    {\n        value = new Class<?>[0];\n    }\n\n    public TypedLiteral(Class<?>[] value)\n    {\n        this.value = value;\n    }\n\n    @Override public Class<?>[] value()\n    {\n        return value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/resourceloader/AbstractResourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.resourceloader;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.Instance;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.inject.Inject;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Properties;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * An abstract InjectableResourceProvider implementation with some basic utility functionality.\n */\npublic abstract class AbstractResourceProvider implements InjectableResourceProvider\n{\n    private static final Logger logger = Logger.getLogger(AbstractResourceProvider.class.getName());\n\n    @Inject\n    @Any\n    private Instance<InjectionPoint> injectionPoint;\n\n    protected boolean isXml(String fileName)\n    {\n        return fileName.endsWith(\".xml\");\n    }\n\n    protected InjectionPoint getInjectionPoint()\n    {\n        return this.injectionPoint.get();\n    }\n\n    protected Set<Annotation> getAnnotations()\n    {\n        return this.getInjectionPoint().getAnnotated().getAnnotations();\n    }\n\n    protected void loadInputStreamToProperties(InputStream inputStream, Properties properties, String name)\n    {\n        boolean isXml = this.isXml(name);\n        try\n        {\n            if (isXml)\n            {\n                properties.loadFromXML(inputStream);\n            }\n            else\n            {\n                properties.load(inputStream);\n            }\n        }\n        catch (IOException e)\n        {\n            logger.log(Level.WARNING,\"Unable to read resource \" + name,e);\n\n        }\n    }\n\n    @Override\n    public Properties readProperties(InjectableResource injectableResource)\n    {\n        final Properties properties = new Properties();\n        final String name = injectableResource.location();\n        InputStream inputStream = null;\n        try\n        {\n            inputStream = this.readStream(injectableResource);\n            this.loadInputStreamToProperties(inputStream, properties, name);\n            return properties;\n        }\n        finally\n        {\n            if (inputStream != null)\n            {\n                try\n                {\n                    inputStream.close();\n                }\n                catch (IOException e)\n                {\n                    if (logger.isLoggable(Level.FINE))\n                    {\n                        logger.log(Level.FINE, \"Problem closing resource.\", e);\n                    }\n                }\n            }\n        }\n    }\n\n    @Override\n    public List<InputStream> readStreams(InjectableResource injectableResource)\n    {\n        return Collections.singletonList(this.readStream(injectableResource));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathResourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.resourceloader;\n\nimport org.apache.deltaspike.core.util.ClassUtils;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.Enumeration;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * A classpath-based resource provider.\n */\n@ApplicationScoped\npublic class ClasspathResourceProvider extends AbstractResourceProvider\n{\n    private static final Logger logger = Logger.getLogger(ClasspathResourceProvider.class.getName());\n\n    @Override\n    public InputStream readStream(final InjectableResource injectableResource)\n    {\n        try\n        {\n            List<InputStream> matchedStreams = this.readClassPath(injectableResource.location(),true);\n            return matchedStreams.get(0);\n        }\n        catch (IOException e)\n        {\n            if (logger.isLoggable(Level.FINE))\n            {\n                logger.log(Level.FINE, \"Problem reading resource.\", e);\n            }\n            return null;\n        }\n    }\n\n    @Override\n    public List<InputStream> readStreams(InjectableResource injectableResource)\n    {\n        try\n        {\n            return readClassPath(injectableResource.location(),false);\n        }\n        catch (IOException e)\n        {\n            throw new IllegalStateException(\"Error while trying to load resources from classpath \",e);\n        }\n    }\n\n    /**\n     * Reads all possibly matching classpath entries for the given name.\n     *\n     * If requireUnique is true, then validates that 1 element is present before returning\n     *\n     * @param name\n     * @param requireUnique\n     * @return\n     * @throws IOException\n     * @throws IllegalStateException\n     */\n    private List<InputStream> readClassPath(final String name, final boolean requireUnique)\n        throws IllegalStateException,IOException\n    {\n        Enumeration<URL> urls = ClassUtils.getClassLoader(null).getResources(name);\n        List<URL> urlList = new ArrayList<URL>();\n        List<InputStream> results = new ArrayList<InputStream>();\n        while (urls.hasMoreElements())\n        {\n            URL url = urls.nextElement();\n            InputStream is = url.openStream();\n            if (is != null)\n            {\n                results.add(is);\n                urlList.add(url);\n            }\n        }\n        if (requireUnique && results.size() != 1)\n        {\n            String msg = urlsToString(urlList,name);\n            for (InputStream is : results)\n            {\n                try\n                {\n                    is.close();\n                }\n                catch (IOException e)\n                {\n                    if (logger.isLoggable(Level.FINE))\n                    {\n                        logger.log(Level.FINE,\"Unable to close stream\",e);\n                    }\n                }\n            }\n            throw new IllegalStateException(msg);\n        }\n        return results;\n    }\n\n    private String urlsToString(List<URL> urls, String name)\n    {\n        if (urls.isEmpty())\n        {\n            return String.format(\"No resources found for '%s'\",name);\n        }\n        else\n        {\n            StringBuilder sb = new StringBuilder();\n            sb.append(String.format(\"multiple resources found for '%s'\",name));\n            for (URL u : urls)\n            {\n                sb.append(\" Match : \").append(u.toExternalForm());\n            }\n            return sb.toString();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileResourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.resourceloader;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.InputStream;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * A file-based resource provider, looking for a file based on the name.\n */\n@ApplicationScoped\npublic class FileResourceProvider extends AbstractResourceProvider\n{\n    private static final Logger logger = Logger.getLogger(FileResourceProvider.class.getName());\n    InputStream readFile(final String name)\n    {\n        File f = new File(name);\n        if (f.exists() && f.canRead() && f.isFile())\n        {\n            try\n            {\n                return new FileInputStream(f);\n            }\n            catch (FileNotFoundException e)\n            {\n                logger.log(Level.SEVERE, \"Problem reading resource.\", e);\n                return null;\n            }\n        }\n        else\n        {\n            return null;\n        }\n    }\n\n    @Override\n    public InputStream readStream(InjectableResource injectableResource)\n    {\n        return readFile(injectableResource.location());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/resourceloader/InjectableResource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.resourceloader;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.METHOD;\n\n/**\n * Qualifier which enables simple injection of resources into beans, eliminating the need to deal with their loading.\n *\n * <p>\n * <b>Example:</b>\n * <pre>\n * &#064;Inject\n * &#064;InjectableResource(location=\"myfile.properties\")\n * private Properties props;\n *\n * &#064;Inject\n * &#064;InjectableResource(location=\"config.xml\")\n * private InputStream inputStream;\n * </pre>\n *\n * This can be used to read files, from classpath or the file system, using two default implementations:\n * ClasspathResourceProvider and FileResourceProvider. They can be extended as well by implementing the\n * InjectableResourceProvider interface to allow reading from alternate sources, if needed (e.g. database LOBs, NoSQL\n * storage areas).\n * </p>\n */\n@Target( { TYPE, METHOD, PARAMETER, FIELD })\n@Retention(value = RetentionPolicy.RUNTIME)\n@Documented\n@Qualifier\npublic @interface InjectableResource\n{\n    @Nonbinding\n    Class<? extends InjectableResourceProvider> resourceProvider() default ClasspathResourceProvider.class;\n\n    @Nonbinding\n    String location() default \"\";\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/api/resourceloader/InjectableResourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.resourceloader;\n\nimport java.io.InputStream;\nimport java.util.List;\nimport java.util.Properties;\n\n/**\n * Provides lookup capability to find a resource.\n *\n */\npublic interface InjectableResourceProvider\n{\n\n    InputStream readStream(final InjectableResource injectableResource);\n\n    List<InputStream> readStreams(final InjectableResource injectableResource);\n\n    Properties readProperties(final InjectableResource injectableResource);\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/spi/event/IntrospectiveExceptionEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.spi.exception.control.event;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandlingFlow;\n\n/**\n * Internal view into the ExceptionEvent. Methods on this interface are used by the ExceptionHandlerBroadcaster.\n */\npublic interface IntrospectiveExceptionEvent<T extends Throwable> extends ExceptionEvent<T>\n{\n    /**\n     * Check to see if this event has been unmuted and therefore called again.\n     */\n    boolean isUnmute();\n\n    /**\n     * The next expected step in the exception handling flow (i.e. abort, rethrow, etc)\n     */\n    ExceptionHandlingFlow getCurrentExceptionHandlingFlow();\n\n    boolean isBeforeTraversal();\n\n    /**\n     * Returns the exception that should be thrown if the next step in the flow is THROW.\n     */\n    Throwable getThrowNewException();\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\n\n@Vetoed\npublic abstract class AnnotationUtils\n{\n    private AnnotationUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static <T extends Annotation> T extractAnnotationFromMethodOrClass(\n        BeanManager beanManager, Method targetMethod, Class targetClass, Class<T> targetAnnotationType)\n    {\n        T result = extractAnnotationFromMethod(beanManager, targetMethod, targetAnnotationType);\n\n        if (result == null)\n        {\n            //see DELTASPIKE-517\n            Class unproxiedTargetClass = ProxyUtils.getUnproxiedClass(targetClass);\n\n            // and if not found search on the class\n            result = findAnnotation(beanManager, unproxiedTargetClass.getAnnotations(), targetAnnotationType);\n        }\n        return result;\n    }\n\n    public static <T extends Annotation> T extractAnnotationFromMethod(\n        BeanManager beanManager, Method targetMethod, Class<T> targetAnnotationType)\n    {\n        return findAnnotation(beanManager, targetMethod.getAnnotations(), targetAnnotationType);\n    }\n\n    public static  <T extends Annotation> T findAnnotation(\n            BeanManager beanManager, Annotation[] annotations, Class<T> targetAnnotationType)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (targetAnnotationType.equals(annotation.annotationType()))\n            {\n                return (T) annotation;\n            }\n            if (beanManager.isStereotype(annotation.annotationType()))\n            {\n                T result = findAnnotation(\n                        beanManager, annotation.annotationType().getAnnotations(), targetAnnotationType);\n                if (result != null)\n                {\n                    return result;\n                }\n            }\n        }\n        return null;\n    }\n\n    //based on org.apache.webbeans.container.BeanCacheKey#getQualifierHashCode\n    public static int getQualifierHashCode(Annotation annotation)\n    {\n        Class annotationClass = annotation.annotationType();\n\n        int hashCode = getTypeHashCode(annotationClass);\n\n        for (Method member : annotationClass.getDeclaredMethods())\n        {\n            if (member.isAnnotationPresent(Nonbinding.class))\n            {\n                continue;\n            }\n\n            final Object annotationMemberValue = ReflectionUtils.invokeMethod(annotation, member, Object.class, true);\n\n            final int arrayValue;\n            if (annotationMemberValue == null /*possible with literals*/)\n            {\n                arrayValue = 0;\n            }\n            else if (annotationMemberValue.getClass().isArray())\n            {\n                Class<?> annotationMemberType = annotationMemberValue.getClass().getComponentType();\n                if (annotationMemberType.isPrimitive())\n                {\n                    if (Long.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((long[]) annotationMemberValue);\n                    }\n                    else if (Integer.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((int[]) annotationMemberValue);\n                    }\n                    else if (Short.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((short[]) annotationMemberValue);\n                    }\n                    else if (Double.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((double[]) annotationMemberValue);\n                    }\n                    else if (Float.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((float[]) annotationMemberValue);\n                    }\n                    else if (Boolean.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((boolean[]) annotationMemberValue);\n                    }\n                    else if (Byte.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((byte[]) annotationMemberValue);\n                    }\n                    else if (Character.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((char[]) annotationMemberValue);\n                    }\n                    else\n                    {\n                        arrayValue = 0;\n                    }\n                }\n                else\n                {\n                    arrayValue = Arrays.hashCode((Object[]) annotationMemberValue);\n                }\n            }\n            else\n            {\n                arrayValue = annotationMemberValue.hashCode();\n            }\n\n            hashCode = 29 * hashCode + arrayValue;\n            hashCode = 29 * hashCode + member.getName().hashCode();\n        }\n\n        return hashCode;\n    }\n\n    private static int getTypeHashCode(Type type)\n    {\n        int typeHash = type.hashCode();\n        if (typeHash == 0 && type instanceof Class)\n        {\n            return ((Class)type).getName().hashCode();\n        }\n\n        return typeHash;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/CollectionUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport java.util.Collection;\nimport jakarta.enterprise.inject.Vetoed;\n\n/**\n * A collection of utilities for working with Collections\n */\n@Vetoed\npublic abstract class CollectionUtils\n{\n    private CollectionUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static boolean isEmpty(Collection<?> collection)\n    {\n        return collection == null || collection.isEmpty();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/ParentExtensionStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.spi.Extension;\n\nimport java.lang.ref.WeakReference;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Set;\n\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\n\n/**\n * Support for Containers with 'hierarchic BeanManagers'\n * This is mostly useful for EAR applications.\n *\n * Some EE Container scan the common shared EAR lib path and reuse this information\n * for the webapps in the EAR. This is actually the only approach a container can\n * do to prevent mem leaks and side effects spreading to different webapps.\n * Of course this also means that the webapps get their own (different)\n * instances of an Extension.\n *\n * To acknowledge this solution we provide a mechanism to lookup 'parent Extensions'\n * which is very similar to handling parent ClassLoaders.\n *\n * Please note that you need to enable this handling if you are running DeltaSpike\n * in an EAR on a container which supports parent Extensions.\n * You can do that by settting {@code \"deltaspike.parent.extension.enabled\"} to &quote;true&quote;\n *\n * All your Extension has to do is to register itself in\n * {@link jakarta.enterprise.inject.spi.BeforeBeanDiscovery}.\n * Later at boot time the Extension can lookup it's parent Extension instance and\n * e.g. check which classes got scanned in the parent ClassLoader.\n *\n * The ExtensionInfo automatically gets removed if the webapp gets undeployed.\n *\n * @see org.apache.deltaspike.core.api.config.base.CoreBaseConfig.ParentExtensionCustomization\n */\npublic final class ParentExtensionStorage\n{\n\n    private static Set<ExtensionStorageInfo> extensionStorage = new HashSet<ExtensionStorageInfo>();\n\n    private ParentExtensionStorage()\n    {\n        // utility class ct\n    }\n\n    /**\n     * Add info about an Extension to our storage\n     * This method is usually called during boostrap via {@code &#064;Observes BeforeBeanDiscovery}.\n     */\n    public static synchronized void addExtension(Extension extension)\n    {\n        if (usingParentExtension())\n        {\n            removeAbandonedExtensions();\n\n            ClassLoader classLoader = ClassUtils.getClassLoader(null);\n            extensionStorage.add(new ExtensionStorageInfo(classLoader, extension));\n        }\n    }\n\n    /**\n     * When adding a new Extension we also clean up ExtensionInfos\n     * from ClassLoaders which got unloaded.\n     */\n\n    private static boolean usingParentExtension()\n    {\n        return CoreBaseConfig.ParentExtensionCustomization.PARENT_EXTENSION_ENABLED;\n    }\n\n    private static void removeAbandonedExtensions()\n    {\n        Iterator<ExtensionStorageInfo> it = extensionStorage.iterator();\n        while (it.hasNext())\n        {\n            ExtensionStorageInfo info = it.next();\n            if (info.isAbandoned())\n            {\n                it.remove();\n            }\n        }\n    }\n\n    /**\n     * @return the Extension from the same type but registered in a hierarchic 'parent' BeanManager\n     */\n    public static synchronized <T extends Extension> T getParentExtension(Extension extension)\n    {\n        if (usingParentExtension())\n        {\n            ClassLoader parentClassLoader = ClassUtils.getClassLoader(null).getParent();\n\n            Iterator<ExtensionStorageInfo> extIt = extensionStorage.iterator();\n            while (extIt.hasNext())\n            {\n                ExtensionStorageInfo extensionInfo = extIt.next();\n                if (!extensionInfo.isAbandoned() && // weak reference case\n                    extension.getClass().equals(extensionInfo.getExtension().getClass()) &&\n                    extensionInfo.getClassLoader().equals(parentClassLoader))\n                {\n                    return (T) extensionInfo.getExtension();\n                }\n            }\n        }\n        return null;\n    }\n\n\n    /**\n     * Information about an Extension instance and in which classloader it got used\n     */\n    private static class ExtensionStorageInfo\n    {\n        // we use WeakReferences to allow perfect unloading of any webapp ClassLoader\n        private final WeakReference<ClassLoader> classLoader;\n        private final WeakReference<Extension> extension;\n\n        ExtensionStorageInfo(ClassLoader classLoader, Extension extension)\n        {\n            this.classLoader = new WeakReference<ClassLoader>(classLoader);\n            this.extension = new WeakReference<Extension>(extension);\n        }\n\n        boolean isAbandoned()\n        {\n            return classLoader.get() == null || extension.get() == null;\n        }\n\n        ClassLoader getClassLoader()\n        {\n            return classLoader.get();\n        }\n\n        Extension getExtension()\n        {\n            return extension.get();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/BaseImmutableBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.bean;\n\nimport org.apache.deltaspike.core.api.literal.DefaultLiteral;\nimport org.apache.deltaspike.core.util.ArraysUtils;\nimport org.apache.deltaspike.core.util.metadata.InjectionPointWrapper;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\n/**\n * <p>\n * A base class for implementing {@link Bean}. The attributes are immutable, and\n * collections are defensively copied on instantiation. It uses the defaults\n * from the specification for properties if not specified.\n * </p>\n * <p/>\n * <p>\n * This class does not provide any bean lifecycle operations\n * </p>\n *\n * @see ImmutableBeanWrapper\n */\npublic abstract class BaseImmutableBean<T> implements Bean<T>\n{\n    private static final Logger LOG = Logger.getLogger(BaseImmutableBean.class.getName());\n\n    private final Class<?> beanClass;\n    private final String name;\n    private final Set<Annotation> qualifiers;\n    private final Class<? extends Annotation> scope;\n    private final Set<Class<? extends Annotation>> stereotypes;\n    private final Set<Type> types;\n    private final boolean alternative;\n    private final boolean nullable;\n    private final Set<InjectionPoint> injectionPoints;\n    private final String toString;\n\n    /**\n     * Create a new, immutable bean. All arguments passed as collections are\n     * defensively copied.\n     *\n     * @param beanClass       The Bean class, may not be null\n     * @param name            The bean name\n     * @param qualifiers      The bean's qualifiers, if null, a singleton set of\n     *                        {@link jakarta.enterprise.inject.Default} is used\n     * @param scope           The bean's scope, if null, the default scope of\n     *                        {@link Dependent} is used\n     * @param stereotypes     The bean's stereotypes, if null, an empty set is used\n     * @param types           The bean's types, if null, the beanClass and {@link Object}\n     *                        will be used\n     * @param alternative     True if the bean is an alternative\n     * @param nullable        True if the bean is nullable\n     * @param injectionPoints the bean's injection points, if null an empty set is used\n     * @param toString        the string which should be returned by #{@link #toString()}\n     * @throws IllegalArgumentException if the beanClass is null\n     */\n    public BaseImmutableBean(Class<?> beanClass,\n                             String name,\n                             Set<Annotation> qualifiers,\n                             Class<? extends Annotation> scope,\n                             Set<Class<? extends Annotation>> stereotypes,\n                             Set<Type> types,\n                             boolean alternative,\n                             boolean nullable,\n                             Set<InjectionPoint> injectionPoints,\n                             String toString)\n    {\n        if (beanClass == null)\n        {\n            throw new IllegalArgumentException(\"beanClass cannot be null\");\n        }\n\n        this.beanClass = beanClass;\n        this.name = name;\n\n        if (qualifiers == null)\n        {\n            this.qualifiers = Collections.<Annotation>singleton(new DefaultLiteral());\n\n            LOG.finest(\"No qualifers provided for bean class \" + beanClass + \", using singleton set of @Default\");\n        }\n        else\n        {\n            this.qualifiers = new HashSet<Annotation>(qualifiers);\n        }\n\n        if (scope == null)\n        {\n            this.scope = Dependent.class;\n\n            LOG.finest(\"No scope provided for bean class \" + beanClass + \", using @Dependent\");\n        }\n        else\n        {\n            this.scope = scope;\n        }\n\n        if (stereotypes == null)\n        {\n            this.stereotypes = Collections.emptySet();\n        }\n        else\n        {\n            this.stereotypes = new HashSet<Class<? extends Annotation>>(stereotypes);\n        }\n\n        if (types == null)\n        {\n            //noinspection unchecked\n            this.types = ArraysUtils.<Type>asSet(Object.class, beanClass);\n\n            LOG.finest(\"No types provided for bean class \" + beanClass\n                    + \", using [java.lang.Object.class, \" + beanClass.getName()\n                    + \".class]\");\n        }\n        else\n        {\n            this.types = new HashSet<Type>(types);\n        }\n\n        if (injectionPoints == null)\n        {\n            this.injectionPoints = Collections.emptySet();\n        }\n        else\n        {\n            // Check for null Beans, wrap if there isn't one -- DELTASPIKE-400\n            final HashSet<InjectionPoint> ips = new HashSet<InjectionPoint>(injectionPoints.size());\n\n            for (InjectionPoint ip : injectionPoints)\n            {\n                if (ip.getBean() == null)\n                {\n                    ips.add(new InjectionPointWrapper(ip, this));\n                }\n                else\n                {\n                    ips.add(ip);\n                }\n            }\n\n            this.injectionPoints = ips;\n        }\n\n        this.alternative = alternative;\n        this.nullable = nullable;\n\n        if (toString != null)\n        {\n            this.toString = toString;\n        }\n        else\n        {\n            this.toString = \"Custom Bean with bean class \" + beanClass + \" and qualifiers \" + qualifiers;\n        }\n    }\n\n    @Override\n    public Class<?> getBeanClass()\n    {\n        return beanClass;\n    }\n\n    @Override\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return injectionPoints;\n    }\n\n    @Override\n    public String getName()\n    {\n        return name;\n    }\n\n    @Override\n    public Set<Annotation> getQualifiers()\n    {\n        return Collections.unmodifiableSet(qualifiers);\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope()\n    {\n        return scope;\n    }\n\n    @Override\n    public Set<Class<? extends Annotation>> getStereotypes()\n    {\n        return Collections.unmodifiableSet(stereotypes);\n    }\n\n    @Override\n    public Set<Type> getTypes()\n    {\n        return Collections.unmodifiableSet(types);\n    }\n\n    @Override\n    public boolean isAlternative()\n    {\n        return alternative;\n    }\n\n    @Override\n    public boolean isNullable()\n    {\n        return nullable;\n    }\n\n    @Override\n    public String toString()\n    {\n        return toString;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/BeanBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.bean;\n\nimport org.apache.deltaspike.core.api.literal.AnyLiteral;\nimport org.apache.deltaspike.core.api.literal.DefaultLiteral;\nimport org.apache.deltaspike.core.util.Annotateds;\nimport org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;\nimport org.apache.deltaspike.core.util.metadata.builder.DelegatingContextualLifecycle;\nimport org.apache.deltaspike.core.util.metadata.builder.DummyInjectionTarget;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.inject.Named;\n\nimport java.beans.Introspector;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * <p>\n * A builder class for creating immutable beans. The builder can create\n * {@link jakarta.enterprise.inject.spi.PassivationCapable} beans.\n * </p>\n * <p/>\n * <p>\n * The builder can read from an {@link AnnotatedType} and have any attribute\n * modified. This class is not thread-safe, but the bean created by calling\n * {@link #create()} is.\n * </p>\n * <p/>\n * <p>\n * It is advised that a new bean builder is instantiated for each bean created.\n * </p>\n */\npublic class BeanBuilder<T>\n{\n\n    protected final BeanManager beanManager;\n\n    protected Class<?> beanClass;\n    protected String name;\n    protected Set<Annotation> qualifiers;\n    protected Class<? extends Annotation> scope = Dependent.class;\n    protected Set<Class<? extends Annotation>> stereotypes;\n    protected Set<Type> types;\n    protected Set<InjectionPoint> injectionPoints;\n    protected boolean alternative;\n    protected boolean nullable;\n    protected ContextualLifecycle<T> beanLifecycle;\n    protected boolean passivationCapable;\n    protected String id;\n    protected String toString;\n\n    /**\n     * Instantiate a new bean builder.\n     *\n     * @param beanManager the bean manager to use for creating injection targets\n     *                    and determining if annotations are qualifiers, scopes or\n     *                    stereotypes.\n     */\n    public BeanBuilder(BeanManager beanManager)\n    {\n        this.beanManager = beanManager;\n    }\n\n    /**\n     * <p>\n     * Read the {@link AnnotatedType}, creating a bean from the class and it's\n     * annotations.\n     * </p>\n     * <p/>\n     * <p>\n     * By default the bean lifecycle will wrap the result of calling\n     * {@link BeanManager#createInjectionTarget(AnnotatedType)}.\n     * </p>\n     * <p/>\n     * <p>\n     * {@link BeanBuilder} does <em>not</em> support reading members of the class\n     * to create producers or observer methods.\n     * </p>\n     *\n     * @param type the type to read\n     */\n    public BeanBuilder<T> readFromType(AnnotatedType<T> type)\n    {\n        this.beanClass = type.getJavaClass();\n\n        if (beanLifecycle == null)\n        {\n            setDefaultBeanLifecycle(type);\n        }\n\n        this.qualifiers = new HashSet<Annotation>();\n        this.stereotypes = new HashSet<Class<? extends Annotation>>();\n        this.types = new HashSet<Type>();\n        for (Annotation annotation : type.getAnnotations())\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                this.qualifiers.add(annotation);\n            }\n            else if (beanManager.isScope(annotation.annotationType()))\n            {\n                this.scope = annotation.annotationType();\n            }\n            else if (beanManager.isStereotype(annotation.annotationType()))\n            {\n                this.stereotypes.add(annotation.annotationType());\n            }\n            if (annotation instanceof Named)\n            {\n                this.name = ((Named) annotation).value();\n                if (name == null || name.length() == 0)\n                {\n                    name = createDefaultBeanName(type);\n                }\n            }\n            if (annotation instanceof Alternative)\n            {\n                this.alternative = true;\n            }\n        }\n        if (type.isAnnotationPresent(Typed.class))\n        {\n            Typed typed = type.getAnnotation(Typed.class);\n            this.types.addAll(Arrays.asList(typed.value()));\n\n        }\n        else\n        {\n            for (Class<?> c = type.getJavaClass(); c != Object.class && c != null; c = c.getSuperclass())\n            {\n                this.types.add(c);\n            }\n            Collections.addAll(this.types, type.getJavaClass().getInterfaces());\n            this.types.add(Object.class);\n        }        \n\n        if (qualifiers.isEmpty())\n        {\n            qualifiers.add(new DefaultLiteral());\n        }\n        qualifiers.add(new AnyLiteral());\n\n        this.id = ImmutableBeanWrapper.class.getName() + \":\" + Annotateds.createTypeId(type);\n        return this;\n    }\n\n    private String createDefaultBeanName(AnnotatedType<T> type)\n    {\n        Class<T> javaClass = type.getJavaClass();\n        return Introspector.decapitalize(javaClass.getSimpleName());\n    }\n\n\n    /**\n     * Set the ContextualLifecycle and the InjectionPoints for the AnnotatedType\n     * @param type\n     */\n    protected void setDefaultBeanLifecycle(AnnotatedType<T> type)\n    {\n        InjectionTarget<T> injectionTarget;\n        if (!type.getJavaClass().isInterface())\n        {\n            injectionTarget = beanManager.createInjectionTarget(type);\n        }\n        else\n        {\n            injectionTarget = new DummyInjectionTarget<T>();\n        }\n        this.beanLifecycle = new DelegatingContextualLifecycle<T>(injectionTarget);\n        this.injectionPoints = injectionTarget.getInjectionPoints();\n    }\n\n    /**\n     * <p>\n     * Use the bean builder's current state to define the bean.\n     * </p>\n     *\n     * @return the bean\n     */\n    public Bean<T> create()\n    {\n        if (!passivationCapable)\n        {\n            return new ImmutableBean<T>(beanClass, name, qualifiers, scope, stereotypes, types, alternative, nullable,\n                    injectionPoints, toString, beanLifecycle);\n        }\n        else\n        {\n            return new ImmutablePassivationCapableBean<T>(beanClass, name, qualifiers, scope, stereotypes, types,\n                    alternative, nullable, injectionPoints, toString, beanLifecycle, id);\n        }\n    }\n\n    /**\n     * Qualifiers currently defined for bean creation.\n     *\n     * @return the qualifiers current defined\n     */\n    public Set<Annotation> getQualifiers()\n    {\n        return qualifiers;\n    }\n\n    /**\n     * Define the qualifiers used for bean creation.\n     *\n     * @param qualifiers the qualifiers to use\n     */\n    public BeanBuilder<T> qualifiers(Set<Annotation> qualifiers)\n    {\n        this.qualifiers = qualifiers;\n        return this;\n    }\n\n    /**\n     * Define the qualifiers used for bean creation.\n     *\n     * @param qualifiers the qualifiers to use\n     */\n    public BeanBuilder<T> qualifiers(Annotation... qualifiers)\n    {\n        this.qualifiers = new HashSet<Annotation>(Arrays.asList(qualifiers));\n        return this;\n    }\n\n    /**\n     * Add to the qualifiers used for bean creation.\n     *\n     * @param qualifier the additional qualifier to use\n     */\n    public BeanBuilder<T> addQualifier(Annotation qualifier)\n    {\n        this.qualifiers.add(qualifier);\n        return this;\n    }\n\n    /**\n     * Add to the qualifiers used for bean creation.\n     *\n     * @param qualifiers the additional qualifiers to use\n     */\n    public BeanBuilder<T> addQualifiers(Annotation... qualifiers)\n    {\n        this.qualifiers.addAll(new HashSet<Annotation>(Arrays.asList(qualifiers)));\n        return this;\n    }\n\n    /**\n     * Add to the qualifiers used for bean creation.\n     *\n     * @param qualifiers the additional qualifiers to use\n     */\n    public BeanBuilder<T> addQualifiers(Collection<Annotation> qualifiers)\n    {\n        this.qualifiers.addAll(qualifiers);\n        return this;\n    }\n\n    /**\n     * Scope currently defined for bean creation.\n     *\n     * @return the scope currently defined\n     */\n    public Class<? extends Annotation> getScope()\n    {\n        return scope;\n    }\n\n    /**\n     * Define the scope used for bean creation.\n     *\n     * @param scope the scope to use\n     */\n    public BeanBuilder<T> scope(Class<? extends Annotation> scope)\n    {\n        this.scope = scope;\n        return this;\n    }\n\n    /**\n     * Stereotypes currently defined for bean creation.\n     *\n     * @return the stereotypes currently defined\n     */\n    public Set<Class<? extends Annotation>> getStereotypes()\n    {\n        return stereotypes;\n    }\n\n    /**\n     * Define the stereotypes used for bean creation.\n     *\n     * @param stereotypes the stereotypes to use\n     */\n    public BeanBuilder<T> stereotypes(Set<Class<? extends Annotation>> stereotypes)\n    {\n        this.stereotypes = stereotypes;\n        return this;\n    }\n\n    /**\n     * Type closure currently defined for bean creation.\n     *\n     * @return the type closure currently defined\n     */\n    public Set<Type> getTypes()\n    {\n        return types;\n    }\n\n    /**\n     * Define the type closure used for bean creation.\n     *\n     * @param types the type closure to use\n     */\n    public BeanBuilder<T> types(Set<Type> types)\n    {\n        this.types = types;\n        return this;\n    }\n\n    /**\n     * Define the type closure used for bean creation.\n     *\n     * @param types the type closure to use\n     */\n    public BeanBuilder<T> types(Type... types)\n    {\n        this.types = new HashSet<Type>(Arrays.asList(types));\n        return this;\n    }\n\n    /**\n     * Add to the type closure used for bean creation.\n     *\n     * @param type additional type to use\n     */\n    public BeanBuilder<T> addType(Type type)\n    {\n        this.types.add(type);\n        return this;\n    }\n\n    /**\n     * Add to the type closure used for bean creation.\n     *\n     * @param types the additional types to use\n     */\n    public BeanBuilder<T> addTypes(Type... types)\n    {\n        this.types.addAll(new HashSet<Type>(Arrays.asList(types)));\n        return this;\n    }\n\n    /**\n     * Add to the type closure used for bean creation.\n     *\n     * @param types the additional types to use\n     */\n    public BeanBuilder<T> addTypes(Collection<Type> types)\n    {\n        this.types.addAll(types);\n        return this;\n    }\n\n    /**\n     * Whether the created bean will be an alternative.\n     *\n     * @return <code>true</code> if the created bean will be an alternative,\n     *         otherwise <code>false</code>\n     */\n    public boolean isAlternative()\n    {\n        return alternative;\n    }\n\n    /**\n     * Define that the created bean will (or will not) be an alternative.\n     *\n     * @param alternative <code>true</code> if the created bean should be an\n     *                    alternative, otherwise <code>false</code>\n     */\n    public BeanBuilder<T> alternative(boolean alternative)\n    {\n        this.alternative = alternative;\n        return this;\n    }\n\n    /**\n     * Whether the created bean will be nullable.\n     *\n     * @return <code>true</code> if the created bean will be nullable, otherwise\n     *         <code>false</code>\n     */\n    public boolean isNullable()\n    {\n        return nullable;\n    }\n\n    /**\n     * Define that the created bean will (or will not) be nullable.\n     *\n     * @param nullable <code>true</code> if the created bean should be nullable,\n     *                 otherwise <code>false</code>\n     */\n    public BeanBuilder<T> nullable(boolean nullable)\n    {\n        this.nullable = nullable;\n        return this;\n    }\n\n    /**\n     * The {@link ContextualLifecycle} currently defined for bean creation.\n     *\n     * @return the bean lifecycle currently defined\n     */\n    public ContextualLifecycle<T> getBeanLifecycle()\n    {\n        return beanLifecycle;\n    }\n\n    /**\n     * Define the {@link ContextualLifecycle} used for bean creation.\n     *\n     * @param beanLifecycle the {@link ContextualLifecycle} to use for bean\n     *                      creation.\n     */\n    public BeanBuilder<T> beanLifecycle(ContextualLifecycle<T> beanLifecycle)\n    {\n        this.beanLifecycle = beanLifecycle;\n        return this;\n    }\n\n    /**\n     * The bean class currently defined for bean creation.\n     *\n     * @return the bean class currently defined.\n     */\n    public Class<?> getBeanClass()\n    {\n        return beanClass;\n    }\n\n    /**\n     * Define the bean class used for bean creation.\n     *\n     * @param beanClass the bean class to use\n     */\n    public BeanBuilder<T> beanClass(Class<?> beanClass)\n    {\n        this.beanClass = beanClass;\n        return this;\n    }\n\n    /**\n     * The bean manager in use. This cannot be changed for this\n     * {@link BeanBuilder}.\n     *\n     * @return the bean manager in use\n     */\n    public BeanManager getBeanManager()\n    {\n        return beanManager;\n    }\n\n    /**\n     * The name of the bean currently defined for bean creation.\n     *\n     * @return the name of the bean or <code>null</code> if the bean has no name\n     */\n    public String getName()\n    {\n        return name;\n    }\n\n    /**\n     * Define the name of the bean used for bean creation.\n     *\n     * @param name the name of the bean to use or <code>null</code> if the bean\n     *             should have no name\n     */\n    public BeanBuilder<T> name(String name)\n    {\n        this.name = name;\n        return this;\n    }\n\n    /**\n     * Whether the created bean will be passivation capable.\n     *\n     * @return <code>true</code> if the created bean will be passivation capable,\n     *         otherwise <code>false</code>\n     */\n    public boolean isPassivationCapable()\n    {\n        return passivationCapable;\n    }\n\n    /**\n     * Define that the created bean will (or will not) be passivation capable.\n     *\n     * @param passivationCapable <code>true</code> if the created bean should be\n     *                           passivation capable, otherwise <code>false</code>\n     */\n    public BeanBuilder<T> passivationCapable(boolean passivationCapable)\n    {\n        this.passivationCapable = passivationCapable;\n        return this;\n    }\n\n    /**\n     * The id currently defined for bean creation.\n     *\n     * @return the id currently defined.\n     */\n    public String getId()\n    {\n        return id;\n    }\n\n    /**\n     * Define the id used for bean creation.\n     *\n     * @param id the id to use\n     */\n    public BeanBuilder<T> id(String id)\n    {\n        this.id = id;\n        return this;\n    }\n\n    /**\n     * The injection points currently defined for bean creation.\n     *\n     * @return the injection points currently defined.\n     */\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return injectionPoints;\n    }\n\n    /**\n     * Define the injection points used for bean creation.\n     *\n     * @param injectionPoints the injection points to use\n     */\n    public BeanBuilder<T> injectionPoints(Set<InjectionPoint> injectionPoints)\n    {\n        this.injectionPoints = injectionPoints;\n        return this;\n    }\n\n    /**\n     * Define the string used when {@link #toString()} is called on the bean.\n     *\n     * @param toString the string to use\n     */\n    public BeanBuilder<T> toString(String toString)\n    {\n        this.toString = toString;\n        return this;\n    }\n\n    /**\n     * The string used when {@link #toString()} is called on the bean.\n     *\n     * @return the string currently defined\n     */\n    public String getToString()\n    {\n        return toString;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/ImmutableBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.bean;\n\nimport org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Set;\n\n/**\n *\n */\npublic class ImmutableBean<T> extends BaseImmutableBean<T>\n{\n    private final ContextualLifecycle<T> lifecycle;\n\n    /**\n     * Create a new, immutable bean. All arguments passed as collections are\n     * defensively copied.\n     *\n     * @param beanClass           The Bean class, may not be null\n     * @param name                The bean name\n     * @param qualifiers          The bean's qualifiers, if null, a singleton set of\n     *                            {@link jakarta.enterprise.inject.Default} is used\n     * @param scope               The bean's scope, if null, the default scope of\n     *                            {@link jakarta.enterprise.context.Dependent} is used\n     * @param stereotypes         The bean's stereotypes, if null, an empty set is used\n     * @param types               The bean's types, if null, the beanClass and {@link Object}\n     *                            will be used\n     * @param alternative         True if the bean is an alternative\n     * @param nullable            True if the bean is nullable\n     * @param injectionPoints     the bean's injection points, if null an empty set is used\n     * @param toString            the string which should be returned by #{@link #toString()}\n     * @param contextualLifecycle Handler for {@link #create(jakarta.enterprise.context.spi.CreationalContext)} and\n     *                            {@link #destroy(Object, jakarta.enterprise.context.spi.CreationalContext)}\n     * @throws IllegalArgumentException if the beanClass is null\n     */\n    // CHECKSTYLE:OFF\n    public ImmutableBean(Class<?> beanClass, String name, Set<Annotation> qualifiers, Class<? extends Annotation> scope,\n                         Set<Class<? extends Annotation>> stereotypes, Set<Type> types, boolean alternative,\n                         boolean nullable, Set<InjectionPoint> injectionPoints, String toString,\n                         ContextualLifecycle<T> contextualLifecycle)\n    {\n        // CHECKSTYLE:ON\n        super(beanClass, name, qualifiers, scope, stereotypes, types, alternative, nullable, injectionPoints, toString);\n        this.lifecycle = contextualLifecycle;\n    }\n\n    @Override\n    public T create(CreationalContext<T> creationalContext)\n    {\n        return lifecycle.create(this, creationalContext);\n    }\n\n    @Override\n    public void destroy(T instance, CreationalContext<T> creationalContext)\n    {\n        this.lifecycle.destroy(this, instance, creationalContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/ImmutableBeanWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.bean;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Set;\n\n/**\n * <p>\n * This bean-wrapper allows you to build a general purpose bean (likely a\n * producer method), and register it for a narrowed type (or qualifiers).\n * You can easily create instances of this class with the\n * {@link WrappingBeanBuilder}.\n * </p>\n * <p/>\n * <p>For example, you could create a producer method which uses an a\n * String ID tolocated an object (the object can have any class):</p>\n * <pre>\n * &#064;Produces\n * // Use some synthetic scope to prevent this from interfering with other\n * // resolutions\n * &#064;MyProducer\n * Object produce(InjectionPoint ip)\n * {\n *     String id = ip.getAnnotated().getAnnotation(Id.class).value();\n *     // Lookup and return the object for the id\n * }\n * </pre>\n * <p>The wrapped bean <em>must</em> return an object which can be cast to the\n * type <code>T</code>, otherwise a {@link ClassCastException} will be thrown at\n * runtime when the bean is created.\n * </p>\n * <p>You can then register a narrowing bean for each type you need:\n * </p>\n * <pre>\n * event.addBean(new NarrowingBeanBuilder&lt;T&gt;(delegateBean).readFromType(type)\n *         .create());\n * </pre>\n * <p>{@link ImmutableBeanWrapper} will use the annotations on\n * <code>definingType</code> to discover the qualifiers, types, scope,\n * stereotypes of the bean, as well as determine it's name (if any) and whether\n * it is an alternative.\n * </p>\n * <p>The attributes are immutable, and collections are defensively copied on\n * instantiation. It uses the defaults from the specification for properties if\n * not specified.\n * </p>\n *\n * @see org.apache.deltaspike.core.util.bean.WrappingBeanBuilder\n */\npublic class ImmutableBeanWrapper<T> extends BaseImmutableBean<T>\n{\n    private final Bean<T> wrapped;\n\n    /**\n     * Instantiate a new {@link ImmutableBeanWrapper}.\n     *\n     * @param bean        the bean to wrapped the lifecycle to\n     * @param name        the name of the bean\n     * @param qualifiers  the qualifiers of the bean\n     * @param scope       the scope of the bean\n     * @param stereotypes the bean's stereotypes\n     * @param types       the types of the bean\n     * @param alternative whether the bean is an alternative\n     * @param nullable    true if the bean is nullable\n     * @param toString    the string which should be returned by #{@link #toString()}\n     */\n    public ImmutableBeanWrapper(Bean<T> bean,\n                                String name,\n                                Set<Annotation> qualifiers,\n                                Class<? extends Annotation> scope,\n                                Set<Class<? extends Annotation>> stereotypes,\n                                Set<Type> types,\n                                boolean alternative,\n                                boolean nullable,\n                                String toString)\n    {\n        super(bean.getBeanClass(), name, qualifiers, scope, stereotypes,\n                types, alternative, nullable, bean.getInjectionPoints(), toString);\n\n        wrapped = bean;\n    }\n\n    @Override\n    public T create(CreationalContext<T> creationalContext)\n    {\n        return wrapped.create(creationalContext);\n    }\n\n    @Override\n    public void destroy(T instance, CreationalContext<T> creationalContext)\n    {\n        wrapped.destroy(instance, creationalContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/ImmutablePassivationCapableBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.bean;\n\nimport org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;\n\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Set;\n\n/**\n *\n */\npublic class ImmutablePassivationCapableBean<T> extends ImmutableBean<T> implements PassivationCapable\n{\n    private final String id;\n\n    /**\n     * Create a new, immutable bean. All arguments passed as collections are\n     * defensively copied.\n     *\n     * @param beanClass       The Bean class, may not be null\n     * @param name            The bean name\n     * @param qualifiers      The bean's qualifiers, if null, a singleton set of\n     *                        {@link jakarta.enterprise.inject.Default} is used\n     * @param scope           The bean's scope, if null, the default scope of\n     *                        {@link jakarta.enterprise.context.Dependent} is used\n     * @param stereotypes     The bean's stereotypes, if null, an empty set is used\n     * @param types           The bean's types, if null, the beanClass and {@link Object}\n     *                        will be used\n     * @param alternative     True if the bean is an alternative\n     * @param nullable        True if the bean is nullable\n     * @param injectionPoints the bean's injection points, if null an empty set is used\n     * @param toString        the string which should be returned by #{@link #toString()}\n     * @param lifecycle       Handler for {@link #create(jakarta.enterprise.context.spi.CreationalContext)} and\n     *                        {@link #destroy(Object, jakarta.enterprise.context.spi.CreationalContext)}\n     * @param passivationId   Passivation bean Id.\n     * @throws IllegalArgumentException if the beanClass is null\n     */\n    // CHECKSTYLE:OFF\n    public ImmutablePassivationCapableBean(Class<?> beanClass, String name, Set<Annotation> qualifiers,\n                                           Class<? extends Annotation> scope,\n                                           Set<Class<? extends Annotation>> stereotypes, Set<Type> types,\n                                           boolean alternative, boolean nullable,\n                                           Set<InjectionPoint> injectionPoints, String toString,\n                                           ContextualLifecycle<T> lifecycle, String passivationId)\n    {\n        // CHECKSTYLE:ON\n        super(beanClass, name, qualifiers, scope, stereotypes, types, alternative, nullable, injectionPoints, toString,\n                lifecycle);\n        this.id = passivationId;\n    }\n\n    @Override\n    public String getId()\n    {\n        return this.id;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/ImmutablePassivationCapableBeanWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.bean;\n\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Set;\n\n/**\n * <p>PassivationCapable version of an ImmutableBeanWrapper.\n * You can easily create instances of this class with the\n * {@link WrappingBeanBuilder}.</p>\n *\n * @see ImmutableBeanWrapper\n * @see WrappingBeanBuilder\n */\npublic class ImmutablePassivationCapableBeanWrapper<T> extends ImmutableBeanWrapper<T>\n        implements PassivationCapable\n{\n    private final String id;\n\n    /**\n     * Instantiate a new {@link ImmutableBeanWrapper} for a  {@link PassivationCapable} Bean.\n     *\n     * @param bean        the bean to wrapped the lifecycle to\n     * @param name        the name of the bean\n     * @param qualifiers  the qualifiers of the bean\n     * @param scope       the scope of the bean\n     * @param stereotypes the bean's stereotypes\n     * @param types       the types of the bean\n     * @param alternative whether the bean is an alternative\n     * @param nullable    true if the bean is nullable\n     * @param toString    the string which should be returned by #{@link #toString()}\n     * @param id          the passivationId which gets returned by {@link #getId()}\n     */\n    public ImmutablePassivationCapableBeanWrapper(Bean<T> bean,\n                                                  String name,\n                                                  Set<Annotation> qualifiers,\n                                                  Class<? extends Annotation> scope,\n                                                  Set<Class<? extends Annotation>> stereotypes,\n                                                  Set<Type> types,\n                                                  boolean alternative,\n                                                  boolean nullable,\n                                                  String toString,\n                                                  String id)\n    {\n        super(bean, name, qualifiers, scope, stereotypes, types, alternative, nullable, toString);\n        this.id = id;\n    }\n\n    @Override\n    public String getId()\n    {\n        return id;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/WrappingBeanBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.bean;\n\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\n/**\n * <p>A WrappingBeanBuilder helps creating Beans which internally\n * just wrap another existing Bean. The Types, Qualifiers\n * and other attributes of the resulting Bean can be modified.</p>\n * <p/>\n * <p>The {@link Bean#create(jakarta.enterprise.context.spi.CreationalContext)}\n * and {@link Bean#destroy(Object, jakarta.enterprise.context.spi.CreationalContext)}\n * methods will get delegated to the underlying wrapped Bean.</p>\n *\n * @param <T> the type of the Bean\n */\npublic class WrappingBeanBuilder<T> extends BeanBuilder<T>\n{\n    private final Bean<T> delegate;\n\n\n    /**\n     * Instantiate a new {@link WrappingBeanBuilder}.\n     *\n     * @param delegate    the delegate bean\n     * @param beanManager current bean-manager\n     */\n    public WrappingBeanBuilder(Bean<Object> delegate, BeanManager beanManager)\n    {\n        super(beanManager);\n        this.delegate = (Bean<T>) delegate;\n    }\n\n    protected void setDefaultBeanLifecycle(AnnotatedType<T> type)\n    {\n        // do nothing. We don't need that as we delegate this information\n    }\n\n    /**\n     * <p>\n     * Use the bean builder's current state to define the bean.\n     * </p>\n     *\n     * @return the bean\n     */\n    public Bean<T> create()\n    {\n        if (isPassivationCapable())\n        {\n            return new ImmutablePassivationCapableBeanWrapper<T>(delegate,\n                    name, qualifiers, scope, stereotypes, types, alternative,\n                    nullable, toString, id);\n        }\n        else\n        {\n            return new ImmutableBeanWrapper<T>(delegate, name, qualifiers, scope,\n                    stereotypes, types, alternative, nullable, toString);\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/InjectionPointWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata;\n\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Type;\nimport java.util.Set;\n\n/**\n * Simple wrapper for injection points. Some metadata (as of 2014-12-15 just Bean) can be overridden, all else\n * delegates to the wrapped InjectionPoint.\n */\npublic class InjectionPointWrapper implements InjectionPoint\n{\n    private final InjectionPoint wrapped;\n    private final Bean<?> newBean;\n\n    public InjectionPointWrapper(InjectionPoint wrapped, Bean<?> newBean)\n    {\n        this.wrapped = wrapped;\n        this.newBean = newBean;\n    }\n\n    @Override\n    public Type getType()\n    {\n        return wrapped.getType();\n    }\n\n    @Override\n    public Set<Annotation> getQualifiers()\n    {\n        return wrapped.getQualifiers();\n    }\n\n    @Override\n    public Bean<?> getBean()\n    {\n        return newBean;\n    }\n\n    @Override\n    public Member getMember()\n    {\n        return wrapped.getMember();\n    }\n\n    @Override\n    public Annotated getAnnotated()\n    {\n        return wrapped.getAnnotated();\n    }\n\n    @Override\n    public boolean isDelegate()\n    {\n        return wrapped.isDelegate();\n    }\n\n    @Override\n    public boolean isTransient()\n    {\n        return wrapped.isTransient();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedCallableImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedCallable;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * Implementation of {@link AnnotatedCallable}\n */\nabstract class AnnotatedCallableImpl<X, Y extends Member> extends AnnotatedMemberImpl<X, Y>\n        implements AnnotatedCallable<X>\n{\n\n    private final List<AnnotatedParameter<X>> parameters;\n\n    protected AnnotatedCallableImpl(AnnotatedType<X> declaringType, Y member, Class<?> memberType,\n                                    Class<?>[] parameterTypes, Type[] genericTypes, AnnotationStore annotations,\n                                    Map<Integer, AnnotationStore> parameterAnnotations, Type genericType,\n                                    Map<Integer, Type> parameterTypeOverrides)\n    {\n        super(declaringType, member, memberType, annotations, genericType, null);\n        parameters = getAnnotatedParameters(this, parameterTypes, genericTypes, parameterAnnotations,\n                parameterTypeOverrides);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public List<AnnotatedParameter<X>> getParameters()\n    {\n        return Collections.unmodifiableList(parameters);\n    }\n\n    public AnnotatedParameter<X> getParameter(int index)\n    {\n        return parameters.get(index);\n\n    }\n\n    private static <X, Y extends Member> List<AnnotatedParameter<X>> getAnnotatedParameters(\n            AnnotatedCallableImpl<X, Y> callable, Class<?>[] parameterTypes, Type[] genericTypes,\n            Map<Integer, AnnotationStore> parameterAnnotations,\n            Map<Integer, Type> parameterTypeOverrides)\n    {\n        List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>();\n        int len = parameterTypes.length;\n\n        for (int i = 0; i < len; ++i)\n        {\n            AnnotationBuilder builder = new AnnotationBuilder();\n            if (parameterAnnotations != null && parameterAnnotations.containsKey(i))\n            {\n                builder.addAll(parameterAnnotations.get(i));\n            }\n            Type over = null;\n            if (parameterTypeOverrides != null)\n            {\n                over = parameterTypeOverrides.get(i);\n            }\n            AnnotatedParameterImpl<X> p = new AnnotatedParameterImpl<X>(\n                    callable, parameterTypes[i], i, builder.create(), genericTypes[i], over);\n\n            parameters.add(p);\n        }\n        return parameters;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedConstructorImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedConstructor;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Type;\nimport java.util.Map;\n\n/**\n * Implementation of {@link AnnotatedConstructor} to be used in\n * {@link org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder}\n * and other CDI life cycle events.\n */\nclass AnnotatedConstructorImpl<X> extends AnnotatedCallableImpl<X, Constructor<X>> implements AnnotatedConstructor<X>\n{\n\n    /**\n     * Constructor\n     */\n    AnnotatedConstructorImpl(AnnotatedTypeImpl<X> type, Constructor<?> constructor, AnnotationStore annotations,\n                                    Map<Integer, AnnotationStore> parameterAnnotations,\n                                    Map<Integer, Type> typeOverrides)\n    {\n\n        super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(), constructor.getParameterTypes(),\n                getGenericArray(constructor), annotations, parameterAnnotations, null, typeOverrides);\n    }\n\n    private static Type[] getGenericArray(Constructor<?> constructor)\n    {\n        Type[] genericTypes = constructor.getGenericParameterTypes();\n        // for inner classes genericTypes and parameterTypes can be different\n        // length, this is a hack to fix this.\n        // TODO: investigate this behavior further, on different JVM's and\n        // compilers\n        if (genericTypes.length < constructor.getParameterTypes().length)\n        {\n            genericTypes = new Type[constructor.getParameterTypes().length];\n            genericTypes[0] = constructor.getParameterTypes()[0];\n            for (int i = 0; i < constructor.getGenericParameterTypes().length; ++i)\n            {\n                genericTypes[i + 1] = constructor.getGenericParameterTypes()[i];\n            }\n        }\n        return genericTypes;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedFieldImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Type;\n\n/**\n * Implementation of {@link AnnotatedField} to be used in CDI life cycle events and\n * {@link org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder}.\n */\nclass AnnotatedFieldImpl<X> extends AnnotatedMemberImpl<X, Field> implements AnnotatedField<X>\n{\n\n    /**\n     * Constructor.\n     */\n    AnnotatedFieldImpl(AnnotatedType<X> declaringType, Field field, AnnotationStore annotations,\n                              Type overriddenType)\n    {\n        super(declaringType, field, field.getType(), annotations, field.getGenericType(), overriddenType);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport org.apache.deltaspike.core.util.HierarchyDiscovery;\n\nimport jakarta.enterprise.inject.spi.Annotated;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * The base class for all New Annotated types.\n */\nabstract class AnnotatedImpl implements Annotated\n{\n\n    private final Type type;\n    private final Set<Type> typeClosure;\n    private final AnnotationStore annotations;\n\n    protected AnnotatedImpl(Class<?> type, AnnotationStore annotations, Type genericType, Type overriddenType)\n    {\n        if (overriddenType == null)\n        {\n            if (genericType != null)\n            {\n                typeClosure = new HierarchyDiscovery(genericType).getTypeClosure();\n                this.type = genericType;\n            }\n            else\n            {\n                typeClosure = new HierarchyDiscovery(type).getTypeClosure();\n                this.type = type;\n            }\n        }\n        else\n        {\n            this.type = overriddenType;\n            typeClosure = Collections.singleton(overriddenType);\n        }\n\n\n        if (annotations == null)\n        {\n            this.annotations = new AnnotationStore();\n        }\n        else\n        {\n            this.annotations = annotations;\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public <T extends Annotation> T getAnnotation(Class<T> annotationType)\n    {\n        return annotations.getAnnotation(annotationType);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Set<Annotation> getAnnotations()\n    {\n        return annotations.getAnnotations();\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)\n    {\n        return annotations.isAnnotationPresent(annotationType);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Set<Type> getTypeClosure()\n    {\n        return new HashSet<Type>(typeClosure);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Type getBaseType()\n    {\n        return type;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedMemberImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedMember;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.Type;\n\n/**\n * An implementation of {@link AnnotatedMember} to be used in CDI life cycle events and\n * {@link org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder}.\n */\nabstract class AnnotatedMemberImpl<X, M extends Member> extends AnnotatedImpl implements AnnotatedMember<X>\n{\n    private final AnnotatedType<X> declaringType;\n    private final M javaMember;\n\n    protected AnnotatedMemberImpl(AnnotatedType<X> declaringType, M member, Class<?> memberType,\n                                  AnnotationStore annotations, Type genericType, Type overriddenType)\n    {\n        super(memberType, annotations, genericType, overriddenType);\n        this.declaringType = declaringType;\n        javaMember = member;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public AnnotatedType<X> getDeclaringType()\n    {\n        return declaringType;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public M getJavaMember()\n    {\n        return javaMember;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public boolean isStatic()\n    {\n        return Modifier.isStatic(javaMember.getModifiers());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedMethodImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.Map;\n\n/**\n * Implementation of {@link AnnotatedMethod} to be used in CDI life cycle events and\n * {@link org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder}.\n */\nclass AnnotatedMethodImpl<X> extends AnnotatedCallableImpl<X, Method> implements AnnotatedMethod<X>\n{\n    /**\n     * Constructor.\n     */\n    AnnotatedMethodImpl(AnnotatedType<X> type,\n                               Method method,\n                               AnnotationStore annotations,\n                               Map<Integer, AnnotationStore> parameterAnnotations,\n                               Map<Integer, Type> parameterTypeOverrides)\n    {\n        super(type, method, method.getReturnType(), method.getParameterTypes(), method.getGenericParameterTypes(),\n                annotations, parameterAnnotations, method.getGenericReturnType(), parameterTypeOverrides);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedParameterImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedCallable;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport java.lang.reflect.Type;\n\n/**\n * Implementation of {@link AnnotatedParameter}.\n */\nclass AnnotatedParameterImpl<X> extends AnnotatedImpl implements AnnotatedParameter<X>\n{\n\n    private final int position;\n    private final AnnotatedCallable<X> declaringCallable;\n\n    /**\n     * Constructor\n     */\n    AnnotatedParameterImpl(AnnotatedCallable<X> declaringCallable, Class<?> type, int position,\n                                  AnnotationStore annotations, Type genericType, Type typeOverride)\n    {\n        super(type, annotations, genericType, typeOverride);\n        this.declaringCallable = declaringCallable;\n        this.position = position;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public AnnotatedCallable<X> getDeclaringCallable()\n    {\n        return declaringCallable;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public int getPosition()\n    {\n        return position;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedTypeBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport org.apache.deltaspike.core.util.ReflectionUtils;\n\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.AnnotatedConstructor;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.security.AccessController;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Builder to aid in creation of a new {@link AnnotatedType} for use in CDI life cycle events.\n * Using the builder is typically done by reading the annotations from a {@link Class} or an\n * {@link AnnotatedType}. Once the starting class or type has been added all of annotations\n * can be modified: constructor, parameter, class, method and fields.\n * <p/>\n * The AnnotatedTypeBuilder is not thread safe and shall not be used concurrently!\n */\npublic class AnnotatedTypeBuilder<X>\n{\n    private Class<X> javaClass;\n    private final AnnotationBuilder typeAnnotations;\n\n    private final Map<Constructor<?>, AnnotationBuilder> constructors;\n    private final Map<Constructor<?>, Map<Integer, AnnotationBuilder>> constructorParameters;\n    private final Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes;\n\n    private final Map<Field, AnnotationBuilder> fields;\n    private final Map<Field, Type> fieldTypes;\n\n    private final Map<Method, AnnotationBuilder> methods;\n    private final Map<Method, Map<Integer, AnnotationBuilder>> methodParameters;\n    private final Map<Method, Map<Integer, Type>> methodParameterTypes;\n\n    /**\n     * Create a new builder. A new builder has no annotations and no members.\n     *\n     * @see #readFromType(AnnotatedType)\n     * @see #readFromType(Class)\n     * @see #readFromType(AnnotatedType, boolean)\n     * @see #readFromType(Class, boolean)\n     */\n    public AnnotatedTypeBuilder()\n    {\n        typeAnnotations = new AnnotationBuilder();\n        constructors = new HashMap<Constructor<?>, AnnotationBuilder>();\n        constructorParameters = new HashMap<Constructor<?>, Map<Integer, AnnotationBuilder>>();\n        constructorParameterTypes = new HashMap<Constructor<?>, Map<Integer, Type>>();\n        fields = new HashMap<Field, AnnotationBuilder>();\n        fieldTypes = new HashMap<Field, Type>();\n        methods = new HashMap<Method, AnnotationBuilder>();\n        methodParameters = new HashMap<Method, Map<Integer, AnnotationBuilder>>();\n        methodParameterTypes = new HashMap<Method, Map<Integer, Type>>();\n    }\n\n    /**\n     * Add an annotation to the type declaration.\n     *\n     * @param annotation the annotation instance to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToClass(Annotation annotation)\n    {\n        typeAnnotations.add(annotation);\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the type\n     *\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType\n     */\n    public AnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotationType)\n    {\n        typeAnnotations.remove(annotationType);\n        return this;\n    }\n\n    /**\n     * Add an annotation to the specified field. If the field is not already\n     * present, it will be added.\n     *\n     * @param field      the field to add the annotation to\n     * @param annotation the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToField(Field field, Annotation annotation)\n    {\n        if (fields.get(field) == null)\n        {\n            fields.put(field, new AnnotationBuilder());\n        }\n        fields.get(field).add(annotation);\n        return this;\n    }\n\n    /**\n     * Add an annotation to the specified field. If the field is not already\n     * present, it will be added.\n     *\n     * @param field      the field to add the annotation to\n     * @param annotation the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToField(AnnotatedField<? super X> field, Annotation annotation)\n    {\n        return addToField(field.getJavaMember(), annotation);\n    }\n\n    /**\n     * Remove an annotation from the specified field.\n     *\n     * @param field          the field to remove the annotation from\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null or if the\n     *                                  field is not currently declared on the type\n     */\n    public AnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> annotationType)\n    {\n        if (fields.get(field) == null)\n        {\n            throw new IllegalArgumentException(\"field \" + field + \" not present on class \" + getJavaClass());\n        }\n        else\n        {\n            fields.get(field).remove(annotationType);\n        }\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the specified field.\n     *\n     * @param field          the field to remove the annotation from\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null or if the\n     *                                  field is not currently declared on the type\n     */\n    public AnnotatedTypeBuilder<X> removeFromField(AnnotatedField<? super X> field,\n                                                   Class<? extends Annotation> annotationType)\n    {\n        return removeFromField(field.getJavaMember(), annotationType);\n    }\n\n    /**\n     * Add an annotation to the specified method. If the method is not already\n     * present, it will be added.\n     *\n     * @param method     the method to add the annotation to\n     * @param annotation the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToMethod(Method method, Annotation annotation)\n    {\n        if (methods.get(method) == null)\n        {\n            methods.put(method, new AnnotationBuilder());\n        }\n        methods.get(method).add(annotation);\n        return this;\n    }\n\n    /**\n     * Add an annotation to the specified method. If the method is not already\n     * present, it will be added.\n     *\n     * @param method     the method to add the annotation to\n     * @param annotation the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToMethod(AnnotatedMethod<? super X> method, Annotation annotation)\n    {\n        return addToMethod(method.getJavaMember(), annotation);\n    }\n\n    /**\n     * Remove an annotation from the specified method.\n     *\n     * @param method         the method to remove the annotation from\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null or if the\n     *                                  method is not currently declared on the type\n     */\n    public AnnotatedTypeBuilder<X> removeFromMethod(Method method, Class<? extends Annotation> annotationType)\n    {\n        if (methods.get(method) == null)\n        {\n            throw new IllegalArgumentException(\"Method \" + method + \" not present on class\" + getJavaClass());\n        }\n        else\n        {\n            methods.get(method).remove(annotationType);\n        }\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the specified method.\n     *\n     * @param method         the method to remove the annotation from\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null or if the\n     *                                  method is not currently declared on the type\n     */\n    public AnnotatedTypeBuilder<X> removeFromMethod(AnnotatedMethod<? super X> method,\n                                                    Class<? extends Annotation> annotationType)\n    {\n        return removeFromMethod(method.getJavaMember(), annotationType);\n    }\n\n    /**\n     * Add an annotation to the specified method parameter. If the method is not\n     * already present, it will be added. If the method parameter is not already\n     * present, it will be added.\n     *\n     * @param method     the method to add the annotation to\n     * @param position   the position of the parameter to add\n     * @param annotation the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation)\n    {\n        if (!methods.containsKey(method))\n        {\n            methods.put(method, new AnnotationBuilder());\n        }\n        if (methodParameters.get(method) == null)\n        {\n            methodParameters.put(method, new HashMap<Integer, AnnotationBuilder>());\n        }\n        if (methodParameters.get(method).get(position) == null)\n        {\n            methodParameters.get(method).put(position, new AnnotationBuilder());\n        }\n        methodParameters.get(method).get(position).add(annotation);\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the specified method parameter.\n     *\n     * @param method         the method to remove the annotation from\n     * @param position       the position of the parameter to remove\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null, if the\n     *                                  method is not currently declared on the type or if the\n     *                                  parameter is not declared on the method\n     */\n    public AnnotatedTypeBuilder<X> removeFromMethodParameter(Method method,\n                                                             int position, Class<? extends Annotation> annotationType)\n    {\n        if (methods.get(method) == null)\n        {\n            throw new IllegalArgumentException(\"Method \" + method + \" not present on class \" + getJavaClass());\n        }\n        else\n        {\n            if (methodParameters.get(method).get(position) == null)\n            {\n                throw new IllegalArgumentException(\n                        String.format(\"parameter %s not present on method %s declared on class %s\",\n                                method, position, getJavaClass()));\n            }\n            else\n            {\n                methodParameters.get(method).get(position).remove(annotationType);\n            }\n        }\n        return this;\n    }\n\n    /**\n     * Add an annotation to the specified constructor. If the constructor is not\n     * already present, it will be added.\n     *\n     * @param constructor the constructor to add the annotation to\n     * @param annotation  the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToConstructor(Constructor<X> constructor, Annotation annotation)\n    {\n        if (constructors.get(constructor) == null)\n        {\n            constructors.put(constructor, new AnnotationBuilder());\n        }\n        constructors.get(constructor).add(annotation);\n        return this;\n    }\n\n    /**\n     * Add an annotation to the specified constructor. If the constructor is not\n     * already present, it will be added.\n     *\n     * @param constructor the constructor to add the annotation to\n     * @param annotation  the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToConstructor(AnnotatedConstructor<X> constructor, Annotation annotation)\n    {\n        return addToConstructor(constructor.getJavaMember(), annotation);\n    }\n\n    /**\n     * Remove an annotation from the specified constructor.\n     *\n     * @param constructor    the constructor to add the annotation to\n     * @param annotationType the annotation to add\n     * @throws IllegalArgumentException if the annotationType is null or if the\n     *                                  constructor is not currently declared on the type\n     */\n    public AnnotatedTypeBuilder<X> removeFromConstructor(Constructor<X> constructor,\n                                                         Class<? extends Annotation> annotationType)\n    {\n        if (constructors.get(constructor) != null)\n        {\n            constructors.get(constructor).remove(annotationType);\n        }\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the specified constructor.\n     *\n     * @param constructor    the constructor to add the annotation to\n     * @param annotationType the annotation to add\n     * @throws IllegalArgumentException if the annotationType is null, if the\n     *                                  annotation does not exist on the type or if the constructor is\n     *                                  not currently declared on the type\n     */\n    public AnnotatedTypeBuilder<X> removeFromConstructor(AnnotatedConstructor<X> constructor,\n                                                         Class<? extends Annotation> annotationType)\n    {\n        return removeFromConstructor(constructor.getJavaMember(), annotationType);\n    }\n\n    /**\n     * Add an annotation to the specified constructor parameter. If the\n     * constructor is not already present, it will be added. If the constructor\n     * parameter is not already present, it will be added.\n     *\n     * @param constructor the constructor to add the annotation to\n     * @param position    the position of the parameter to add\n     * @param annotation  the annotation to add\n     * @throws IllegalArgumentException if the annotation is null\n     */\n    public AnnotatedTypeBuilder<X> addToConstructorParameter(Constructor<X> constructor,\n                                                             int position,\n                                                             Annotation annotation)\n    {\n        if (!constructors.containsKey(constructor))\n        {\n            constructors.put(constructor, new AnnotationBuilder());\n        }\n        if (constructorParameters.get(constructor) == null)\n        {\n            constructorParameters.put(constructor, new HashMap<Integer, AnnotationBuilder>());\n        }\n        if (constructorParameters.get(constructor).get(position) == null)\n        {\n            constructorParameters.get(constructor).put(position, new AnnotationBuilder());\n        }\n        constructorParameters.get(constructor).get(position).add(annotation);\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the specified constructor parameter.\n     *\n     * @param constructor    the constructor to remove the annotation from\n     * @param position       the position of the parameter to remove\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null, if the\n     *                                  constructor is not currently declared on the type or if the\n     *                                  parameter is not declared on the constructor\n     */\n    public AnnotatedTypeBuilder<X> removeFromConstructorParameter(Constructor<X> constructor,\n                                                                  int position,\n                                                                  Class<? extends Annotation> annotationType)\n    {\n        if (constructorParameters.get(constructor) != null &&\n                constructorParameters.get(constructor).get(position) != null)\n        {\n            constructorParameters.get(constructor).get(position).remove(annotationType);\n        }\n        return this;\n    }\n\n    /**\n     * Remove an annotation from the specified parameter.\n     *\n     * @param parameter      the parameter to remove the annotation from\n     * @param annotationType the annotation type to remove\n     * @throws IllegalArgumentException if the annotationType is null, if the\n     *                                  callable which declares the parameter is not currently declared\n     *                                  on the type or if the parameter is not declared on either a\n     *                                  constructor or a method\n     */\n    public AnnotatedTypeBuilder<X> removeFromParameter(AnnotatedParameter<? super X> parameter,\n                                                       Class<? extends Annotation> annotationType)\n    {\n        if (parameter.getDeclaringCallable().getJavaMember() instanceof Method)\n        {\n            Method method = (Method) parameter.getDeclaringCallable().getJavaMember();\n            return removeFromMethodParameter(method, parameter.getPosition(), annotationType);\n        }\n        if (parameter.getDeclaringCallable().getJavaMember() instanceof Constructor<?>)\n        {\n            @SuppressWarnings(\"unchecked\")\n            Constructor<X> constructor = (Constructor<X>) parameter.getDeclaringCallable().getJavaMember();\n            return removeFromConstructorParameter(constructor, parameter.getPosition(), annotationType);\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Cannot remove from parameter \" + parameter +\n                    \" - cannot operate on member \" + parameter.getDeclaringCallable().getJavaMember());\n        }\n    }\n\n    /**\n     * Add an annotation to the specified parameter. If the callable which\n     * declares the parameter is not already present, it will be added. If the\n     * parameter is not already present on the callable, it will be added.\n     *\n     * @param parameter  the parameter to add the annotation to\n     * @param annotation the annotation to add\n     * @throws IllegalArgumentException if the annotation is null or if the\n     *                                  parameter is not declared on either a constructor or a method\n     */\n    public AnnotatedTypeBuilder<X> addToParameter(AnnotatedParameter<? super X> parameter, Annotation annotation)\n    {\n        if (parameter.getDeclaringCallable().getJavaMember() instanceof Method)\n        {\n            Method method = (Method) parameter.getDeclaringCallable().getJavaMember();\n            return addToMethodParameter(method, parameter.getPosition(), annotation);\n        }\n        if (parameter.getDeclaringCallable().getJavaMember() instanceof Constructor<?>)\n        {\n            @SuppressWarnings(\"unchecked\")\n            Constructor<X> constructor = (Constructor<X>) parameter.getDeclaringCallable().getJavaMember();\n            return addToConstructorParameter(constructor, parameter.getPosition(), annotation);\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Cannot remove from parameter \" + parameter +\n                    \" - cannot operate on member \" + parameter.getDeclaringCallable().getJavaMember());\n        }\n    }\n\n    /**\n     * Remove annotations from the type, and all of it's members. If an\n     * annotation of the specified type appears on the type declaration, or any\n     * of it's members it will be removed.\n     *\n     * @param annotationType the type of annotation to remove\n     * @throws IllegalArgumentException if the annotationType is null\n     */\n    public AnnotatedTypeBuilder<X> removeFromAll(Class<? extends Annotation> annotationType)\n    {\n        if (annotationType == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"annotationType\"));\n        }\n        removeFromClass(annotationType);\n        for (Map.Entry<Field, AnnotationBuilder> field : fields.entrySet())\n        {\n            field.getValue().remove(annotationType);\n        }\n        for (Map.Entry<Method, AnnotationBuilder> method : methods.entrySet())\n        {\n            method.getValue().remove(annotationType);\n            if (methodParameters.get(method.getKey()) != null)\n            {\n                for (Map.Entry<Integer, AnnotationBuilder> parameter : methodParameters.get(method.getKey()).entrySet())\n                {\n                    parameter.getValue().remove(annotationType);\n                }\n            }\n        }\n        for (Map.Entry<Constructor<?>, AnnotationBuilder> constructor : constructors.entrySet())\n        {\n            constructor.getValue().remove(annotationType);\n            if (constructorParameters.get(constructor.getKey()) != null)\n            {\n                for (Map.Entry<Integer, AnnotationBuilder> parameter :\n                        constructorParameters.get(constructor.getKey()).entrySet())\n                {\n                    parameter.getValue().remove(annotationType);\n                }\n            }\n        }\n        return this;\n    }\n\n    /**\n     * Reads in from an existing AnnotatedType. Any elements not present are\n     * added. The javaClass will be read in. If the annotation already exists on\n     * that element in the builder the read annotation will be used.\n     *\n     * @param type the type to read from\n     * @throws IllegalArgumentException if type is null\n     */\n    public AnnotatedTypeBuilder<X> readFromType(AnnotatedType<X> type)\n    {\n        return readFromType(type, true);\n    }\n\n    /**\n     * Reads in from an existing AnnotatedType. Any elements not present are\n     * added. The javaClass will be read in if overwrite is true. If the\n     * annotation already exists on that element in the builder, overwrite\n     * determines whether the original or read annotation will be used.\n     *\n     * @param type      the type to read from\n     * @param overwrite if true, the read annotation will replace any existing\n     *                  annotation\n     * @throws IllegalArgumentException if type is null\n     */\n    public AnnotatedTypeBuilder<X> readFromType(AnnotatedType<X> type, boolean overwrite)\n    {\n        if (type == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"type\"));\n        }\n        if (javaClass == null || overwrite)\n        {\n            javaClass = type.getJavaClass();\n        }\n        mergeAnnotationsOnElement(type, overwrite, typeAnnotations);\n        for (AnnotatedField<? super X> field : type.getFields())\n        {\n            if (fields.get(field.getJavaMember()) == null)\n            {\n                fields.put(field.getJavaMember(), new AnnotationBuilder());\n            }\n            mergeAnnotationsOnElement(field, overwrite, fields.get(field.getJavaMember()));\n        }\n        for (AnnotatedMethod<? super X> method : type.getMethods())\n        {\n            if (methods.get(method.getJavaMember()) == null)\n            {\n                methods.put(method.getJavaMember(), new AnnotationBuilder());\n            }\n            mergeAnnotationsOnElement(method, overwrite, methods.get(method.getJavaMember()));\n            for (AnnotatedParameter<? super X> p : method.getParameters())\n            {\n                if (methodParameters.get(method.getJavaMember()) == null)\n                {\n                    methodParameters.put(method.getJavaMember(), new HashMap<Integer, AnnotationBuilder>());\n                }\n                if (methodParameters.get(method.getJavaMember()).get(p.getPosition()) == null)\n                {\n                    methodParameters.get(method.getJavaMember()).put(p.getPosition(), new AnnotationBuilder());\n                }\n                mergeAnnotationsOnElement(\n                        p, overwrite, methodParameters.get(method.getJavaMember()).get(p.getPosition()));\n            }\n        }\n        for (AnnotatedConstructor<? super X> constructor : type.getConstructors())\n        {\n            if (constructors.get(constructor.getJavaMember()) == null)\n            {\n                constructors.put(constructor.getJavaMember(), new AnnotationBuilder());\n            }\n            mergeAnnotationsOnElement(constructor, overwrite, constructors.get(constructor.getJavaMember()));\n            for (AnnotatedParameter<? super X> p : constructor.getParameters())\n            {\n                if (constructorParameters.get(\n                        constructor.getJavaMember()) == null)\n                {\n                    constructorParameters.put(\n                            constructor.getJavaMember(), new HashMap<Integer, AnnotationBuilder>());\n                }\n                if (constructorParameters.get(\n                        constructor.getJavaMember()).get(p.getPosition()) == null)\n                {\n                    constructorParameters.get(\n                            constructor.getJavaMember()).put(p.getPosition(), new AnnotationBuilder());\n                }\n                mergeAnnotationsOnElement(\n                        p, overwrite, constructorParameters.get(constructor.getJavaMember()).get(p.getPosition()));\n            }\n        }\n        return this;\n    }\n\n    /**\n     * Reads the annotations from an existing java type. Annotations already\n     * present will be overwritten\n     *\n     * @param type the type to read from\n     * @throws IllegalArgumentException if type is null\n     */\n    public AnnotatedTypeBuilder<X> readFromType(Class<X> type)\n    {\n        return readFromType(type, true);\n    }\n\n    /**\n     * Reads the annotations from an existing java type. If overwrite is true\n     * then existing annotations will be overwritten\n     *\n     * @param type      the type to read from\n     * @param overwrite if true, the read annotation will replace any existing\n     *                  annotation\n     */\n    public AnnotatedTypeBuilder<X> readFromType(Class<X> type, boolean overwrite)\n    {\n        if (type == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"type\"));\n        }\n        if (javaClass == null || overwrite)\n        {\n            javaClass = type;\n        }\n        for (Annotation annotation : type.getAnnotations())\n        {\n            if (overwrite || !typeAnnotations.isAnnotationPresent(annotation.annotationType()))\n            {\n                typeAnnotations.add(annotation);\n            }\n        }\n\n        for (Field field : ReflectionUtils.getAllDeclaredFields(type))\n        {\n            AnnotationBuilder annotationBuilder = fields.get(field);\n            if (annotationBuilder == null)\n            {\n                annotationBuilder = new AnnotationBuilder();\n                fields.put(field, annotationBuilder);\n            }\n\n            if (System.getSecurityManager() != null)\n            {\n                AccessController.doPrivileged(new SetAccessiblePrivilegedAction(field));\n            }\n            else\n            {\n                field.setAccessible(true);\n            }\n\n            for (Annotation annotation : field.getAnnotations())\n            {\n                if (overwrite || !annotationBuilder.isAnnotationPresent(annotation.annotationType()))\n                {\n                    annotationBuilder.add(annotation);\n                }\n            }\n        }\n\n        for (Method method : ReflectionUtils.getAllDeclaredMethods(type))\n        {\n            AnnotationBuilder annotationBuilder = methods.get(method);\n            if (annotationBuilder == null)\n            {\n                annotationBuilder = new AnnotationBuilder();\n                methods.put(method, annotationBuilder);\n            }\n\n            if (System.getSecurityManager() != null)\n            {\n                AccessController.doPrivileged(new SetAccessiblePrivilegedAction(method));\n            }\n            else\n            {\n                method.setAccessible(true);\n            }\n\n            for (Annotation annotation : method.getAnnotations())\n            {\n                if (overwrite || !annotationBuilder.isAnnotationPresent(annotation.annotationType()))\n                {\n                    annotationBuilder.add(annotation);\n                }\n            }\n\n            Map<Integer, AnnotationBuilder> parameters = methodParameters.get(method);\n            if (parameters == null)\n            {\n                parameters = new HashMap<Integer, AnnotationBuilder>();\n                methodParameters.put(method, parameters);\n            }\n            for (int i = 0; i < method.getParameterTypes().length; ++i)\n            {\n                AnnotationBuilder parameterAnnotationBuilder = parameters.get(i);\n                if (parameterAnnotationBuilder == null)\n                {\n                    parameterAnnotationBuilder = new AnnotationBuilder();\n                    parameters.put(i, parameterAnnotationBuilder);\n                }\n                for (Annotation annotation : method.getParameterAnnotations()[i])\n                {\n                    if (overwrite || !parameterAnnotationBuilder.isAnnotationPresent(annotation.annotationType()))\n                    {\n                        parameterAnnotationBuilder.add(annotation);\n                    }\n                }\n            }\n        }\n\n        for (Constructor<?> constructor : type.getDeclaredConstructors())\n        {\n            AnnotationBuilder annotationBuilder = constructors.get(constructor);\n            if (annotationBuilder == null)\n            {\n                annotationBuilder = new AnnotationBuilder();\n                constructors.put(constructor, annotationBuilder);\n            }\n            constructor.setAccessible(true);\n            for (Annotation annotation : constructor.getAnnotations())\n            {\n                if (overwrite || !annotationBuilder.isAnnotationPresent(annotation.annotationType()))\n                {\n                    annotationBuilder.add(annotation);\n                }\n            }\n            Map<Integer, AnnotationBuilder> mparams = constructorParameters.get(constructor);\n            if (mparams == null)\n            {\n                mparams = new HashMap<Integer, AnnotationBuilder>();\n                constructorParameters.put(constructor, mparams);\n            }\n            for (int i = 0; i < constructor.getParameterTypes().length; ++i)\n            {\n                AnnotationBuilder parameterAnnotationBuilder = mparams.get(i);\n                if (parameterAnnotationBuilder == null)\n                {\n                    parameterAnnotationBuilder = new AnnotationBuilder();\n                    mparams.put(i, parameterAnnotationBuilder);\n                }\n                for (Annotation annotation : constructor.getParameterAnnotations()[i])\n                {\n                    if (overwrite || !parameterAnnotationBuilder.isAnnotationPresent(annotation.annotationType()))\n                    {\n                        annotationBuilder.add(annotation);\n                    }\n                }\n            }\n        }\n        return this;\n    }\n\n    protected void mergeAnnotationsOnElement(Annotated annotated,\n                                             boolean overwriteExisting,\n                                             AnnotationBuilder typeAnnotations)\n    {\n        for (Annotation annotation : annotated.getAnnotations())\n        {\n            if (typeAnnotations.getAnnotation(annotation.annotationType()) != null)\n            {\n                if (overwriteExisting)\n                {\n                    typeAnnotations.remove(annotation.annotationType());\n                    typeAnnotations.add(annotation);\n                }\n            }\n            else\n            {\n                typeAnnotations.add(annotation);\n            }\n        }\n    }\n\n    /**\n     * Create an {@link AnnotatedType}. Any public members present on the\n     * underlying class and not overridden by the builder will be automatically\n     * added.\n     */\n    public AnnotatedType<X> create()\n    {\n        Map<Constructor<?>, Map<Integer, AnnotationStore>> constructorParameterAnnotations =\n                new HashMap<Constructor<?>, Map<Integer, AnnotationStore>>();\n        Map<Constructor<?>, AnnotationStore> constructorAnnotations =\n                new HashMap<Constructor<?>, AnnotationStore>();\n        Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnotations =\n                new HashMap<Method, Map<Integer, AnnotationStore>>();\n        Map<Method, AnnotationStore> methodAnnotations =\n                new HashMap<Method, AnnotationStore>();\n        Map<Field, AnnotationStore> fieldAnnotations =\n                new HashMap<Field, AnnotationStore>();\n\n        for (Map.Entry<Field, AnnotationBuilder> field : fields.entrySet())\n        {\n            fieldAnnotations.put(field.getKey(), field.getValue().create());\n        }\n\n        for (Map.Entry<Method, AnnotationBuilder> method : methods.entrySet())\n        {\n            methodAnnotations.put(method.getKey(), method.getValue().create());\n        }\n        for (Map.Entry<Method, Map<Integer, AnnotationBuilder>> parameters : methodParameters.entrySet())\n        {\n            Map<Integer, AnnotationStore> parameterAnnotations = new HashMap<Integer, AnnotationStore>();\n            methodParameterAnnotations.put(parameters.getKey(), parameterAnnotations);\n            for (Map.Entry<Integer, AnnotationBuilder> parameter : parameters.getValue().entrySet())\n            {\n                parameterAnnotations.put(parameter.getKey(), parameter.getValue().create());\n            }\n        }\n\n        for (Map.Entry<Constructor<?>, AnnotationBuilder> constructor : constructors.entrySet())\n        {\n            constructorAnnotations.put(constructor.getKey(), constructor.getValue().create());\n        }\n        for (Map.Entry<Constructor<?>, Map<Integer, AnnotationBuilder>> parameters : constructorParameters.entrySet())\n        {\n            Map<Integer, AnnotationStore> parameterAnnotations = new HashMap<Integer, AnnotationStore>();\n            constructorParameterAnnotations.put(parameters.getKey(), parameterAnnotations);\n            for (Map.Entry<Integer, AnnotationBuilder> parameter : parameters.getValue().entrySet())\n            {\n                parameterAnnotations.put(parameter.getKey(), parameter.getValue().create());\n            }\n        }\n\n        return new AnnotatedTypeImpl<X>(javaClass, typeAnnotations.create(), fieldAnnotations, methodAnnotations,\n                methodParameterAnnotations, constructorAnnotations, constructorParameterAnnotations, fieldTypes,\n                methodParameterTypes, constructorParameterTypes);\n    }\n\n    /**\n     * Override the declared type of a field\n     *\n     * @param field the field to override the type on\n     * @param type  the new type of the field\n     * @throws IllegalArgumentException if field or type is null\n     */\n    public void overrideFieldType(Field field, Type type)\n    {\n        if (field == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"field\"));\n        }\n        if (type == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"type\"));\n        }\n        fieldTypes.put(field, type);\n    }\n\n    /**\n     * Override the declared type of a field\n     *\n     * @param field the field to override the type on\n     * @param type  the new type of the field\n     * @throws IllegalArgumentException if field or type is null\n     */\n    public void overrideFieldType(AnnotatedField<? super X> field, Type type)\n    {\n        overrideFieldType(field.getJavaMember(), type);\n    }\n\n    /**\n     * Override the declared type of a method parameter\n     *\n     * @param method   the method to override the parameter type on\n     * @param position the position of the parameter to override the type on\n     * @param type     the new type of the parameter\n     * @throws IllegalArgumentException if parameter or type is null\n     */\n    public AnnotatedTypeBuilder<X> overrideMethodParameterType(Method method, int position, Type type)\n    {\n        if (method == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"method\"));\n        }\n        if (type == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"type\"));\n        }\n        if (methodParameterTypes.get(method) == null)\n        {\n            methodParameterTypes.put(method, new HashMap<Integer, Type>());\n        }\n        methodParameterTypes.get(method).put(position, type);\n        return this;\n    }\n\n    /**\n     * Override the declared type of a constructor parameter\n     *\n     * @param constructor the constructor to override the parameter type on\n     * @param position    the position of the parameter to override the type on\n     * @param type        the new type of the parameter\n     * @throws IllegalArgumentException if parameter or type is null\n     */\n    public AnnotatedTypeBuilder<X> overrideConstructorParameterType(Constructor<X> constructor, int position, Type type)\n    {\n        if (constructor == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"constructor\"));\n        }\n        if (type == null)\n        {\n            throw new IllegalArgumentException(String.format(\"%s parameter must not be null\", \"type\"));\n        }\n        if (constructorParameterTypes.get(constructor) == null)\n        {\n            constructorParameterTypes.put(constructor, new HashMap<Integer, Type>());\n        }\n        constructorParameterTypes.get(constructor).put(position, type);\n        return this;\n    }\n\n    /**\n     * Override the declared type of a parameter.\n     *\n     * @param parameter the parameter to override the type on\n     * @param type      the new type of the parameter\n     * @throws IllegalArgumentException if parameter or type is null\n     */\n    public AnnotatedTypeBuilder<X> overrideParameterType(AnnotatedParameter<? super X> parameter, Type type)\n    {\n        if (parameter.getDeclaringCallable().getJavaMember() instanceof Method)\n        {\n            Method method = (Method) parameter.getDeclaringCallable().getJavaMember();\n            return overrideMethodParameterType(method, parameter.getPosition(), type);\n        }\n        if (parameter.getDeclaringCallable().getJavaMember() instanceof Constructor<?>)\n        {\n            @SuppressWarnings(\"unchecked\")\n            Constructor<X> constructor = (Constructor<X>) parameter.getDeclaringCallable().getJavaMember();\n            return overrideConstructorParameterType(constructor, parameter.getPosition(), type);\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Cannot remove from parameter \" + parameter +\n                    \" - cannot operate on member \" + parameter.getDeclaringCallable().getJavaMember());\n        }\n    }\n\n    /**\n     * getter for the class\n     */\n    public Class<X> getJavaClass()\n    {\n        return javaClass;\n    }\n\n    /**\n     * setter for the class\n     */\n    public AnnotatedTypeBuilder<X> setJavaClass(Class<X> javaClass)\n    {\n        this.javaClass = javaClass;\n        return this;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotatedTypeImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.inject.spi.AnnotatedConstructor;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\n/**\n * An implementation of {@link AnnotatedType} to be used in CDI life cycle events and\n * {@link org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder}.\n */\nclass AnnotatedTypeImpl<X> extends AnnotatedImpl implements AnnotatedType<X>\n{\n\n    private final Set<AnnotatedConstructor<X>> constructors;\n    private final Set<AnnotatedField<? super X>> fields;\n    private final Set<AnnotatedMethod<? super X>> methods;\n\n    private final Class<X> javaClass;\n\n    /**\n     * We make sure that there is a NewAnnotatedMember for every public\n     * method/field/constructor\n     * <p/>\n     * If annotation have been added to other methods as well we add them to\n     */\n    AnnotatedTypeImpl(Class<X> clazz,\n                      AnnotationStore typeAnnotations,\n                      Map<Field, AnnotationStore> fieldAnnotations,\n                      Map<Method, AnnotationStore> methodAnnotations,\n                      Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnotations,\n                      Map<Constructor<?>, AnnotationStore> constructorAnnotations,\n                      Map<Constructor<?>, Map<Integer, AnnotationStore>> constructorParameterAnnotations,\n                      Map<Field, Type> fieldTypes,\n                      Map<Method, Map<Integer, Type>> methodParameterTypes,\n                      Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes)\n    {\n        super(clazz, typeAnnotations, null, null);\n        javaClass = clazz;\n        constructors = new HashSet<AnnotatedConstructor<X>>();\n        Set<Constructor<?>> cset = new HashSet<Constructor<?>>();\n        Set<Method> mset = new HashSet<Method>();\n        Set<Field> fset = new HashSet<Field>();\n        for (Constructor<?> c : clazz.getConstructors())\n        {\n            AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(\n                    this, c, constructorAnnotations.get(c), constructorParameterAnnotations.get(c),\n                    constructorParameterTypes.get(c));\n            constructors.add(nc);\n            cset.add(c);\n        }\n        for (Map.Entry<Constructor<?>, AnnotationStore> c : constructorAnnotations.entrySet())\n        {\n            if (!cset.contains(c.getKey()))\n            {\n                AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(\n                        this, c.getKey(), c.getValue(), constructorParameterAnnotations.get(c.getKey()),\n                        constructorParameterTypes.get(c.getKey()));\n                constructors.add(nc);\n            }\n        }\n        methods = new HashSet<AnnotatedMethod<? super X>>();\n        for (Method m : clazz.getMethods())\n        {\n            if (!m.getDeclaringClass().equals(Object.class) && !m.getDeclaringClass().equals(Annotation.class))\n            {\n                AnnotatedMethodImpl<X> met = new AnnotatedMethodImpl<X>(this, m, methodAnnotations.get(m),\n                        methodParameterAnnotations.get(m), methodParameterTypes.get(m));\n                methods.add(met);\n                mset.add(m);\n            }\n        }\n        for (Map.Entry<Method, AnnotationStore> c : methodAnnotations.entrySet())\n        {\n            if (!c.getKey().getDeclaringClass().equals(Object.class) && !mset.contains(c.getKey()))\n            {\n                AnnotatedMethodImpl<X> nc = new AnnotatedMethodImpl<X>(\n                        this, c.getKey(),\n                        c.getValue(),\n                        methodParameterAnnotations.get(c.getKey()),\n                        methodParameterTypes.get(c.getKey()));\n                methods.add(nc);\n            }\n        }\n        fields = new HashSet<AnnotatedField<? super X>>();\n        for (Field f : clazz.getFields())\n        {\n            AnnotatedField<X> b = new AnnotatedFieldImpl<X>(this, f, fieldAnnotations.get(f), fieldTypes.get(f));\n            fields.add(b);\n            fset.add(f);\n        }\n        for (Map.Entry<Field, AnnotationStore> e : fieldAnnotations.entrySet())\n        {\n            if (!fset.contains(e.getKey()))\n            {\n                fields.add(new AnnotatedFieldImpl<X>(this, e.getKey(), e.getValue(), fieldTypes.get(e.getKey())));\n            }\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Set<AnnotatedConstructor<X>> getConstructors()\n    {\n        return Collections.unmodifiableSet(constructors);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Set<AnnotatedField<? super X>> getFields()\n    {\n        return Collections.unmodifiableSet(fields);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Class<X> getJavaClass()\n    {\n        return javaClass;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Set<AnnotatedMethod<? super X>> getMethods()\n    {\n        return Collections.unmodifiableSet(methods);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.AnnotatedElement;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Set;\n\n/**\n * A store of annotations to be used {@link AnnotatedTypeBuilder} and other places\n * where a collection of annotations needs manipulation.\n */\n// this class is intentionally made package scope\nclass AnnotationBuilder\n{\n    private final Map<Class<? extends Annotation>, Annotation> annotationMap;\n    private final Set<Annotation> annotationSet;\n\n    /**\n     * Default constructor.\n     */\n    AnnotationBuilder()\n    {\n        annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();\n        annotationSet = new HashSet<Annotation>();\n    }\n\n    /**\n     * Adds the annotation to the collections.\n     *\n     * @param annotation annotation to be added\n     * @return this\n     */\n    public AnnotationBuilder add(Annotation annotation)\n    {\n        if (annotation == null)\n        {\n            throw new IllegalArgumentException(\"annotation parameter must not be null\");\n        }\n        annotationSet.add(annotation);\n        annotationMap.put(annotation.annotationType(), annotation);\n        return this;\n    }\n\n    /**\n     * Removes the given annotation from the collections.\n     *\n     * @param annotationType to be removed\n     * @return this\n     */\n    public AnnotationBuilder remove(Class<? extends Annotation> annotationType)\n    {\n        if (annotationType == null)\n        {\n            throw new IllegalArgumentException(\"annotationType parameter must not be null\");\n        }\n\n        Iterator<Annotation> it = annotationSet.iterator();\n        while (it.hasNext())\n        {\n            Annotation an = it.next();\n            if (annotationType.isAssignableFrom(an.annotationType()))\n            {\n                it.remove();\n            }\n        }\n        annotationMap.remove(annotationType);\n        return this;\n    }\n\n    /**\n     * Creates an {@link AnnotationStore} using the annotations from this instance.\n     *\n     * @return new AnnotationStore\n     */\n    public AnnotationStore create()\n    {\n        return new AnnotationStore(annotationMap, annotationSet);\n    }\n\n    /**\n     * Adds all annotations from the given collection\n     *\n     * @param annotations collection of annotations to be added\n     * @return this\n     */\n    public AnnotationBuilder addAll(Collection<Annotation> annotations)\n    {\n        for (Annotation annotation : annotations)\n        {\n            add(annotation);\n        }\n        return this;\n    }\n\n    /**\n     * Adds all annotations from an {@link AnnotationStore}.\n     *\n     * @param annotations annotations to be added\n     * @return this\n     */\n    public AnnotationBuilder addAll(AnnotationStore annotations)\n    {\n        for (Annotation annotation : annotations.getAnnotations())\n        {\n            add(annotation);\n        }\n        return this;\n    }\n\n    /**\n     * Adds all annotations from the given {@link AnnotatedElement}.\n     *\n     * @param element element containing annotations to be added\n     * @return this\n     */\n    public AnnotationBuilder addAll(AnnotatedElement element)\n    {\n        for (Annotation a : element.getAnnotations())\n        {\n            add(a);\n        }\n        return this;\n    }\n\n    /**\n     * Getter.\n     */\n    public <T extends Annotation> T getAnnotation(Class<T> anType)\n    {\n        return (T) annotationMap.get(anType);\n    }\n\n    /**\n     * Simple check for an annotation.\n     */\n    public boolean isAnnotationPresent(Class<?> annotationType)\n    {\n        return annotationMap.containsKey(annotationType);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String toString()\n    {\n        return annotationSet.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationStore.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Map;\nimport java.util.Set;\n\nimport static java.util.Collections.emptyMap;\nimport static java.util.Collections.emptySet;\nimport static java.util.Collections.unmodifiableSet;\n\n/**\n * A helper class used to hold annotations on a type or member.\n */\nclass AnnotationStore\n{\n    private final Map<Class<? extends Annotation>, Annotation> annotationMap;\n    private final Set<Annotation> annotationSet;\n\n    AnnotationStore(Map<Class<? extends Annotation>, Annotation> annotationMap, Set<Annotation> annotationSet)\n    {\n        this.annotationMap = annotationMap;\n        this.annotationSet = unmodifiableSet(annotationSet);\n    }\n\n    AnnotationStore()\n    {\n        annotationMap = emptyMap();\n        annotationSet = emptySet();\n    }\n\n    <T extends Annotation> T getAnnotation(Class<T> annotationType)\n    {\n        return annotationType.cast(annotationMap.get(annotationType));\n    }\n\n    Set<Annotation> getAnnotations()\n    {\n        return annotationSet;\n    }\n\n    boolean isAnnotationPresent(Class<? extends Annotation> annotationType)\n    {\n        return annotationMap.containsKey(annotationType);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/ContextualLifecycle.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\n\n/**\n * Callbacks used by {@link org.apache.deltaspike.core.util.bean.BeanBuilder}\n * and {@link org.apache.deltaspike.core.util.bean.ImmutableBeanWrapper} to allow control\n * of the creation and destruction of a custom bean.\n *\n * @param <T> the class of the bean instance\n */\npublic interface ContextualLifecycle<T>\n{\n    /**\n     * Callback invoked by a Solder created bean when\n     * {@link Bean#create(CreationalContext)} is called.\n     *\n     * @param bean              the bean initiating the callback\n     * @param creationalContext the context in which this instance was created\n     */\n    T create(Bean<T> bean, CreationalContext<T> creationalContext);\n\n    /**\n     * Callback invoked by a Solder created bean when\n     * {@link Bean#destroy(Object, CreationalContext)} is called.\n     *\n     * @param bean              the bean initiating the callback\n     * @param instance          the contextual instance to destroy\n     * @param creationalContext the context in which this instance was created\n     */\n    void destroy(Bean<T> bean, T instance, CreationalContext<T> creationalContext);\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/DelegatingContextualLifecycle.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\n\n/**\n * An implementation of {@link ContextualLifecycle} that is backed by an\n * {@link InjectionTarget}.\n *\n * @param <T>\n */\npublic class DelegatingContextualLifecycle<T> implements ContextualLifecycle<T>\n{\n\n    private final InjectionTarget<T> injectionTarget;\n\n    /**\n     * Instantiate a new {@link ContextualLifecycle} backed by an\n     * {@link InjectionTarget}.\n     *\n     * @param injectionTarget the {@link InjectionTarget} used to create and\n     *                        destroy instances\n     */\n    public DelegatingContextualLifecycle(InjectionTarget<T> injectionTarget)\n    {\n        this.injectionTarget = injectionTarget;\n    }\n\n    public T create(Bean<T> bean, CreationalContext<T> creationalContext)\n    {\n        T instance = injectionTarget.produce(creationalContext);\n        injectionTarget.inject(instance, creationalContext);\n        injectionTarget.postConstruct(instance);\n        return instance;\n    }\n\n    public void destroy(Bean<T> bean, T instance, CreationalContext<T> creationalContext)\n    {\n        try\n        {\n            injectionTarget.preDestroy(instance);\n            creationalContext.release();\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/metadata/builder/DummyInjectionTarget.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport java.util.Set;\n\nimport static java.util.Collections.emptySet;\n\n/**\n * Injection target implementation that does nothing\n */\npublic class DummyInjectionTarget<T> implements InjectionTarget<T>\n{\n\n    public void inject(T instance, CreationalContext<T> ctx)\n    {\n    }\n\n    public void postConstruct(T instance)\n    {\n    }\n\n    public void preDestroy(T instance)\n    {\n    }\n\n    public void dispose(T instance)\n    {\n    }\n\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return emptySet();\n    }\n\n    public T produce(CreationalContext<T> ctx)\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/test/java/org/apache/deltaspike/test/api/metadata/AnnotatedTypeBuilderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.metadata;\n\nimport org.apache.deltaspike.core.api.literal.AlternativeLiteral;\nimport org.apache.deltaspike.core.api.literal.AnyLiteral;\nimport org.apache.deltaspike.core.api.literal.ApplicationScopedLiteral;\nimport org.apache.deltaspike.core.api.literal.NamedLiteral;\nimport org.apache.deltaspike.core.api.literal.TypedLiteral;\nimport org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;\nimport org.junit.Test;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.AnnotatedConstructor;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.util.AnnotationLiteral;\nimport jakarta.inject.Named;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.concurrent.TimeUnit;\n\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertThat;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.assertNotNull;\n\npublic class AnnotatedTypeBuilderTest\n{\n    @Test\n    public void testTypeLevelAnnotationRedefinition()\n    {\n        AnnotatedTypeBuilder<Cat> builder = new AnnotatedTypeBuilder<Cat>();\n        builder.readFromType(Cat.class);\n\n        AnnotatedType<Cat> cat = builder.create();\n\n        assertNotNull(cat);\n        assertNotNull(cat.getAnnotation(Named.class));\n        assertEquals(\"cat\", cat.getAnnotation(Named.class).value());\n\n        builder.addToClass(new AlternativeLiteral())\n                .addToClass(new ApplicationScopedLiteral())\n                .removeFromClass(Named.class)\n                .addToClass(new NamedLiteral(\"tomcat\"));\n\n        cat = builder.create();\n        assertNotNull(cat);\n\n        assertEquals(3, cat.getAnnotations().size());\n        assertTrue(cat.isAnnotationPresent(Named.class));\n        assertTrue(cat.isAnnotationPresent(Alternative.class));\n        assertTrue(cat.isAnnotationPresent(ApplicationScoped.class));\n        assertEquals(\"tomcat\", cat.getAnnotation(Named.class).value());\n        \n        AnnotatedMethod observerMethod = null;\n        for (AnnotatedMethod m : cat.getMethods())\n        {\n            if (\"doSomeObservation\".equals(m.getJavaMember().getName()))\n            {\n                observerMethod = m;\n                break;\n            }\n        }\n        assertNotNull(observerMethod);\n        observerMethod.isAnnotationPresent(Observes.class);\n        \n        {\n            // test reading from an AnnotatedType\n            AnnotatedTypeBuilder<Cat> builder2 = new AnnotatedTypeBuilder<Cat>();\n            builder2.readFromType(cat);\n            builder2.removeFromAll(Named.class);\n\n            final AnnotatedType<Cat> noNameCat = builder2.create();\n            assertFalse(noNameCat.isAnnotationPresent(Named.class));\n            assertEquals(2, noNameCat.getAnnotations().size());\n        }\n\n        {\n\n            // test reading from an AnnotatedType in non-overwrite mode\n            AnnotatedTypeBuilder<Cat> builder3 = new AnnotatedTypeBuilder<Cat>();\n            builder3.readFromType(cat, true);\n            builder3.removeFromAll(Named.class);\n\n            builder3.readFromType(cat, false);\n\n            final AnnotatedType<Cat> namedCat = builder3.create();\n            assertTrue(namedCat.isAnnotationPresent(Named.class));\n            assertEquals(3, namedCat.getAnnotations().size());\n        }\n    }\n\n    @Test\n    public void testAdditionOfAnnotation()\n    {\n        final AnnotatedTypeBuilder<Cat> builder = new AnnotatedTypeBuilder<Cat>();\n        builder.readFromType(Cat.class, true);\n        builder.addToClass(new TypedLiteral());\n\n        final AnnotatedType<Cat> catAnnotatedType = builder.create();\n        assertThat(catAnnotatedType.isAnnotationPresent(Typed.class), is(true));\n    }\n\n    @Test\n    public void modifyAnnotationsOnConstructorParameter() throws NoSuchMethodException\n    {\n        final AnnotatedTypeBuilder<Cat> builder = new AnnotatedTypeBuilder<Cat>();\n        builder.readFromType(Cat.class, true);\n        builder.removeFromConstructorParameter(Cat.class.getConstructor(String.class, String.class), 1, Default.class);\n        builder.addToConstructorParameter(Cat.class.getConstructor(String.class, String.class), 1, new AnyLiteral());\n\n        final AnnotatedType<Cat> catAnnotatedType = builder.create();\n        Set<AnnotatedConstructor<Cat>> catCtors = catAnnotatedType.getConstructors();\n\n        assertThat(catCtors.size(), is(2));\n\n        for (AnnotatedConstructor<Cat> ctor : catCtors)\n        {\n            if (ctor.getParameters().size() == 2)\n            {\n                List<AnnotatedParameter<Cat>> ctorParams = ctor.getParameters();\n\n                assertThat(ctorParams.get(1).getAnnotations().size(), is(1));\n                assertThat((AnyLiteral) ctorParams.get(1).getAnnotations().toArray()[0], is(new AnyLiteral()));\n            }\n        }\n    }\n\n    @Test\n    public void buildValidAnnotationAnnotatedType()\n    {\n        final AnnotatedTypeBuilder<Small> builder = new AnnotatedTypeBuilder<Small>();\n        builder.readFromType(Small.class);\n        final AnnotatedType<Small> smallAnnotatedType = builder.create();\n\n        assertThat(smallAnnotatedType.getMethods().size(), is(1));\n        assertThat(smallAnnotatedType.getConstructors().size(), is(0));\n        assertThat(smallAnnotatedType.getFields().size(), is(0));\n    }\n\n\n    @Test\n    public void testCtWithMultipleParams()\n    {\n        final AnnotatedTypeBuilder<TypeWithParamsInCt> builder = new AnnotatedTypeBuilder<TypeWithParamsInCt>();\n        builder.readFromType(TypeWithParamsInCt.class);\n        builder.addToClass(new AnnotationLiteral<Default>() {});\n\n        AnnotatedType<TypeWithParamsInCt> newAt = builder.create();\n        assertNotNull(newAt);\n    }\n\n    @Test\n    public void testEnumWithParam()\n    {\n        final AnnotatedTypeBuilder<EnumWithParams> builder = new AnnotatedTypeBuilder<EnumWithParams>();\n        builder.readFromType(EnumWithParams.class);\n        builder.addToClass(new AnnotationLiteral<Default>() {});\n\n        AnnotatedType<EnumWithParams> newAt = builder.create();\n        assertNotNull(newAt);\n    }\n\n\n    public static class TypeWithParamsInCt\n    {\n        public TypeWithParamsInCt(String a, int b, String c)\n        {\n            // all fine\n        }\n    }\n\n    public enum EnumWithParams\n    {\n        VALUE(\"A\");\n\n        EnumWithParams(String val) {\n            // all fine\n        }\n    }\n\n    @Test\n    public void testExceptionPerformance() {\n        long start = System.nanoTime();\n        long val = -230349823423L;\n        Exception e = new Exception(\"static\");\n        for (int i=0; i < 10_000_000; i++) {\n            try {\n                val += 19;\n                throw e;\n            }\n            catch (Exception e2) {\n                // do nothing\n            }\n        }\n        long end = System.nanoTime();\n        System.out.println(\"Exeptions took ms \" + TimeUnit.NANOSECONDS.toMillis(end - start));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/test/java/org/apache/deltaspike/test/api/metadata/Cat.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.metadata;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named(\"cat\")\npublic class Cat\n{\n    private String color;\n    private String gender;\n\n    public Cat()\n    {\n    }\n\n    @Inject\n    public Cat(String color, String gender)\n    {\n        this.color = color;\n        this.gender = gender;\n    }\n\n    @PostConstruct\n    public void setup()\n    {\n    }\n\n    public String getColor()\n    {\n        return color;\n    }\n\n    public void setColor(String color)\n    {\n        this.color = color;\n    }\n\n    public String getGender()\n    {\n        return gender;\n    }\n\n    public void setGender(String gender)\n    {\n        this.gender = gender;\n    }\n    \n    protected void doSomeObservation(@Observes Cat cat, BeanManager beanManager)\n    {\n        // whoah, someone fires cats around ^^\n        // at least it tests parameter scanning ;)\n        color = cat.color;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/obsolete/src/test/java/org/apache/deltaspike/test/api/metadata/Small.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.metadata;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n\n@Qualifier\n@Documented\n@Retention(value = RetentionPolicy.RUNTIME)\npublic @interface Small\n{\n    String value() default \"\";\n}\n"
  },
  {
    "path": "deltaspike/core/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.core</groupId>\n        <artifactId>core-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.core</groupId>\n    <artifactId>deltaspike-core-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Core-API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.core.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.core.*,\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n        <deltaspike.osgi.provide.capability>\n            org.ops4j.pax.cdi.extension; extension=deltaspike-core-api\n        </deltaspike.osgi.provide.capability>\n    </properties>\n\n</project>\n\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Config.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\n\nimport java.util.List;\n\n/**\n * The Configuration for an application/ClassLoader.\n */\npublic interface Config\n{\n\n    /**\n     * The entry point to the builder-based optionally typed configuration resolution mechanism.\n     *\n     * String is the default type for configuration entries and is not considered a 'type' by this resolver. Therefore\n     * an UntypedResolver is returned by this method. To convert the configuration value to another type, call\n     * {@link ConfigResolver.UntypedResolver#as(Class)}.\n     *\n     * @param name The property key to resolve\n     * @return A builder for configuration resolution.\n     */\n    ConfigResolver.UntypedResolver<String> resolve(String name);\n\n    /**\n     * <p>This method can be used to access multiple\n     * {@link ConfigResolver.TypedResolver} which must be consistent.\n     * The returned {@link ConfigSnapshot} is an immutable object which contains all the\n     * resolved values at the time of calling this method.\n     *\n     * <p>An example would be to access some {@code 'myapp.host'} and {@code 'myapp.port'}:\n     * The underlying values are {@code 'oldserver'} and {@code '8080'}.\n     *\n     * <pre>\n     *     // get the current host value\n     *     TypedResolver&lt;String&gt; hostCfg config.resolve(\"myapp.host\")\n     *              .cacheFor(TimeUnit.MINUTES, 60);\n     *\n     *     // and right inbetween the underlying values get changed to 'newserver' and port 8082\n     *\n     *     // get the current port for the host\n     *     TypedResolver&lt;Integer&gt; portCfg config.resolve(\"myapp.port\")\n     *              .cacheFor(TimeUnit.MINUTES, 60);\n     * </pre>\n     *\n     * In ths above code we would get the combination of {@code 'oldserver'} but with the new port {@code 8081}.\n     * And this will obviously blow up because that host+port combination doesn't exist.\n     *\n     * To consistently access n different config values we can start a {@link ConfigSnapshot} for those values.\n     *\n     * <pre>\n     *     ConfigSnapshot cfgSnap = config.createSnapshot(hostCfg, portCfg);\n     *\n     *     String host = cfgSnap.getValue(hostCfg);\n     *     Integer port = cfgSnap.getValue(portCfg);\n     * </pre>\n     *\n     * Note that there is no <em>close</em> on the snapshot.\n     * They should be used as local variables inside a method.\n     * Values will not be reloaded for an open {@link ConfigSnapshot}.\n     *\n     * @param typedResolvers the list of {@link ConfigResolver.TypedResolver} to be accessed in an atomic way\n     *\n     * @return a new {@link ConfigSnapshot} which holds the resolved values of all the {@param typedResolvers}.\n     */\n    ConfigSnapshot snapshotFor(ConfigResolver.TypedResolver<?>... typedResolvers);\n\n    /**\n     * @return all the current ConfigSources for this Config\n     */\n    ConfigSource[] getConfigSources();\n\n    /**\n     * This method can be used for programmatically adding {@link ConfigSource}s.\n     * It is not needed for normal 'usage' by end users, but only for Extension Developers!\n     *\n     * @param configSourcesToAdd the ConfigSources to add\n     */\n    void addConfigSources(List<ConfigSource> configSourcesToAdd);\n\n    /**\n     * @return the {@link ConfigFilter}s for the current application.\n     */\n    List<ConfigFilter> getConfigFilters();\n\n    /**\n     * Add a {@link ConfigFilter} to the ConfigResolver. This will only affect the current WebApp (or more precisely the\n     * current ClassLoader and it's children).\n     *\n     * @param configFilter\n     */\n    void addConfigFilter(ConfigFilter configFilter);\n\n    /**\n     * Filter the configured value.\n     * This can e.g. be used for decryption.\n     * @param key the key of the config property\n     * @param value to be filtered\n     * @param forLog whether the value is intended to be presented to some humans somehow.\n     *               If filtered for logging, then secrets might get starred out '*****'.\n     * @return the filtered value\n     */\n    String filterConfigValue(String key, String value, boolean forLog);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigProperty.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.concurrent.TimeUnit;\n\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport static java.util.concurrent.TimeUnit.SECONDS;\n\n/**\n * This Qualifier allows simple injection of configuration properties through the DeltaSpike configuration \n * mechanism.\n * <p>\n * A default implementation is provided in DeltaSpike for basic String injection points:\n * <pre>\n *   &#064;Inject &#064;ConfigProperty(name=&quot;locationId&quot;)\n *   private String locationId;\n * </pre>\n * </p>\n * <p>\n * It's possible to use config properties in a type-safe manner, which requires a custom producer:\n *\n * <pre>\n *   &#064;Target({FIELD, METHOD})\n *   &#064;Retention(RUNTIME)\n *   &#064;ConfigProperty(name = \"locationId\")\n *   &#064;Qualifier\n *   public &#064;interface Location {\n *   }\n * </pre>\n *\n * <pre>\n *   &#064;Location\n *   private String locationId;\n * </pre>\n *\n *  <pre>\n *   &#064;ApplicationScoped\n *   public class CustomConfigPropertyProducer extends BaseConfigPropertyProducer {\n *     &#064;Produces\n *     &#064;Dependent\n *     &#064;Location\n *     public String produceLocationId(InjectionPoint injectionPoint) {\n *       String configuredValue = getStringPropertyValue(injectionPoint);\n *       if (configuredValue == null) {\n *         return null;\n *       }\n *       return configuredValue;\n *     }\n *   }\n * </pre>\n * </p>\n * <p>\n * Producers can be implemented to support other types of injection points:\n * <pre>\n *   &#064;Inject\n *   &#064;Location\n *   private LocationId locationId;\n * </pre>\n *\n * <pre>\n *   &#064;ApplicationScoped\n *   public class CustomConfigPropertyProducer extends BaseConfigPropertyProducer {\n *     &#064;Produces\n *     &#064;Dependent\n *     &#064;Location\n *     public LocationId produceLocationId(InjectionPoint injectionPoint) {\n *       String configuredValue = getStringPropertyValue(injectionPoint);\n *       if (configuredValue == null) {\n *         return null;\n *       }\n *       return LocationId.valueOf(configuredValue.trim().toUpperCase());\n *     }\n *   }\n * </pre>\n * </p>\n * For custom producer implementations, {@link org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer} can\n * be used as the base class.\n * \n * @see org.apache.deltaspike.core.api.config.ConfigResolver\n * @see org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer\n */\n@Target({ PARAMETER, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n@Qualifier\npublic @interface ConfigProperty\n{\n    /**\n     * This constant is a workaround for the java restriction that Annotation values cannot be set to null. Do not use\n     * this String in your configuration.\n     */\n    String NULL = \"org.apache.deltaspike.NullValueMarker\";\n\n    /**\n     * Name/key of the property.\n     * @return name of the property\n     */\n    @Nonbinding\n    String name();\n\n    /**\n     * <b>Optional</b> default value.\n     *\n     * @return the default value which should be used if no config value could be found\n     */\n    @Nonbinding\n    String defaultValue() default NULL;\n\n    @Nonbinding\n    boolean projectStageAware() default true;\n\n    @Nonbinding\n    String parameterizedBy() default NULL;\n\n    /**\n     * Whether to resolve 'variables' in configured values.\n     *\n     * @see org.apache.deltaspike.core.api.config.ConfigResolver.TypedResolver#evaluateVariables(boolean)\n     */\n    @Nonbinding\n    boolean evaluateVariables() default true;\n\n    /**\n     * Converter for this property.\n     * @return the converter to use to read this property in the expected type.\n     */\n    @Nonbinding\n    Class<? extends ConfigResolver.Converter> converter() default ConfigResolver.Converter.class;\n\n    /**\n     * This only applies when used with injecting a {@link java.util.function.Supplier} for the requested configuration.\n     * @return the duration while the value is not reloaded.\n     */\n    @Nonbinding\n    long cacheFor() default -1;\n\n    /**\n     * This only applies when used with injecting a {@link java.util.function.Supplier} for the requested configuration.\n     * @return the duration unit for {@see cacheFor()}.\n     */\n    @Nonbinding\n    TimeUnit cacheUnit() default SECONDS;\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.ServiceLoader;\nimport java.util.Set;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.BiFunction;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.util.ClassUtils;\n\n/**\n * The main entry point to the DeltaSpike configuration mechanism.\n *\n * <p>\n * Resolves configured values of properties by going through the list of configured {@link ConfigSource}s and using the\n * one with the highest ordinal. If multiple {@link ConfigSource}s have the same ordinal, their order is undefined.</p>\n *\n * <p>\n * You can provide your own lookup paths by implementing and registering additional {@link PropertyFileConfig} or\n * {@link ConfigSource} or {@link org.apache.deltaspike.core.spi.config.ConfigSourceProvider} implementations.</p>\n *\n * <p>\n * The resolved configuration is also accessible by simple injection using the {@link ConfigProperty} qualifier.</p>\n *\n * @see <a href=\"http://deltaspike.apache.org/documentation/configuration.html\">DeltaSpike Configuration Mechanism</a>\n */\n@Vetoed\npublic final class ConfigResolver\n{\n    /**\n     * Can be used to tweak the application name.\n     * This will e.g. used in the JMX MBean to differentiate between applications.\n     */\n    public static final String DELTASPIKE_APP_NAME_CONFIG = \"deltaspike.application.name\";\n\n    /**\n     * Set this to true if your application should log the whole ConfigSources and Configuration\n     * at startup.\n     */\n    public static final String DELTASPIKE_LOG_CONFIG = \"deltaspike.config.log\";\n\n    private static ConfigProvider configProvider;\n\n    private ConfigResolver()\n    {\n        // this is a utility class which doesn't get instantiated.\n    }\n\n    public static Config getConfig()\n    {\n        ClassLoader cl = ClassUtils.getClassLoader(null);\n        return getConfig(cl);\n    }\n\n    public static Config getConfig(ClassLoader cl)\n    {\n        return getConfigProvider().getConfig(cl);\n    }\n\n    /**\n     * This method can be used for programmatically adding {@link ConfigSource}s.\n     * It is not needed for normal 'usage' by end users, but only for Extension Developers!\n     *\n     * @param configSourcesToAdd the ConfigSources to add\n     */\n    public static synchronized void addConfigSources(List<ConfigSource> configSourcesToAdd)\n    {\n        getConfigProvider().getConfig().addConfigSources(configSourcesToAdd);\n    }\n\n    /**\n     * Clear all ConfigSources for the current ClassLoader.\n     * This will also clean up all ConfigFilters.\n     */\n    public static synchronized void freeConfigSources()\n    {\n        if (configProvider != null)\n        {\n            ClassLoader cl = ClassUtils.getClassLoader(null);\n            configProvider.releaseConfig(cl);\n        }\n    }\n\n    /**\n     * Add a {@link ConfigFilter} to the ConfigResolver. This will only affect the current WebApp (or more precisely the\n     * current ClassLoader and it's children).\n     *\n     * @param configFilter\n     */\n    public static void addConfigFilter(ConfigFilter configFilter)\n    {\n        getConfigProvider().getConfig().addConfigFilter(configFilter);\n    }\n\n    /**\n     * @return the {@link ConfigFilter}s for the current application.\n     */\n    public static List<ConfigFilter> getConfigFilters()\n    {\n        return getConfigProvider().getConfig().getConfigFilters();\n    }\n\n\n    /**\n     * {@link #getPropertyValue(java.lang.String)} which returns the provided default value if no configured value can\n     * be found (<code>null</code> or empty).\n     *\n     * @param key          the property key\n     * @param defaultValue fallback value\n     *\n     * @return the configured property value from the {@link ConfigSource} with the highest ordinal or the defaultValue\n     *         if there is no value explicitly configured\n     */\n    public static String getPropertyValue(String key, String defaultValue)\n    {\n        return getPropertyValue(key, defaultValue, true);\n    }\n\n\n    public static String getPropertyValue(String key, String defaultValue, boolean evaluateVariables)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .withDefault(defaultValue)\n                .evaluateVariables(evaluateVariables)\n                .withCurrentProjectStage(false)\n                .getValue();\n    }\n\n    /**\n     * Resolves the value configured for the given key.\n     *\n     * @param key the property key\n     *\n     * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is\n     *         no configured value for it\n     */\n    public static String getPropertyValue(String key)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .evaluateVariables(true)\n                .withCurrentProjectStage(false)\n                .getValue();\n    }\n\n    /**\n     * Resolves the value configured for the given key.\n     *\n     * @param key the property key\n     * @param evaluateVariables whether to evaluate any '${variablename}' variable expressions\n     *\n     * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is\n     *         no configured value for it\n     */\n    public static String getPropertyValue(String key, boolean evaluateVariables)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .evaluateVariables(evaluateVariables)\n                .withCurrentProjectStage(false)\n                .getValue();\n    }\n\n    /**\n     * Resolves the value configured for the given key in the current\n     * {@link org.apache.deltaspike.core.api.projectstage.ProjectStage}.\n     *\n     * <p>\n     * First, it will search for a value configured for the given key suffixed with the current ProjectStage (e.g.\n     * 'myproject.myconfig.Production'), and in case this value is not found (null or empty), it will look up the given\n     * key without any suffix.</p>\n     *\n     * <p>\n     * <b>Attention</b> This method must only be used after all ConfigSources got registered and it also must not be\n     * used to determine the ProjectStage itself.</p>\n     *\n     * @param key\n     *\n     * @return the value configured for {@code <given key>.<current project stage>}, or just the configured value of\n     *         {@code <given key>} if the project-stage-specific value is not found (null or empty)\n     *\n     */\n    public static String getProjectStageAwarePropertyValue(String key)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .withCurrentProjectStage(true)\n                .evaluateVariables(true)\n                .getValue();\n    }\n    /**\n     * {@link #getProjectStageAwarePropertyValue(String)} which returns the provided default value if no configured\n     * value can be found (<code>null</code> or empty).\n     *\n     * @param key\n     * @param defaultValue fallback value\n     *\n     * @return the configured value or if non found the defaultValue\n     *\n     */\n    public static String getProjectStageAwarePropertyValue(String key, String defaultValue)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .withCurrentProjectStage(true)\n                .withDefault(defaultValue)\n                .evaluateVariables(true)\n                .getValue();\n    }\n\n    /**\n     * Resolves the value configured for the given key, parameterized by the current\n     * {@link org.apache.deltaspike.core.api.projectstage.ProjectStage} and by the value of a second property.\n     *\n     * <p>\n     * <b>Example:</b><br/>\n     * Suppose the current ProjectStage is {@code UnitTest} and we are looking for the value of {@code datasource}\n     * parameterized by the configured {@code dbvendor}.\n     * </p>\n     * <p>\n     * The first step is to resolve the value of the second property, {@code dbvendor}. This will also take the current\n     * ProjectStage into account. The following lookup is performed:\n     * <ul><li>dbvendor.UnitTest</li></ul>\n     * and if this value is not found then we will do a 2nd lookup for\n     * <ul><li>dbvendor</li></ul></p>\n     *\n     * <p>\n     * If a value was found for the second property (e.g. dbvendor = 'mysql') then we will use its value for the main\n     * lookup. If no value is found for the parameterized key {@code <key>.<second property value>.<project stage>}, we\n     * will do the {@code <key>.<second property value>}, then {@code <key>.<project stage>} and finally a {@code <key>}\n     * lookup:\n     * <ul>\n     * <li>datasource.mysql.UnitTest</li>\n     * <li>datasource.mysql</li>\n     * <li>datasource.UnitTest</li>\n     * <li>datasource</li>\n     * </ul>\n     * </p>\n     *\n     * <p>\n     * <b>Attention</b> This method must only be used after all ConfigSources got registered and it also must not be\n     * used to determine the ProjectStage itself.</p>\n     *\n     * @param key\n     * @param property the property to look up first and use as the parameter for the main lookup\n     *\n     * @return the configured value or null if no value is found for any of the key variants\n     *\n     */\n    public static String getPropertyAwarePropertyValue(String key, String property)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .withCurrentProjectStage(true)\n                .parameterizedBy(property)\n                .evaluateVariables(true)\n                .getValue();\n    }\n\n    /**\n     * {@link #getPropertyAwarePropertyValue(java.lang.String, java.lang.String)} which returns the provided default\n     * value if no configured value can be found (<code>null</code> or empty).\n     *\n     * <p>\n     * <b>Attention</b> This method must only be used after all ConfigSources got registered and it also must not be\n     * used to determine the ProjectStage itself.</p>\n     *\n     * @param key\n     * @param property     the property to look up first and use as the parameter for the main lookup\n     * @param defaultValue fallback value\n     *\n     * @return the configured value or if non found the defaultValue\n     *\n     */\n    public static String getPropertyAwarePropertyValue(String key, String property, String defaultValue)\n    {\n        return getConfigProvider().getConfig().resolve(key)\n                .withCurrentProjectStage(true)\n                .parameterizedBy(property)\n                .withDefault(defaultValue)\n                .evaluateVariables(true)\n                .getValue();\n    }\n\n    /**\n     * Resolve all values for the given key.\n     *\n     * @param key\n     *\n     * @return a List of all found property values, sorted by their ordinal in ascending order\n     *\n     * @see org.apache.deltaspike.core.spi.config.ConfigSource#getOrdinal()\n     */\n    public static List<String> getAllPropertyValues(String key)\n    {\n        ConfigSource[] configSources = getConfigProvider().getConfig().getConfigSources();\n        List<String> result = new ArrayList<String>();\n        for (int i = configSources.length; i > 0; i--)\n        {\n            String value = configSources[i - 1].getPropertyValue(key);\n\n            if (value != null)\n            {\n                value = filterConfigValue(key, value);\n                if (!result.contains(value))\n                {\n                    result.add(value);\n                }\n            }\n        }\n\n        return result;\n\n    }\n\n    /**\n     * Returns a Map of all properties from all scannable config sources. The values of the properties reflect the\n     * values that would be obtained by a call to {@link #getPropertyValue(java.lang.String)}, that is, the value of the\n     * property from the ConfigSource with the highest ordinal.\n     *\n     * @see ConfigSource#isScannable()\n     */\n    public static Map<String, String> getAllProperties()\n    {\n        ConfigSource[] configSources = getConfigProvider().getConfig().getConfigSources();\n        Map<String, String> result = new HashMap<String, String>();\n\n        for (int i = configSources.length; i > 0; i--)\n        {\n            ConfigSource configSource = configSources[i - 1];\n\n            if (configSource.isScannable())\n            {\n                result.putAll(configSource.getProperties());\n            }\n        }\n\n        return Collections.unmodifiableMap(result);\n    }\n\n    public static ConfigSource[] getConfigSources()\n    {\n        return getConfigProvider().getConfig().getConfigSources();\n    }\n\n    /**\n     * Filter the configured value.\n     * This can e.g. be used for decryption.\n     * @return the filtered value\n     */\n    public static String filterConfigValue(String key, String value)\n    {\n        return getConfigProvider().getConfig().filterConfigValue(key, value, false);\n    }\n\n    /**\n     * Filter the configured value for logging.\n     * This can e.g. be used for displaying ***** instead of a real password.\n     * @return the filtered value\n     */\n    public static String filterConfigValueForLog(String key, String value)\n    {\n        return getConfigProvider().getConfig().filterConfigValue(key, value, true);\n    }\n\n    /**\n     * A very simple interface for conversion of configuration values from String to any Java type.\n     *\n     * <p>If a Converter implements the {@link java.lang.AutoCloseable} interface it will automatically\n     * be released when the Config is shut down.</p>\n     * @param <T> The target type of the configuration entry\n     */\n    public interface Converter<T>\n    {\n\n        /**\n         * Returns the converted value of the configuration entry.\n         * @param value The String property value to convert\n         * @return Converted value\n         */\n        T convert(String value);\n    }\n\n    /**\n     * A builder-based typed resolution mechanism for configuration values.\n     * @param <T> The target type of the configuration entry.\n     */\n    public interface TypedResolver<T>\n    {\n\n        /**\n         * Declare the Resolver to return a List of the given Type.\n         * When getting value it will be split on each comma (',') character.\n         * If a comma is contained in the values it must get escaped with a preceding backslash (&quot;\\,&quot;).\n         * Any backslash needs to get escaped via double-backslash (&quot;\\\\&quot;).\n         * Note that in property files this leads to &quot;\\\\\\\\&quot; as properties escape themselves.\n         *\n         * @return a TypedResolver for a list of configured comma separated values\n         *\n         * @since 1.8.0\n         */\n        TypedResolver<List<T>> asList();\n\n        /**\n         * Appends the resolved value of the given property to the key of this builder. This is described in more detail\n         * in {@link ConfigResolver#getPropertyAwarePropertyValue(String, String)}.\n         * @param propertyName The name of the parameter property\n         * @return This builder\n         */\n        TypedResolver<T> parameterizedBy(String propertyName);\n\n        /**\n         * Indicates whether to append the name of the current project stage to the key of this builder. This\n         * is described in more detail in {@link ConfigResolver#getProjectStageAwarePropertyValue(String)}. True by\n         * default.\n         * @param with\n         * @return This builder\n         */\n        TypedResolver<T> withCurrentProjectStage(boolean with);\n\n        /**\n         * Indicates whether the fallback resolution sequence should be performed, as described in\n         * {@link ConfigResolver#getPropertyAwarePropertyValue(String, String)}. This applies only when\n         * {@link #parameterizedBy(String)} or {@link #withCurrentProjectStage(boolean)} is used.\n         * @param strictly\n         * @return This builder\n         */\n        TypedResolver<T> strictly(boolean strictly);\n\n        /**\n         * Sets the default value to use in case the resolution returns null.\n         * @param value the default value\n         * @return This builder\n         */\n        TypedResolver<T> withDefault(T value);\n\n        /**\n         * Sets the default value to use in case the resolution returns null. Converts the given String to the type of\n         * this resolver using the same method as used for the configuration entries.\n         * @param value string value to be converted and used as default\n         * @return This builder\n         */\n        TypedResolver<T> withStringDefault(String value);\n\n        /**\n         * Specify that a resolved value will get cached for a certain amount of time.\n         * After the time expires the next {@link #getValue()} will again resolve the value\n         * from the underlying {@link ConfigResolver}.\n         *\n         * @param timeUnit the TimeUnit for the value\n         * @param value the amount of the TimeUnit to wait\n         * @return This builder\n         */\n        TypedResolver<T> cacheFor(TimeUnit timeUnit, long value);\n\n        /**\n         * Whether to evaluate variables in configured values.\n         * A variable starts with '${' and ends with '}', e.g.\n         * <pre>\n         * mycompany.some.url=${myserver.host}/some/path\n         * myserver.host=http://localhost:8081\n         * </pre>\n         * If 'evaluateVariables' is enabled, the result for the above key\n         * {@code \"mycompany.some.url\"} would be:\n         * {@code \"http://localhost:8081/some/path\"}\n         * @param evaluateVariables whether to evaluate variables in values or not\n         * @return This builder\n         */\n        TypedResolver<T> evaluateVariables(boolean evaluateVariables);\n\n        /**\n         * Whether to log picking up any value changes as INFO.\n         *\n         * @return This builder\n         */\n        TypedResolver<T> logChanges(boolean logChanges);\n\n        /**\n         * A user can register a Callback which gets notified whenever\n         * a config change got detected.\n         * The check is performed on every call to {@link #getValue()}\n         * and also inside {@link Config#snapshotFor(TypedResolver...)}.\n         *\n         * If a change got detected the {@param valueChangedCallback} will\n         * get invoked in a synchronous way before the {@link #getValue()}\n         * or {@link Config#snapshotFor(TypedResolver...)} returns.\n         *\n         * There can only be a single valueChangedCallback.\n         * Using this method multiple times will replace the previously set callback.\n         *\n         * @param valueChangedCallback a lambda or implementation which will get invoked\n         *                             whenever a value change is being detected.\n         * @return This builder\n         */\n        TypedResolver<T> onChange(ConfigChanged<T> valueChangedCallback);\n\n\n        /**\n         * Returns the converted resolved filtered value.\n         * @return the resolved value\n         */\n        T getValue();\n\n        /**\n         * Returns the value from a previously taken {@link ConfigSnapshot}.\n         *\n         * @return the resolved Value\n         * @see Config#snapshotFor(TypedResolver[])\n         * @throws IllegalArgumentException if the {@link ConfigSnapshot} hasn't been resolved\n         *          for this {@link TypedResolver}\n         */\n        T getValue(ConfigSnapshot configSnapshot);\n\n        /**\n         * Returns the key given in {@link #resolve(String)}.\n         * @return the original key\n         */\n        String getKey();\n\n        /**\n         * Returns the actual key which led to successful resolution and corresponds to the resolved value. This applies\n         * only when {@link #parameterizedBy(String)} or {@link #withCurrentProjectStage(boolean)} is used and\n         * {@link #strictly(boolean)} is not used, otherwise the resolved key should always be equal to the original\n         * key. This method is provided for cases, when projectStage-aware and/or parameterized resolution is\n         * requested but the value for such appended key is not found and some of the fallback keys is used, as\n         * described in {@link ConfigResolver#getPropertyAwarePropertyValue(String, String)}.\n         * This should be called only after calling {@link #getValue()} otherwise the value is undefined (but likely\n         * null).\n         * @return\n         */\n        String getResolvedKey();\n\n        /**\n         * Returns the default value provided by {@link #withDefault(Object)} or {@link #withStringDefault(String)}.\n         * Returns null if no default was provided.\n         * @return the default value or null\n         */\n        T getDefaultValue();\n\n    }\n\n    /**\n     * A builder-based optionally typed resolution mechanism for configuration values.\n     * @param <T> This type variable should always be String for UntypedResolver.\n     */\n    public interface UntypedResolver<T> extends TypedResolver<T>\n    {\n        /**\n         * Sets the type of the configuration entry to the given class and returns this builder as a TypedResolver.\n         * Only one of the supported types should be used which includes: Boolean, Class, Integer, Long, Float, Double.\n         * For custom types, see {@link #as(Class, Converter)}.\n         * @param clazz The target type\n         * @param <N> The target type\n         * @return This builder as a TypedResolver\n         */\n        <N> TypedResolver<N> as(Class<N> clazz);\n\n        /**\n         * @param type target type, includes List and Map using a Converter\n         * @param converter The converter for the target type\n         * @param <N> target type\n         * @return this builder typed.\n         */\n        <N> TypedResolver<N> as(Type type, Converter<N> converter);\n\n        /**\n         * Sets the type of the configuration entry to the given class, sets the converter to the one given and\n         * returns this builder as a TypedResolver. If a converter is provided for one of the types supported by\n         * default (see {@link #as(Class)} then the provided converter is used instead of the built-in one.\n         * @param clazz The target type\n         * @param converter The converter for the target type\n         * @param <N> The target type\n         * @return This builder as a TypedResolver\n         */\n        <N> TypedResolver<N> as(Class<N> clazz, Converter<N> converter);\n\n        /**\n         * Use this method if the target type consists of information taken from multiple config keys.\n         * It is similar to {@link #asBean(Class, BiFunction)} but automatically chooses a converter which fits.\n         * The following Beans are supported:\n         * <ul>\n         *     <li>POJO with Constructor parameters. In this case this constructor will be used</li>\n         *     <li>Java14 Records</li>\n         *     <li>POJO with default ct and fields.\n         *          Those fields can use the {@link ConfigProperty} annotation on the fields for more control</li>\n         * </ul>\n         * @param clazz\n         * @param <N>\n         * @return\n         */\n        <N> TypedResolver<N> asBean(Class<N> clazz);\n\n        /**\n         * Set the required Target type and use a converter function which has access to multiple attributes in the configuration.\n         * Use this method if the target type consists of information taken from multiple config keys.\n         * If you consider the following type:\n         * <pre>\n         *  public record ServerEndpoint(String host, Integer port, String path)\n         *\n         *  config.properties:\n         *  myapp.some.server.host=myserver\n         *  myapp.some.server.port=80\n         *  myapp.some.server.path=/myapp/endpoint1\n         *  myapp.other.server.host=otherserver\n         *  myapp.other.server.port=443\n         *  myapp.other.server.path=/otherapp/endpoint2\n         * </pre>\n         *\n         * This function will have access to all the underlying properties by using the given Config.\n         * When resolving the target type the system makes sure that access to all requested properties is atomic.\n         *\n         * @param clazz\n         * @param beanConverter function which gets a starting point (prefix) propertyPath in the configuration.\n         *                      In the examples above it is e.g. \"myapp.some.server.\" and \"myapp.other.server.\"\n         * @return This builder as a TypedResolver\n         */\n        <N> TypedResolver<N> asBean(Class<N> clazz, BiFunction<Config /*this config*/, String /* propertyPath */, N> beanConverter);\n    }\n\n    /**\n     * The entry point to the builder-based optionally typed configuration resolution mechanism.\n     *\n     * String is the default type for configuration entries and is not considered a 'type' by this resolver. Therefore\n     * an UntypedResolver is returned by this method. To convert the configuration value to another type, call\n     * {@link UntypedResolver#as(Class)}.\n     *\n     * @param name The property key to resolve\n     * @return A builder for configuration resolution.\n     */\n    public static UntypedResolver<String> resolve(String name)\n    {\n        return getConfigProvider().getConfig().resolve(name);\n    }\n\n\n    public static ConfigProvider getConfigProvider()\n    {\n        if (configProvider == null)\n        {\n            synchronized (ConfigResolver.class)\n            {\n                if (configProvider == null)\n                {\n                    Iterator<ConfigProvider> configProviders = ServiceLoader.load(ConfigProvider.class).iterator();\n                    if (!configProviders.hasNext())\n                    {\n                        throw new RuntimeException(\"Could not load ConfigProvider\");\n                    }\n                    configProvider = configProviders.next();\n\n                    if (configProviders.hasNext())\n                    {\n                        throw new RuntimeException(\"Found more than one ConfigProvider\");\n                    }\n                }\n            }\n        }\n        return configProvider;\n    }\n\n\n    /**\n     * Provide access to the underlying {@link Config} instance.\n     *\n     */\n    public interface ConfigProvider\n    {\n        /**\n         * Return either an existing Config associated with the current TCCL or a\n         * new Config and associate it with the TCCL.\n         *\n         * @return the Config associated with the current ThreadContextClassLoader\n         */\n        Config getConfig();\n\n        /**\n         * Return either an existing Config associated with the given ClassLoader or a\n         * new Config and associate it with the given ClassLoader.\n         *\n         * @return the Config associated with the given ClassLoader\n         */\n        Config getConfig(ClassLoader cl);\n\n        /**\n         * Release the Config associated with the given ClassLoader.\n         * This will also properly close all the ConfigSources, Converters, etc\n         * managed by this Config.\n         *\n         * ATTENTION: Usually this method doesn't need to be invoked manually!\n         *   It will automatically get invoked in BeforeShutdown via our ConfigExtension internally.\n         */\n        void releaseConfig(ClassLoader cl);\n\n        /**\n         * Provide access to the ConfigHelper\n         */\n        ConfigHelper getHelper();\n    }\n\n    /**\n     * Some utility functions which are useful for implementing own ConfigSources, etc.\n     */\n    public interface ConfigHelper\n    {\n        /**\n         * @return A Set of all the attributes which differ between the old and new config Map\n         *         or an empty Set if there is no difference.\n         */\n        Set<String> diffConfig(Map<String, String> oldValues, Map<String, String> newValues);\n    }\n\n    /**\n     * Callback which can be used with {@link TypedResolver#onChange(ConfigChanged)}\n     */\n    public interface ConfigChanged<T>\n    {\n        void onValueChange(String key, T oldValue, T newValue);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigSnapshot.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\n/**\n * A value holder for TypedResolver values which all got resolved in a guaranteed atomic way.\n *\n * @see Config#snapshotFor(ConfigResolver.TypedResolver[])\n * @see ConfigResolver.TypedResolver#getValue(ConfigSnapshot)\n */\npublic interface ConfigSnapshot\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Configuration.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.concurrent.TimeUnit;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport static java.util.concurrent.TimeUnit.SECONDS;\n\n/**\n * Marker to let DeltaSpike pick this interface and create a proxy getting values\n * from the configuration.\n *\n * The underlying Bean should be normal-scoped.\n */\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\npublic @interface Configuration\n{\n    /**\n     * @return the duration while the value is not reloaded.\n     */\n    long cacheFor() default -1;\n\n    /**\n     * @return the duration unit for {@see cacheFor()}.\n     */\n    TimeUnit cacheUnit() default SECONDS;\n\n    /**\n     * @return the key prefix to apply to all methods.\n     */\n    String prefix() default \"\";\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/DeltaSpikeConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport java.io.Serializable;\n\n/**\n * Marker interface for all classes used for dynamic configuration of DeltaSpike itself. The term <i>Dynamic\n * configuration</i> refers to values which can be determined and changed during runtime and shouldn't be accessed\n * during container boot time.\n *\n * <p>\n * All DeltaSpike dynamic configuration objects implement this interface so they can be found more easily. There is no\n * other functionality implied with this interface.</p>\n *\n * <p>\n * DeltaSpike uses a <i>type-safe configuration</i> approach for most internal configuration. Instead of writing a\n * properties file or XML, you just implement one of the configuration interfaces which will then be picked up as a\n * CDI bean. If* there is already a default configuration for some functionality in DeltaSpike, you can use &#064;\n * Specializes or &#064;Alternative to change those.</p>\n *\n * <p>\n * See {@link org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig} for static DeltaSpike configuration\n * based on properties.</p>\n *\n */\npublic interface DeltaSpikeConfig extends Serializable\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Filter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Marker to let DeltaSpike pick automatically the decorated instance\n * as a ConfigFilter of current CDI module.\n *\n * The underlying Bean should be normal-scoped.\n */\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\n@Documented\npublic @interface Filter\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/PropertyFileConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\n/**\n * <p>\n * If you implement this interface, the property files with the given file name will be registered as\n * {@link org.apache.deltaspike.core.spi.config.ConfigSource}s.</p>\n *<p>There are 2 ways to register a {@code PropertyFileConfig}</p>\n *\n * <h3>1. Automatic pickup via {@code ProcessAnnotatedType} phase</h3>\n * <p>\n * DeltaSpike will automatically pick up all the implementations which are\n * inside a Bean Archive (a JAR or ClassPath entry with a META-INF/beans.xml file) during the\n * {@link jakarta.enterprise.inject.spi.ProcessAnnotatedType} phase and create a new instance via reflection. Thus the\n * implementations will need a non-private default constructor. There is <b>no</b> CDI injection being performed in\n * those instances! The scope of the implementations will also be ignored as they will not get picked up as CDI\n * beans.</p>\n *\n * <p>\n * Please note that the configuration will only be available after the boot is finished. This means that you cannot use\n * this configuration inside a CDI Extension before the boot is finished!</p>\n *\n * <p><b>Attention:</b> When using this logic inside an EAR then you might get\n * different behaviour depending on the Java EE\n * server you are using. Some EE container use a different ClassLoader to bootstrap\n * the application than later to serve Requests.\n * In that case we would register the ConfigSources on the <em>wrong</em> ConfigResolver\n * (means we register it to the wrong ClassLoader). If you did hit such an application server\n * then you might need to switch back to manually register the\n * {@link org.apache.deltaspike.core.spi.config.ConfigSource} or\n * {@link org.apache.deltaspike.core.spi.config.ConfigSourceProvider} via the\n * {@link java.util.ServiceLoader} mechanism described there.</p>.\n *\n * <h3>2. Automatic pickup via {@code java.util.ServiceLoader} mechanism</h3>\n * <p>In case you have an EAR or you need the configured values already during the CDI container start\n * then you can also register the PropertyFileConfig via the {@code java.util.ServiceLoader} mechanism.\n * To not have this configuration picked up twice it is required to annotate your own\n * {@code PropertyFileConfig} implementation with {@link org.apache.deltaspike.core.api.exclude.Exclude}.</p>\n *\n * <p>The {@code ServiceLoader} mechanism requires to have a file\n * <pre>\n *     META-INF/services/org.apache.deltaspike.core.api.config.PropertyFileConfig\n * </pre>\n * containing the fully qualified Class name of your own {@code PropertyFileConfig} implementation class.\n * <pre>\n *     com.acme.my.own.SomeSpecialPropertyFileConfig\n * </pre>\n * The implementation will look like the following:\n * <pre>\n *     &#064;Exclude\n *     public class SomeSpecialPropertyFileConfig implements PropertyFileConfig {\n *         public String getPropertyFileName() {\n *             return \"myconfig/specialconfig.properties\"\n *         }\n *         public boolean isOptional() {\n *             return false;\n *         }\n *     }\n * </pre>\n * </p>\n *\n */\npublic interface PropertyFileConfig\n{\n    /**\n     * All the property files on the classpath which have this name will get picked up and registered as\n     * {@link org.apache.deltaspike.core.spi.config.ConfigSource}.\n     *\n     * If the the returned String starts with 'file://' then we pick up the configuration from a file\n     * on the File System instead of the ClassPath.\n     * The same works for other URLs which are passed, e.g. 'http://'.\n     * Note that reading the property values only gets performed once right now.\n     *\n     * @return the full file name (including path) of the property files to pick up.\n     */\n    String getPropertyFileName();\n\n    /**\n     * @return true if the file is optional, false if the specified file has to be in place.\n     */\n    boolean isOptional();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/PropertyLoader.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.Enumeration;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * Utility class to load configuration properties via arbitrary property files in a well defined order.\n *\n * <p>\n * This will also pick up property files with names suffixed with {@code -<project stage>}, e.g.\n * myconfig-Production.properties.</p>\n * <p>\n * User configurations should have {@code deltaspike_ordinal} as the first property, with a value greater than\n * 100.</p>\n *\n */\npublic class PropertyLoader\n{\n    public static final int CONFIGURATION_ORDINAL_DEFAULT_VALUE = 100;\n\n\n    private static final String FILE_EXTENSION = \".properties\";\n\n\n    private static final Logger LOG = Logger.getLogger(PropertyLoader.class.getName());\n\n\n    private PropertyLoader()\n    {\n        // utility class doesn't have a public ct\n    }\n\n    /**\n     * Looks for all properties files with the given name in the classpath, loads them in ascending order determined by\n     * their ordinal and merges them.\n     *\n     * <p>\n     * The idea is to be able to override properties by just providing a new properties file with the same name but a\n     * higher 'deltaspike_ordinal' than the old one.</p>\n     *\n     * <p>\n     * If a property file defines no 'deltaspike_ordinal' property than a default value of\n     * {@link #CONFIGURATION_ORDINAL_DEFAULT_VALUE} is assumed. Any sensitive default which is provided by the system\n     * parsing for the configuration should have a 'deltaspike_ordinal' value lower than 10. In most cases a value of\n     * 1.</p>\n     *\n     * <p>\n     * If two property files have the same 'deltaspike_ordinal', their order is undefined. The Properties file which\n     * gets found first will be processed first and thus gets overwritten by the one found later.</p>\n     *\n     * @param propertyFileName the name of the properties file, without the extension '.properties'\n     *\n     * @return the final property values\n     */\n    public static synchronized Properties getProperties(String propertyFileName)\n    {\n        if (propertyFileName == null)\n        {\n            throw new IllegalArgumentException(\"propertyFileName must not be null!\");\n        }\n\n        try\n        {\n            if (propertyFileName.endsWith(FILE_EXTENSION))\n            {\n                // if the given propertyFileName already contains the extension, then remove it.\n                propertyFileName = propertyFileName.substring(0, propertyFileName.length() - FILE_EXTENSION.length());\n            }\n\n            List<Properties> allProperties = loadAllProperties(propertyFileName);\n            if (allProperties == null)\n            {\n                return null;\n            }\n            \n            List<Properties> sortedProperties = sortProperties(allProperties);\n            Properties properties = mergeProperties(sortedProperties);\n            return properties;\n        }\n        catch (IOException e)\n        {\n            LOG.log(Level.SEVERE, \"Error while loading the propertyFile \" + propertyFileName, e);\n            return null;\n        }\n    }\n\n    private static List<Properties> loadAllProperties(String propertyFileName)\n        throws IOException\n    {\n        ClassLoader cl = ClassUtils.getClassLoader(null);\n\n        List<Properties> properties = new ArrayList<Properties>();\n\n        // read the normal property file names\n        Enumeration<URL> propertyUrls = cl.getResources(propertyFileName + FILE_EXTENSION);\n        while (propertyUrls != null && propertyUrls.hasMoreElements())\n        {\n            URL propertyUrl = propertyUrls.nextElement();\n            fillProperties(properties, propertyUrl);\n        }\n\n        // and also read the ones post-fixed with the projectStage\n        ProjectStage ps = ProjectStageProducer.getInstance().getProjectStage();\n\n        propertyUrls = cl.getResources(propertyFileName + \"-\" + ps + FILE_EXTENSION);\n        while (propertyUrls != null && propertyUrls.hasMoreElements())\n        {\n            URL propertyUrl = propertyUrls.nextElement();\n            fillProperties(properties, propertyUrl);\n        }\n\n        if (properties.isEmpty())\n        {\n            if (LOG.isLoggable(Level.INFO))\n            {\n                LOG.info(\"could not find any property files with name \" + propertyFileName);\n            }\n\n            return null;\n        }\n\n        return properties;\n    }\n\n    private static void fillProperties(List<Properties> properties, URL propertyUrl) throws IOException\n    {\n        InputStream is = null;\n        try\n        {\n            is = propertyUrl.openStream();\n            Properties prop = new Properties();\n            prop.load(is);\n            properties.add(prop);\n\n            // a bit debugging output\n            int ordinal = getConfigurationOrdinal(prop);\n            if (LOG.isLoggable(Level.FINE))\n            {\n                LOG.fine(\"loading properties with ordinal \" + ordinal + \" from file \" + propertyUrl.getFile());\n            }\n        }\n        finally\n        {\n            if (is != null)\n            {\n                is.close();\n            }\n        }\n    }\n\n    /**\n     * Implement a quick and dirty sorting mechanism for the given Properties.\n     * @param allProperties\n     * @return the Properties list sorted by it's 'configuration.ordinal' in ascending order.\n     */\n    private static List<Properties> sortProperties(List<Properties> allProperties)\n    {\n        List<Properties> sortedProperties = new ArrayList<Properties>();\n        for (Properties p : allProperties)\n        {\n            int configOrder = getConfigurationOrdinal(p);\n\n            int i;\n            for (i = 0; i < sortedProperties.size(); i++)\n            {\n                int listConfigOrder = getConfigurationOrdinal(sortedProperties.get(i));\n                if (listConfigOrder > configOrder)\n                {\n                    // only go as far as we found a higher priority Properties file\n                    break;\n                }\n            }\n            sortedProperties.add(i, p);\n        }\n        return sortedProperties;\n    }\n\n    /**\n     * Determine the 'deltaspike_ordinal' of the given properties.\n     * {@link #CONFIGURATION_ORDINAL_DEFAULT_VALUE} if\n     * {@link ConfigSource#DELTASPIKE_ORDINAL} is not set in the\n     * Properties file.\n     *\n     * @param p the Properties from the file.\n     * @return the ordinal number of the given Properties file.\n     */\n    private static int getConfigurationOrdinal(Properties p)\n    {\n        int configOrder = CONFIGURATION_ORDINAL_DEFAULT_VALUE;\n\n        String configOrderString = p.getProperty(ConfigSource.DELTASPIKE_ORDINAL);\n        if (configOrderString != null && configOrderString.length() > 0)\n        {\n            try\n            {\n                configOrder = Integer.parseInt(configOrderString);\n            }\n            catch (NumberFormatException nfe)\n            {\n                LOG.severe(ConfigSource.DELTASPIKE_ORDINAL + \" must be an integer value!\");\n                throw nfe;\n            }\n        }\n\n        return configOrder;\n    }\n\n    /**\n     * Merge the given Properties in order of appearance.\n     * @param sortedProperties\n     * @return the merged Properties\n     */\n    private static Properties mergeProperties(List<Properties> sortedProperties)\n    {\n        Properties mergedProperties = new Properties();\n        for (Properties p : sortedProperties)\n        {\n            for (Map.Entry<?, ?> entry : p.entrySet())\n            {\n                String key = (String) entry.getKey();\n                String value = (String) entry.getValue();\n\n                if (!ConfigSource.DELTASPIKE_ORDINAL.equals(key))\n                {\n                    // simply overwrite the old properties with the new ones.\n                    mergedProperties.setProperty(key, value);\n                }\n            }\n        }\n\n        return mergedProperties;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Source.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Marker to let DeltaSpike pick automatically the decorated instance\n * as a ConfigSource of current CDI module.\n *\n * The underlying Bean should be normal-scoped.\n */\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\n@Documented\npublic @interface Source\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/base/CoreBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.base;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\n\nimport java.util.concurrent.TimeUnit;\n\npublic interface CoreBaseConfig extends DeltaSpikeBaseConfig\n{\n    interface BeanManagerIntegration\n    {\n        /**\n         * Whether to use CDI.current() if available.\n         * This might fail in some CDI containers in some situations.\n         * Try switching to 'false' to enforce the 'old' DeltaSpike BeanManager lookup.\n         */\n        Boolean DELEGATE_LOOKUP =\n                ConfigResolver.resolve(\"deltaspike.bean-manager.delegate_lookup\")\n                        .as(Boolean.class)\n                        .withCurrentProjectStage(true)\n                        .withDefault(Boolean.TRUE)\n                        .getValue();\n    }\n\n    interface MBeanIntegration\n    {\n        Boolean AUTO_UNREGISTER =\n                ConfigResolver.resolve(\"deltaspike.mbean.auto-unregister\")\n                        .as(Boolean.class)\n                        .withCurrentProjectStage(true)\n                        .withDefault(Boolean.TRUE)\n                        .getValue();\n    }\n\n    interface ScopeCustomization\n    {\n        interface WindowRestriction\n        {\n            String MAX_COUNT_KEY = \"deltaspike.scope.window.max-count\";\n\n            Integer MAX_COUNT =\n                    ConfigResolver.resolve(MAX_COUNT_KEY)\n                            .as(Integer.class)\n                            .withCurrentProjectStage(true)\n                            .withDefault(1024)\n                            .getValue();\n        }\n    }\n\n    interface TimeoutCustomization\n    {\n        Integer FUTUREABLE_TERMINATION_TIMEOUT_IN_MILLISECONDS =\n                ConfigResolver.resolve(\"deltaspike.futureable.termination-timeout_in_milliseconds\")\n                        .as(Integer.class)\n                        .withCurrentProjectStage(true)\n                        .withDefault((int) TimeUnit.MINUTES.toMillis(1))\n                        .getValue();\n    }\n\n    interface ParentExtensionCustomization\n    {\n        Boolean PARENT_EXTENSION_ENABLED =\n                ConfigResolver.resolve(\"deltaspike.parent.extension.enabled\")\n                        .as(Boolean.class)\n                        .withCurrentProjectStage(true)\n                        .withDefault(Boolean.FALSE)\n                        .getValue();\n    }\n\n    interface InterDynCustomization\n    {\n        /**\n         * All interdyn rules start with this prefix and contains a 'match' and a 'annotation' part.\n         * The 'match' is a regular expression which depicts the classes which should get annotated.\n         * The 'annotation' is the annotation name which should get applied to all the classes which\n         * match the 'match' regexp.\n         *\n         * A sample config might look like:\n         * <pre>\n         * deltaspike.interdyn.rule.1.match=com\\.mycorp\\..*Service.*\n         * deltaspike.interdyn.rule.1.annotation=org.apache.deltaspike.core.api.monitoring.InvocationMonitored\n         * </pre>\n         */\n        String INTERDYN_RULE_PREFIX = \"deltaspike.interdyn.rule.\";\n\n        /**\n         * Whether the InterDyn feature is enabled or not.\n         *\n         * If the feature is enabled at startup then we will apply the interceptors dynamically\n         * to all the matching classes.\n         * Otherwise we will skip the instrumentation.\n         */\n        ConfigResolver.TypedResolver<Boolean> INTERDYN_ENABLED =\n                ConfigResolver.resolve(\"deltaspike.interdyn.enabled\")\n                        .as(Boolean.class)\n                        .withCurrentProjectStage(true)\n                        .withDefault(Boolean.FALSE);\n\n        /**\n         * Set this configuration to 'false' (case sensitive string) to disable the built-in InvocationResultLogger\n         */\n        String CONFIG_INVOCATIONRESULTLOGGER_ENABLED = \"deltaspike.invocationresultlogger.enabled\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/base/DeltaSpikeBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.base;\n\n/**\n * Marker interface for all classes used for static configuration of DeltaSpike itself. The term <i>Static\n * configuration</i> refers to values which are set using DeltaSpike's configuration mechanism (e.g. in {@code\n * META-INF/apache-deltaspike.properties}) and remain fixed during runtime and can be accessed even during container\n * boot time.\n *\n * <p>\n * All DeltaSpike static configuration objects implement this interface so they can be found more easily. There is no\n * other functionality implied with this interface.</p>\n */\npublic interface DeltaSpikeBaseConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/DefaultErrorView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view;\n\n/**\n * Abstract class which marks an error view.\n *\n * It's an abstract class instead of an interface, because it can be used for navigation (which is restricted to\n * classes).\n */\npublic abstract class DefaultErrorView implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/ViewConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view;\n\n/**\n * Marker interface for type-safe view-config classes. Required for view-configs which represent a (logical) page and\n * optional for the rest (e.g. folder-configs).\n */\npublic interface ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/ViewRef.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view;\n\nimport org.apache.deltaspike.core.api.literal.ViewControllerRefLiteral;\nimport org.apache.deltaspike.core.api.config.view.metadata.InlineViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.InlineMetaDataTransformer;\nimport org.apache.deltaspike.core.spi.config.view.TargetViewConfigProvider;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Named;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * A reference to a view-config, applied on a view-controller. The opposite direction of {@link ViewControllerRef}.\n *\n * ViewRef annotation instances are not present at runtime as metadata, they are instead transformed to\n * ViewControllerRef instances during deployment.\n */\n\n@Target({ TYPE, METHOD })\n@Retention(RUNTIME)\n@Documented\n\n@InlineViewMetaData(\n        targetViewConfigProvider = ViewRef.ViewRefTargetViewConfigProvider.class,\n        inlineMetaDataTransformer = ViewRef.ViewRefInlineMetaDataTransformer.class)\npublic @interface ViewRef\n{\n    abstract class Manual implements ViewConfig\n    {\n    }\n\n    /**\n     * Specifies the views to bind to the view-controller.\n     *\n     * @return {@link ViewConfig}s of views bound to the view-controller\n     */\n    @Nonbinding Class<? extends ViewConfig>[] config();\n\n    class ViewRefTargetViewConfigProvider implements TargetViewConfigProvider<ViewRef>\n    {\n        @Override\n        public Class<? extends ViewConfig>[] getTarget(ViewRef inlineMetaData)\n        {\n            return inlineMetaData.config();\n        }\n    }\n\n    class ViewRefInlineMetaDataTransformer implements InlineMetaDataTransformer<ViewRef, ViewControllerRef>\n    {\n        @Override\n        public ViewControllerRef convertToViewMetaData(ViewRef inlineMetaData, Class<?> sourceClass)\n        {\n\n            Named named = sourceClass.getAnnotation(Named.class);\n\n            String beanName;\n            if (named == null)\n            {\n                beanName = null;\n            }\n            else\n            {\n                beanName = named.value();\n            }\n            return new ViewControllerRefLiteral(sourceClass, beanName);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/controller/InitView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.controller;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Callback annotation for view-controllers. Methods annotated with this annotation will be invoked as soon as a view\n * has been initialized.\n */\n@Target(METHOD)\n@Retention(RUNTIME)\n@Documented\npublic @interface InitView\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/controller/PostRenderView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.controller;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Callback annotation for view-controllers. Methods annotated with this annotation will be invoked after the view gets\n * rendered.\n */\n@Target(METHOD)\n@Retention(RUNTIME)\n@Documented\npublic @interface PostRenderView\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/controller/PreRenderView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.controller;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Callback annotation for view-controllers. Methods annotated with this annotation will be invoked before the view gets\n * rendered.\n */\n@Target(METHOD)\n@Retention(RUNTIME)\n@Documented\npublic @interface PreRenderView\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/controller/PreViewAction.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.controller;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Callback annotation for view-controllers. Methods annotated with this annotation will be invoked before the method\n * binding gets invoked. Can be used as a callback in a view-controller in parallel with 3rd party flow-engines.\n */\n@Target(METHOD)\n@Retention(RUNTIME)\n@Documented\npublic @interface PreViewAction\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/controller/ViewControllerRef.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.controller;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.SimpleCallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Specifies one or more view-controllers for the view-config which has this annotation applied. View-controllers can\n * handle callbacks like {@link InitView}, {@link PreRenderView}, etc.\n */\n//don't use @Inherited\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData(preProcessor = ViewControllerRef.AnnotationPreProcessor.class)\npublic @interface ViewControllerRef\n{\n    /**\n     * Class of the view-controller.\n     *\n     * @return class of the view-controller\n     */\n    Class<?> value();\n\n    /**\n     * Currently not implemented. \n     * Optional name of the view-controller.\n     *\n     * @return name of the view-controller\n     */\n    //TODO\n    String name() default \"\";\n\n    class AnnotationPreProcessor implements ConfigPreProcessor<ViewControllerRef>\n    {\n        @Override\n        public ViewControllerRef beforeAddToConfig(ViewControllerRef metaData, ViewConfigNode viewConfigNode)\n        {\n            viewConfigNode.registerCallbackDescriptors(\n                    ViewControllerRef.class, new Descriptor(metaData.value(), InitView.class));\n            viewConfigNode.registerCallbackDescriptors(\n                    ViewControllerRef.class, new Descriptor(metaData.value(), PreViewAction.class));\n            viewConfigNode.registerCallbackDescriptors(\n                    ViewControllerRef.class, new Descriptor(metaData.value(), PreRenderView.class));\n            viewConfigNode.registerCallbackDescriptors(\n                    ViewControllerRef.class, new Descriptor(metaData.value(), PostRenderView.class));\n            return metaData; //no change needed\n        }\n    }\n\n    //not needed outside\n    class Descriptor extends SimpleCallbackDescriptor<Void>\n    {\n        protected Descriptor(Class<?> beanClass, Class<? extends Annotation> callbackType)\n        {\n            super(beanClass, callbackType);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/Aggregated.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Marks view-metadata annotations or their fields as aggregated metadata. That results in retention of multiple\n * instances of such annotation per view instead of the metadata getting overriden by lower levels.\n *\n * Core just provides this annotation, but the concrete behaviour is defined by a concrete ConfigNodeConverter. E.g.\n * DefaultConfigNodeConverter uses the result stored in\n * {@link org.apache.deltaspike.core.spi.config.view.ViewConfigNode#getInheritedMetaData} to replace default- (/ null-)\n * values of \"higher\" levels with custom values of \"lower\" levels, if #value is 'true'.\n */\n//TODO re-visit and discuss method-level (for annotation-attributes)\n@Target({ ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\npublic @interface Aggregated\n{\n    /**\n     * @return false to override the same metadata type of the parent view-config, and true to allow multiple instances\n     *         of a metadata per view\n     */\n    boolean value();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/CallbackDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\n\nimport jakarta.inject.Named;\nimport java.beans.Introspector;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * Basic descriptor for a given class and callback type. It finds and caches the method(s) of the given class which are\n * annotated with the given callback-type.\n */\npublic abstract class CallbackDescriptor\n{\n    protected List<CallbackEntry> callbacks = new ArrayList<CallbackEntry>();\n    protected Class<? extends Annotation> callbackType;\n\n    protected CallbackDescriptor(Class<?> beanClass, Class<? extends Annotation> callbackMarker)\n    {\n        init(new Class[]{beanClass}, callbackMarker);\n    }\n\n    protected CallbackDescriptor(Class<?>[] beanClasses, Class<? extends Annotation> callbackMarker)\n    {\n        init(beanClasses, callbackMarker);\n    }\n\n    protected void init(Class<?>[] targetBeanClasses, Class<? extends Annotation> callbackMarker)\n    {\n        if (callbackMarker == null)\n        {\n            callbackMarker = DefaultCallback.class;\n        }\n\n        this.callbackType = callbackMarker;\n\n        //TODO discuss how deep we should scan\n        for (Class<?> targetBeanClass : targetBeanClasses)\n        {\n            CallbackEntry callbackEntry = new CallbackEntry(targetBeanClass, callbackMarker);\n            if (!callbackEntry.callbackMethods.isEmpty())\n            {\n                this.callbacks.add(callbackEntry);\n            }\n        }\n    }\n\n    public Map<Class<?>, List<Method>> getCallbackMethods()\n    {\n        Map<Class<?>, List<Method>> result = new HashMap<Class<?>, List<Method>>(this.callbacks.size());\n\n        for (CallbackEntry callbackEntry : this.callbacks)\n        {\n            result.put(callbackEntry.targetBeanClass, new ArrayList<Method>(callbackEntry.callbackMethods));\n        }\n        return result;\n    }\n\n    protected <T> T getTargetObject(Class<T> targetType)\n    {\n        return BeanProvider.getContextualReference(targetType, true);\n    }\n\n    protected Object getTargetObjectByName(String beanName)\n    {\n        return BeanProvider.getContextualReference(beanName, true);\n    }\n\n    public boolean isBoundTo(Class<? extends Annotation> callbackType)\n    {\n        return this.callbackType.equals(callbackType);\n    }\n\n    protected static class CallbackEntry\n    {\n        private List<Method> callbackMethods = new ArrayList<Method>();\n        private final Class<?> targetBeanClass;\n        private final String beanName;\n\n        private CallbackEntry(Class<?> beanClass, Class<? extends Annotation> callbackMarker)\n        {\n            this.targetBeanClass = beanClass;\n\n            Named named = this.targetBeanClass.getAnnotation(Named.class);\n\n            if (named != null && !\"\".equals(named.value()))\n            {\n                this.beanName = named.value();\n            }\n            else\n            {\n                //fallback to the default (which might exist) -> TODO check meta-data of Bean<T>\n                this.beanName = Introspector.decapitalize(targetBeanClass.getSimpleName());\n            }\n\n            List<String> processedMethodNames = new ArrayList<String>();\n\n            findMethodWithCallbackMarker(callbackMarker, beanClass, processedMethodNames);\n        }\n\n        private void findMethodWithCallbackMarker(Class<? extends Annotation> callbackMarker,\n                                                  Class<?> classToAnalyze,\n                                                  List<String> processedMethodNames)\n        {\n            Class<?> currentClass = classToAnalyze;\n\n            while (currentClass != null && !Object.class.getName().equals(currentClass.getName()))\n            {\n                for (Method currentMethod : currentClass.getDeclaredMethods())\n                {\n                    //don't process overridden methods\n                    //ds now allows callbacks with parameters -> TODO refactor this approach\n                    if (processedMethodNames.contains(currentMethod.getName()))\n                    {\n                        continue;\n                    }\n\n                    if (currentMethod.isAnnotationPresent(callbackMarker))\n                    {\n                        processedMethodNames.add(currentMethod.getName());\n\n                        if (Modifier.isPrivate(currentMethod.getModifiers()))\n                        {\n                            throw new IllegalStateException(\n                                \"Private methods aren't supported to avoid side-effects with normal-scoped CDI beans.\" +\n                                    \" Please use e.g. protected or public instead. \");\n                        }\n\n                        currentMethod.setAccessible(true);\n                        this.callbackMethods.add(currentMethod);\n                    }\n                }\n\n                //scan interfaces\n                for (Class<?> interfaceClass : currentClass.getInterfaces())\n                {\n                    findMethodWithCallbackMarker(callbackMarker, interfaceClass, processedMethodNames);\n                }\n\n                currentClass = currentClass.getSuperclass();\n            }\n        }\n\n        public List<Method> getCallbackMethods()\n        {\n            return callbackMethods;\n        }\n\n        public Class<?> getTargetBeanClass()\n        {\n            return targetBeanClass;\n        }\n\n        public String getBeanName()\n        {\n            return beanName;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/ConfigDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\n\n/**\n * Base descriptor for all type-safe view-configs which describes the config class, metadata, callbacks and other\n * properties of a view-config.\n *\n * @param <CT> class of the view-config\n */\npublic interface ConfigDescriptor<CT>\n{\n    Class<? extends CT> getConfigClass();\n\n    /**\n     * Metadata configured for this view-config. Resolves {@link ViewMetaData}-annotated annotations which are inherited\n     * or directly present on the view-config class.\n     *\n     * @return metadata of this view-config\n     */\n    List<Annotation> getMetaData();\n\n    /**\n     * Metadata which is configured for this view-config. Resolves {@link ViewMetaData}-annotated annotations which are\n     * inherited or directly present on the view-config class.\n     *\n     * @param target target type\n     *\n     * @return custom metadata for the given type of this view-config\n     */\n    <T extends Annotation> List<T> getMetaData(Class<T> target);\n\n    /**\n     * Callbacks which are configured for this view-config and bound to the given metadata type.\n     *\n     * @param metaDataType type of the metadata (e.g. ViewControllerRef.class)\n     *\n     * @return descriptor for the callback or null if there is no callback method\n     */\n    CallbackDescriptor getCallbackDescriptor(Class<? extends Annotation> metaDataType);\n\n    /**\n     * Callbacks which are configured for this view-config and bound to the given metadata type.\n     *\n     * @param metaDataType type of the metadata (e.g. ViewControllerRef.class)\n     * @param callbackType type of the callback (e.g. PreRenderView.class)\n     *\n     * @return descriptor for the callback null if there is no callback-method\n     */\n    CallbackDescriptor getCallbackDescriptor(Class<? extends Annotation> metaDataType,\n                                             Class<? extends Annotation> callbackType);\n\n    /**\n     * Callbacks which are configured for this view-config and bound to the given metadata type.\n     *\n     * @param metaDataType type of the metadata (e.g. ViewControllerRef.class)\n     * @param executorType type of the executor which returns a typed result (e.g. Secured.Descriptor)\n     *\n     * @return executable descriptor for the callback or null if there is no callback method\n     */\n    @SuppressWarnings(\"rawtypes\")\n    //TODO <T extends ExecutableCallbackDescriptor<?>> when major version is incremented\n    <T extends ExecutableCallbackDescriptor> T getExecutableCallbackDescriptor(Class<? extends Annotation> metaDataType,\n                                                                               Class<? extends T> executorType);\n\n    /**\n     * Callbacks which are configured for this view-config and bound to the given metadata type.\n     *\n     * @param metaDataType type of the metadata (e.g. ViewControllerRef.class)\n     * @param callbackType type of the callback (e.g. PreRenderView.class)\n     * @param executorType type of the executor which returns a typed result (e.g. Secured.Descriptor)\n     *\n     * @return executable descriptor for the callback or null if there is no callback method\n     */\n    @SuppressWarnings(\"rawtypes\")\n    //TODO <T extends ExecutableCallbackDescriptor<?>> when major version is incremented\n    <T extends ExecutableCallbackDescriptor> T getExecutableCallbackDescriptor(Class<? extends Annotation> metaDataType,\n                                                                               Class<? extends Annotation> callbackType,\n                                                                               Class<? extends T> executorType);\n\n    /**\n     * Returns the string representation of the resource (page, folder) represented by this view-config.\n     *\n     * @return relative path to the folder or page\n     */\n    String getPath();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/DefaultCallback.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * A ConfigDescriptor can contain CallbackDescriptors or ExecutableCallbackDescriptors. An ExecutableCallbackDescriptor\n * can reference one or more callback method(s). If there is only one callback type, it's possible to annotate it with\n * {@code @DefaultCallback}. That eliminates the need for a special marker annotation for the target method.\n *\n * If there are multiple callback types, it's necessary to use custom annotations as marker for the target method (e.g.\n * see {@code @Secured} vs. {@code @ViewControllerRef}).\n *\n * <pre>\n * {@code\n * ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SomePage.class);\n *\n * viewConfigDescriptor.getExecutableCallbackDescriptor(\n *   Secured.class, Secured.Descriptor.class).execute(accessDecisionVoterContext);\n * }</pre> is short for\n * <pre>\n * {@code\n * viewConfigDescriptor.getExecutableCallbackDescriptor(\n *   Secured.class, DefaultCallback.class, Secured.Descriptor.class).execute(accessDecisionVoterContext);\n * }</pre>\n *\n * whereas e.g.\n * <pre>\n * {@code\n * viewConfigDescriptor.getExecutableCallbackDescriptor(\n *   ViewControllerRef.class, PreRenderView.class, ViewControllerRef.Descriptor.class).execute();\n * }</pre> or just\n * <pre>\n * {@code\n * viewConfigDescriptor.getExecutableCallbackDescriptor(\n *   ViewControllerRef.class, PreRenderView.class, SimpleCallbackDescriptor.class).execute();\n * }</pre> are needed to call @PreRenderView callbacks specifically (instead of the others like @InitView which are also\n * bound to @ViewControllerRef).\n */\n//TODO find a better name\n@Target( METHOD )\n@Retention(RUNTIME)\n@Documented\npublic @interface DefaultCallback \n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/ExecutableCallbackDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Specialized {@link CallbackDescriptor} which provides {@link #execute} only for concrete descriptors, but doesn't\n * expose it (and can't get used by accident). Concrete implementations can provide type-safe versions of it, but\n * delegate the final execution to {@link #execute}.\n *\n * @param <R> return type\n */\npublic abstract class ExecutableCallbackDescriptor<R> extends CallbackDescriptor\n{\n    protected ExecutableCallbackDescriptor(Class<?> beanClass, Class<? extends Annotation> callbackMarker)\n    {\n        super(beanClass, callbackMarker);\n    }\n\n    protected ExecutableCallbackDescriptor(Class<?>[] beanClasses, Class<? extends Annotation> callbackMarker)\n    {\n        super(beanClasses, callbackMarker);\n    }\n\n    protected List<R> execute(Object... parameters)\n    {\n        List<R> results = new ArrayList<R>();\n        for (CallbackEntry callbackEntry : this.callbacks)\n        {\n            for (Method callbackMethod : callbackEntry.getCallbackMethods())\n            {\n                try\n                {\n                    Class<?> targetBeanClass = callbackEntry.getTargetBeanClass();\n                    Object bean = getTargetObject(targetBeanClass);\n\n                    if (bean == null)\n                    {\n                        String beanName = callbackEntry.getBeanName();\n                        bean = getTargetObjectByName(beanName);\n\n                        if (bean == null)\n                        {\n                            throw new IllegalStateException(\"Can't find bean by type \" + targetBeanClass +\n                                \" or by name: \" + beanName);\n                        }\n                    }\n\n                    @SuppressWarnings(\"unchecked\")\n                    R result = (R) callbackMethod.invoke(bean, parameters);\n\n                    if (result != null)\n                    {\n                        results.add(result);\n                    }\n                }\n                catch (Exception e)\n                {\n                    if (e instanceof InvocationTargetException)\n                    {\n                        ExceptionUtils.throwAsRuntimeException(e.getCause());\n                    }\n                    ExceptionUtils.throwAsRuntimeException(e);\n                }\n            }\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/InlineViewMetaData.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport org.apache.deltaspike.core.spi.config.view.InlineMetaDataTransformer;\nimport org.apache.deltaspike.core.spi.config.view.TargetViewConfigProvider;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Provides the ability to apply metadata to a view-config \"remotely\" &ndash; from a\n * different place than the view-config itself (and with different syntax and a different annotation).\n *\n * <p>\n * <b>For example</b>, the @ViewControllerRef (main) vs. @ViewRef (inline) &ndash; the @ViewControllerRef is applied\n * directly on a view-config and references a view-controller, but there's also @ViewRef, which has the same purpose,\n * but is applied in reverse &ndash; on a view-controller, referencing a view-config.\n * </p>\n */\n\n@Target({ ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n\npublic @interface InlineViewMetaData\n{\n    Class<? extends TargetViewConfigProvider<?>> targetViewConfigProvider();\n\n    @SuppressWarnings(\"rawtypes\")\n    Class<? extends InlineMetaDataTransformer> inlineMetaDataTransformer() default InlineMetaDataTransformer.class;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/SimpleCallbackDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\n\n/**\n * {@link ExecutableCallbackDescriptor} for simple callback methods without (supported) parameters, which exposes\n * #execute without parameters.\n *\n * @param <R> return type\n */\npublic abstract class SimpleCallbackDescriptor<R> extends ExecutableCallbackDescriptor<R>\n{\n    protected SimpleCallbackDescriptor(Class<?> beanClass, Class<? extends Annotation> callbackMarker)\n    {\n        super(beanClass, callbackMarker);\n    }\n\n    protected SimpleCallbackDescriptor(Class<?>[] beanClasses, Class<? extends Annotation> callbackMarker)\n    {\n        super(beanClasses, callbackMarker);\n    }\n\n    public List<R> execute()\n    {\n        return super.execute();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/SkipMetaDataMerge.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Disables metadata merging on attributes of @ViewMetaData annotations. Used in cases (e.g. @Folder#name) where it\n * doesn't make sense to merge that part with inherited information.\n */\n@Target( METHOD )\n@Retention(RUNTIME)\n@Documented\npublic @interface SkipMetaDataMerge\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/ViewConfigDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n/**\n * Descriptor which represents a concrete view (page).\n */\npublic interface ViewConfigDescriptor extends ConfigDescriptor<ViewConfig>\n{\n    /**\n     * View ID of the current descriptor. The default implementation returns the same as ConfigDescriptor#getPath. For\n     * the default implementation (and default integration with JSF) it's in place to provide a straightforward API.\n     * However, e.g. an integration for a different view technology can use it e.g. for a logical id.\n     *\n     * @return current view ID\n     */\n    String getViewId();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/ViewConfigResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport java.util.List;\n\n/**\n * Resolver of view-configs.\n *\n * A {@link ConfigDescriptor} can be bound to any config class (without required base type). That's needed e.g. for\n * folder-configs. Whereas {@link ViewConfigDescriptor}s only represent classes which inherit from {@link ViewConfig}\n * which is required for all view-configs.\n *\n * Use {@link org.apache.deltaspike.core.spi.config.view.ViewConfigRoot} to register a custom resolver.\n */\n//TODO re-visit name since we also need ConfigDescriptor\npublic interface ViewConfigResolver\n{\n    ConfigDescriptor<?> getConfigDescriptor(String path);\n\n    /**\n     * Resolves the {@link ConfigDescriptor} for the given class.\n     *\n     * @param configClass config class which usually represents a folder node\n     *\n     * @return config descriptor which represents the given config class\n     */\n    ConfigDescriptor<?> getConfigDescriptor(Class<?> configClass);\n\n    //TODO re-visit name (depends on other discussions)\n    /**\n     * Resolves all descriptors for folders.\n     *\n     * @return all descriptors for the known folder-configs\n     */\n    List<ConfigDescriptor<?>> getConfigDescriptors();\n\n    /**\n     * Resolves the {@link ViewConfigDescriptor} for the given view-id.\n     *\n     * @param viewId view-id of the page\n     *\n     * @return view-config descriptor which represents the given view-id, null otherwise\n     */\n    ViewConfigDescriptor getViewConfigDescriptor(String viewId);\n\n    /**\n     * Resolves the {@link ViewConfigDescriptor} for the given view-config class.\n     *\n     * @param viewDefinitionClass view-config class of the page\n     *\n     * @return view-config descriptor which represents the given view-config class\n     */\n    ViewConfigDescriptor getViewConfigDescriptor(Class<? extends ViewConfig> viewDefinitionClass);\n\n    /**\n     * Resolves all descriptors for the known {@link ViewConfig}s.\n     *\n     * @return all descriptors for the known view-configs\n     */\n    List<ViewConfigDescriptor> getViewConfigDescriptors();\n\n    /**\n     * Resolves the descriptor for the default error page.\n     *\n     * @return descriptor for the default error page\n     */\n    ViewConfigDescriptor getDefaultErrorViewConfigDescriptor();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/metadata/ViewMetaData.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.metadata;\n\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Meta-annotation for custom metadata which can be applied to view-configs.\n *\n * By default, metadata of a lower level overrides metadata of the same type from a higher level (cascading behaviour).\n * This behaviour can be changed by annotating the target annotation (or only chosen fields of it) with\n * {@code @Aggregated(true)}.\n */\n@Target({ ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n\n@Aggregated(false)\npublic @interface ViewMetaData\n{\n    @SuppressWarnings(\"rawtypes\")\n    Class<? extends ConfigPreProcessor> preProcessor() default ConfigPreProcessor.class;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/navigation/NavigationParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.Aggregated;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Used on JSF action methods, this adds navigation parameters (key-value pairs) to the resulting navigation string.\n * Alternatively, {@link org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext} can be used\n * to add the parameters.\n */\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData\n@Aggregated(true)\n@InterceptorBinding\npublic @interface NavigationParameter\n{\n    /**\n     * Key of the parameter.\n     *\n     * @return name of the key\n     */\n    @Nonbinding String key();\n\n    /**\n     * Value of the parameter, a plain String or an EL expression.\n     *\n     * @return ref or expression\n     */\n    @Nonbinding String value();\n\n    @Target({ METHOD, TYPE })\n    @Retention(RUNTIME)\n    @Documented\n\n    //TODO add special support for list-annotations (add value automatically)\n    /**\n     * A container for multiple NavigationParameters.\n     */\n    @ViewMetaData\n    @Aggregated(true)\n    @InterceptorBinding\n    public static @interface List\n    {\n        /**\n         * One or more navigation parameters.\n         *\n         * @return parameters\n         */\n        @Nonbinding NavigationParameter[] value();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/navigation/NavigationParameterContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.navigation;\n\nimport java.io.Serializable;\nimport java.util.Map;\n\n/**\n * Can be used to add parameters dynamically to the final navigation string.\n */\npublic interface NavigationParameterContext extends Serializable\n{\n    void addPageParameter(String key, Object value);\n\n    Map<String, String> getPageParameters();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/navigation/ViewNavigationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n/**\n * A type-safe {@link ViewConfig}-based NavigationHandler wrapper.\n */\npublic interface ViewNavigationHandler\n{\n    /**\n     * Triggers navigation to the given view.\n     *\n     * @param targetView the navigation target\n     */\n    void navigateTo(Class<? extends ViewConfig> targetView);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/view/navigation/event/PreViewConfigNavigateEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.config.view.navigation.event;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n/**\n * This event is fired before a navigation from/to a view-config-based page occurs. With {@link #navigateTo(Class)} it's\n * possible to change the navigation target.\n */\npublic class PreViewConfigNavigateEvent\n{\n    private final Class<? extends ViewConfig> fromView;\n    private Class<? extends ViewConfig> toView;\n\n    /**\n     * Constructor for creating the event for the given source and target view.\n     *\n     * @param fromView source-view\n     * @param toView   target-view\n     */\n    public PreViewConfigNavigateEvent(Class<? extends ViewConfig> fromView, Class<? extends ViewConfig> toView)\n    {\n        this.fromView = fromView;\n        this.toView = toView;\n    }\n\n    /**\n     * Provides the navigation source.\n     *\n     * @return source of the navigation\n     */\n    public Class<? extends ViewConfig> getFromView()\n    {\n        return fromView;\n    }\n\n    /**\n     * Provides the navigation target.\n     *\n     * @return target of the navigation\n     */\n    public Class<? extends ViewConfig> getToView()\n    {\n        return toView;\n    }\n\n    /**\n     * Changes the navigation target.\n     *\n     * @param toView new navigation target\n     */\n    public void navigateTo(Class<? extends ViewConfig> toView)\n    {\n        this.toView = toView;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/crypto/CipherService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.crypto;\n\nimport java.io.IOException;\n\n/**\n * handle Encryption\n */\npublic interface CipherService\n{\n\n    /**\n     * Store a hash based on the given masterpassword and masterSalt in\n     * ~/.deltaspike/master.hash\n     *\n     * @param masterPassword\n     * @param masterSalt same masterSalt as later used by the application to decrypt the hash\n     * @param overwrite whether an existing passkey file does not get overwritten.\n     *\n     * @return {@code true} if the master hash got successfully written\n     * @throws IOException if the master hash file could not be written\n     * @throws IllegalStateException if a masterhash already exists\n     */\n    void setMasterHash(String masterPassword, String masterSalt, boolean overwrite) throws IOException;\n\n    /**\n     * Encrypt the given cleartext.\n     * We use the masterSalt to access the MasterHash to use as key for encryption\n     *\n     * @param cleartext to get encrypted\n     * @param masterSalt the same as used for {@link #setMasterHash(String, String, boolean)}\n     * @return the encrypted String to store somewhere\n     */\n    String encrypt(String cleartext, String masterSalt);\n\n    /**\n     * Decrypt the given encrypted value.\n     * We use the masterSalt to access the MasterHash to use as key for encryption\n     *\n     * @param encryptedValue to get decrypted\n     * @param masterSalt the same as used for {@link #setMasterHash(String, String, boolean)}\n     * @return the decrypted plaintext\n     */\n    String decrypt(String encryptedValue, String masterSalt);\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/exclude/Exclude.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.interpreter.ExpressionInterpreter;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Supported usages:\n * <pre>\n * &#064;Exclude\n * &#064;Exclude(ifProjectStage=Production.class)\n * &#064;Exclude(exceptIfProjectStage=UnitTest.class)\n * &#064;Exclude(onExpression=\"myProperty==myValue\")\n * &#064;Exclude(onExpression=\"[my custom expression syntax]\", interpretedBy=CustomExpressionInterpreter.class)\n * </pre>\n *\n * <b>Examples:</b>\n * <br/>\n * <ul>\n * <li>\n * The following bean gets excluded in any case\n * <pre>\n * &#064;Exclude\n * public class NoBean {}\n * </pre>\n * </li>\n *\n * <li>\n * The following bean gets excluded when the ProjectStage is 'Development'\n * <pre>\n * &#064;Exclude(ifProjectStage = ProjectStage.Development.class)\n * public class ProductionBean {}\n * </pre>\n * </li>\n *\n * <li>\n * The following bean gets excluded in every case except when then ProjectStage is 'Development'\n * <pre>\n * &#064;Exclude(exceptIfProjectStage = ProjectStage.Development.class)\n * public class DevBean {}\n * </pre>\n * </li>\n *\n * <li>\n * The following bean gets excluded if the expression evaluates to true, which means there is a configured property\n * called 'myProperty' with the value 'myValue'\n * <pre>\n * &#064;Exclude(onExpression=\"myProperty==myValue\")\n * public class ProductionBean {}\n * </pre>\n * </li>\n *\n * <li>The following bean gets excluded if the expression evaluates to true\n * <pre>\n * &#064;Exclude(onExpression=\"[my custom expression syntax]\", interpretedBy=CustomExpressionInterpreter.class)\n * public class ProductionBean {}\n * </pre>\n * </li>\n * </ul>\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.TYPE })\npublic @interface Exclude\n{\n    /**\n     * The {@link org.apache.deltaspike.core.api.projectstage.ProjectStage}s which lead to deactivating this bean. If\n     * the current ProjectStage is in this list, the bean will get vetoed.\n     *\n     * @return 1-n project-stages which are not allowed for the annotated artifact\n     */\n    Class<? extends ProjectStage>[] ifProjectStage() default { };\n\n    /**\n     * The {@link org.apache.deltaspike.core.api.projectstage.ProjectStage}s which lead to activating this bean. If the\n     * current ProjectStage is not in this list, the bean will get vetoed.\n     *\n     * @return 1-n project-stages which are allowed for the annotated artifact\n     */\n    Class<? extends ProjectStage>[] exceptIfProjectStage() default { };\n\n    /**\n     * Expression which signals if the annotated bean should be deactivated or not.\n     *\n     * @return expression-string which will be interpreted\n     */\n    String onExpression() default \"\";\n\n    /**\n     * @return class of the interpreter which should be used (default leads to a simple config-property interpreter)\n     */\n    @SuppressWarnings(\"rawtypes\")\n    Class<? extends ExpressionInterpreter> interpretedBy() default ExpressionInterpreter.class;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/future/Futureable.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.future;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Mark the method as execute in a thread pool and not synchronously.\n * Note: it should return a CompletionStage, Future or void.\n */\n@InterceptorBinding\n@Retention(RUNTIME)\n@Target({ TYPE, METHOD })\npublic @interface Futureable\n{\n    /**\n     * @return pool name, if not existing will use a default one based on processor count.\n     */\n    @Nonbinding\n    String value() default \"\";\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/interpreter/BasePropertyExpressionInterpreter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.interpreter;\n\n/**\n * Base implementation for simple (property) expressions.\n *\n * Supported operations:<p/>\n * <ul>\n *     <li>[key]==[value]</li>\n *     <li>[key]!=[value]</li>\n *     <li>[key]==* (a value is required)</li>\n *     <li>; (separator)</li>\n * </ul>\n */\npublic abstract class BasePropertyExpressionInterpreter implements ExpressionInterpreter<String, Boolean>\n{\n    private static final String ASTERISK = \"*\";\n\n    @Override\n    public final Boolean evaluate(String expressions)\n    {\n        boolean result = false;\n        String[] foundExpressions = expressions.split(\";\");\n\n        SimpleOperationEnum operation;\n        for (String expression : foundExpressions)\n        {\n            result = false;\n            if (expression.contains(SimpleOperationEnum.IS.getValue()))\n            {\n                operation = SimpleOperationEnum.IS;\n            }\n            else if (expression.contains(SimpleOperationEnum.NOT.getValue()))\n            {\n                operation = SimpleOperationEnum.NOT;\n            }\n            else\n            {\n                throw new IllegalStateException(\"expression: \" + expression + \" isn't supported by \" +\n                        getClass().getName() + \" supported operations: \" + SimpleOperationEnum.getOperations() +\n                        \"separator: ';'\");\n            }\n\n            String[] keyValue = expression.split(operation.getValue());\n\n            String configuredValue = getConfiguredValue(keyValue[0]);\n\n            if (configuredValue != null)\n            {\n                configuredValue = configuredValue.trim();\n            }\n            else\n            {\n                configuredValue = \"\";\n            }\n\n            if (!ASTERISK.equals(keyValue[1]) && \"\".equals(configuredValue))\n            {\n                continue;\n            }\n\n            if (ASTERISK.equals(keyValue[1]) && !\"\".equals(configuredValue))\n            {\n                result = true;\n                continue;\n            }\n\n            if (SimpleOperationEnum.IS.equals(operation) && !keyValue[1].equalsIgnoreCase(configuredValue))\n            {\n                return false;\n            }\n            else if (SimpleOperationEnum.NOT.equals(operation) && keyValue[1].equalsIgnoreCase(configuredValue))\n            {\n                return false;\n            }\n            result = true;\n        }\n\n        return result;\n    }\n\n    protected abstract String getConfiguredValue(String key);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/interpreter/ExpressionInterpreter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.interpreter;\n\n/**\n * Generic interface for evaluation of expressions, like the ones provided by\n * {@link org.apache.deltaspike.core.api.exclude.Exclude#onExpression()}.\n * \n * @param <E> expression type\n * @param <R> result type\n */\npublic interface ExpressionInterpreter<E, R>\n{\n    /**\n     * Evaluates the given expression and returns the result for it.\n     *\n     * @param expression expression to evaluate\n     *\n     * @return result of the evaluated expression\n     */\n    R evaluate(E expression);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/interpreter/SimpleOperationEnum.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.interpreter;\n\n/**\n * Operations supported by {@link BasePropertyExpressionInterpreter}.\n */\nenum SimpleOperationEnum\n{\n    IS(\"==\"), NOT(\"!=\");\n\n    private final String value;\n\n    SimpleOperationEnum(String value)\n    {\n        this.value = value;\n    }\n\n    String getValue()\n    {\n        return value;\n    }\n\n    static String getOperations()\n    {\n        StringBuilder operations = new StringBuilder();\n\n        for (SimpleOperationEnum operation : SimpleOperationEnum.values())\n        {\n            operations.append(operation);\n            operations.append(\" \");\n        }\n        return operations.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxBroadcaster.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.jmx;\n\nimport javax.management.Notification;\n\n/**\n * Interface used to send JMX message from \"CDI MBeans\". It can only be used from CDI MBeans and should get injected in\n * other beans.\n */\npublic interface JmxBroadcaster\n{\n    /**\n     * @param notification the notification to send from the current MBean.\n     */\n    void send(Notification notification);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxManaged.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.jmx;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Describes a JMX operation or attribute, when used on a method or a field, respectively.\n * <p>\n * Used on a method it describes a JMX operation with an optional description.\n * An exception thrown by the method will be wrapped in a {@link javax.management.MBeanException}\n * unless it already is a {@code MBeanException}.\n * <p>\n * Used on a field it describes a JMX attribute. This attribute is readable if a getter on this field is available and\n * writable if a setter is found.\n */\n@Retention(RUNTIME)\n@Target({ FIELD, METHOD })\n@Documented\npublic @interface JmxManaged\n{\n    /**\n     * @return the description either of the operation or the attribute exported through JMX.\n     */\n    String description() default \"\";\n\n    /**\n     * @return if {@code true} a Map or Table will be converted to a TabularData with a CompositeData entry,\n     *         if {@code false} the Map or Table will be returned directly.\n     */\n    boolean convertToTabularData() default true;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.jmx;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Describes a parameter of a JMX operation.\n */\n@Retention(RUNTIME)\n@Target(PARAMETER)\n@Documented\npublic @interface JmxParameter\n{\n    /**\n     * @return the description of the parameter.\n     */\n    String description() default \"\";\n    \n    /**\n     * @return the name of the parameter.\n     */\n    String name() default \"\";\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/MBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.jmx;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * This annotation marks a CDI managed bean as exported through JMX.\n */\n@Stereotype\n\n@Retention(RUNTIME)\n@Target(TYPE)\n@Inherited\npublic @interface MBean\n{\n    /**\n     * @return the category to use if no objectName was specified. Default is \"org.apache.deltaspike\" and can be\n     *         overriden either directly by the value or by a key used to resolve a value using\n     *         {@link org.apache.deltaspike.core.api.config.ConfigResolver}. It is a key if the value is between\n     *         brackets. Default key is \"org.apache.deltaspike.mbean.category\".\n     */\n    String category() default \"{org.apache.deltaspike.mbean.category}\";\n\n    /**\n     * @return the name of the bean used if no objectName was specified. It is used with category value to create the\n     *         MBean {@link javax.management.ObjectName} using the following pattern:\n     *         &lt;category&gt;:type=MBeans,name=&lt;name&gt;\n     */\n    String name() default \"\";\n\n    /**\n     * @return the properties part of the objectName if no objectName was specified.\n     *         If name and type are specified this segment is concatenated after.\n     */\n    String properties() default \"\";\n\n    /**\n     * @return the type to use if no objectName was specified. Default is <pre>MBeans</pre> and can be\n     *         overriden either directly by the value or by a key used to resolve a value using\n     *         {@link org.apache.deltaspike.core.api.config.ConfigResolver}. It is a key if the value is between\n     *         brackets.\n     */\n    String type() default \"\";\n\n    /**\n     * @return the direct object name used to export the decorated bean.\n     */\n    String objectName() default \"\";\n\n    /**\n     * @return the description used to describe the JMX bean.\n     */\n    String description() default \"\";\n}\n\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/NotificationInfo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.jmx;\n\nimport javax.management.Notification;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Documented\n@Target(TYPE)\n@Retention(RUNTIME)\npublic @interface NotificationInfo\n{\n    String[] types() default { };\n    String description() default \"\";\n    Class<? extends Notification> notificationClass() default Notification.class;\n    String[] descriptorFields() default { };\n\n    @Target(TYPE)\n    @Retention(RUNTIME)\n    static @interface List\n    {\n        NotificationInfo[] value();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/Table.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.jmx;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\n\nimport static java.util.Arrays.asList;\n\n/**\n * Allows to expose in JMX a STRING TabularData without having to built it in the MBean.\n *\n * Ensure to register columns before the lines.\n *\n * You just have to type the operation or attribute with this type to expose it as a TabularData.\n */\npublic class Table\n{\n    private Collection<String> columns = new ArrayList<String>();\n    private Collection<Collection<String>> values = new ArrayList<Collection<String>>();\n\n    public Table withColumns(final Collection<String> names)\n    {\n        columns.addAll(names);\n        return this;\n    }\n\n    public Table withColumns(final String... names)\n    {\n        columns.addAll(asList(names));\n        return this;\n    }\n\n    public Table withLines(final Collection<Collection<String>> lines)\n    {\n        for (final Collection<String> line : lines)\n        {\n            withLine(line);\n        }\n        return this;\n    }\n\n    public Table withLine(final Collection<String> line)\n    {\n        if (line.size() != columns.size())\n        {\n            throw new IllegalArgumentException(\"Please set columns before lines\");\n        }\n        values.add(line);\n        return this;\n    }\n\n    public Table withLine(final String... line)\n    {\n        if (line.length != columns.size())\n        {\n            throw new IllegalArgumentException(\"Please set columns before lines\");\n        }\n        values.add(asList(line));\n        return this;\n    }\n\n    public Collection<String> getColumnNames()\n    {\n        return Collections.unmodifiableCollection(columns);\n    }\n\n    public Collection<Collection<String>> getLines()\n    {\n        return Collections.unmodifiableCollection(values);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/MessageBundleLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\n\n/**\n * Literal for {@link MessageBundle}\n */\npublic class MessageBundleLiteral extends AnnotationLiteral<MessageBundle> implements MessageBundle\n{\n    private static final long serialVersionUID = 5116646785333766333L;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/MessageContextConfigLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.literal;\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\nimport org.apache.deltaspike.core.api.message.MessageResolver;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link org.apache.deltaspike.core.api.message.MessageContextConfig}\n */\npublic class MessageContextConfigLiteral extends AnnotationLiteral<MessageContextConfig> implements MessageContextConfig\n{\n    private static final long serialVersionUID = -5888417869986174834L;\n\n    private final Class<? extends MessageResolver> messageResolver;\n    private final Class<? extends MessageInterpolator> messageInterpolator;\n    private final Class<? extends LocaleResolver> localeResolver;\n    private final String[] messageSource;\n\n    public MessageContextConfigLiteral()\n    {\n        this(MessageResolver.class, MessageInterpolator.class, LocaleResolver.class, new String[0]);\n    }\n\n    public MessageContextConfigLiteral(Class<? extends MessageResolver> messageResolver,\n                                       Class<? extends MessageInterpolator> messageInterpolator,\n                                       Class<? extends LocaleResolver> localeResolver,\n                                       String[] messageSource)\n    {\n        this.messageResolver = messageResolver;\n        this.messageInterpolator = messageInterpolator;\n        this.localeResolver = localeResolver;\n        this.messageSource = messageSource;\n    }\n\n    @Override\n    public String[] messageSource()\n    {\n        return messageSource;\n    }\n\n    @Override\n    public Class<? extends MessageResolver> messageResolver()\n    {\n        return messageResolver;\n    }\n\n    @Override\n    public Class<? extends MessageInterpolator> messageInterpolator()\n    {\n        return messageInterpolator;\n    }\n\n    @Override\n    public Class<? extends LocaleResolver> localeResolver()\n    {\n        return localeResolver;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/ViewControllerRefLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.api.literal;\n\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef}\n */\npublic class ViewControllerRefLiteral extends AnnotationLiteral<ViewControllerRef> implements ViewControllerRef\n{\n    private static final long serialVersionUID = 8582580975876369665L;\n\n    private final Class value;\n    private final String name;\n\n    public ViewControllerRefLiteral(Class value, String name)\n    {\n        this.value = value;\n        this.name = name;\n    }\n\n    @Override\n    public Class value()\n    {\n        return this.value;\n    }\n\n    @Override\n    public String name()\n    {\n        return this.name;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lock/Locked.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.lock;\n\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.locks.ReadWriteLock;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * The access to the method is protected by a read/write lock.\n */\n@InterceptorBinding\n@Retention(RUNTIME)\n@Target({ TYPE, METHOD })\npublic @interface Locked\n{\n    /**\n     * @return if the lock is fair.\n     */\n    @Nonbinding\n    boolean fair() default false;\n\n    /**\n     * @return the operation used on the lock, default to read but you can use write.\n     */\n    @Nonbinding\n    Operation operation() default Operation.READ;\n\n    /**\n     * @return how to retrieve the lock for this method. Default uses a lock per class.\n     */\n    @Nonbinding\n    Class<? extends LockFactory> factory() default LockFactory.class;\n\n    /**\n     * @return the access timeout for this method. Ignored by default since it is 0.\n     */\n    @Nonbinding\n    long timeout() default 0L;\n\n    /**\n     * @return the timeout unit (default ms).\n     */\n    @Nonbinding\n    TimeUnit timeoutUnit() default TimeUnit.MILLISECONDS;\n\n    enum Operation\n    {\n        READ, WRITE\n    }\n\n    /**\n     * Provide a way to switch the ReadWriteLock implementation for @Locked.\n     */\n    interface LockFactory\n    {\n        /**\n         * @param method the intercepted method.\n         * @param fair is the lock fair.\n         * @return a read/write lock used for @Locked implementation.\n         */\n        ReadWriteLock newLock(AnnotatedMethod<?> method, boolean fair);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/LocaleResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\n\nimport java.io.Serializable;\nimport java.util.Locale;\n\nimport org.apache.deltaspike.core.api.config.DeltaSpikeConfig;\n\n/**\n * Provides the current {@link java.util.Locale}.\n *\n * <p>\n * DeltaSpike provides a default implementation which returns the current system Locale.</p>\n * <p>\n * An application can provide custom implementation as an &#064;Alternative. This could e.g. examine a JSF View or the\n * Locale of any currently logged in User.</p>\n */\npublic interface LocaleResolver extends Serializable, DeltaSpikeConfig\n{\n    /**\n     * @return the current locale\n     */\n    Locale getLocale();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/Message.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport java.io.Serializable;\nimport java.util.Collection;\n\n/**\n * Basic interface for all messages.\n *\n * <p>\n * A <code>Message</code> is not a simple String but all the information needed to create those Strings for multiple\n * situations. The situation is determined by the used {@link MessageContext}.</p>\n */\npublic interface Message extends Serializable\n{\n    /**\n     * @param messageTemplate message key (or plain text) for the current message\n     *\n     * @return the current instance of the message builder to allow a fluent API\n     */\n    Message template(String messageTemplate);\n\n    /**\n     * @param arguments numbered and/or named argument(s) for the current message\n     *\n     * @return the current instance of the message builder to allow a fluent API\n     */\n    Message argument(Serializable... arguments);\n    \n    /**\n     * Argument array. Similar to argument except it is meant to handle an array being passed in via a chain.\n     *\n     * @param arguments the arguments\n     *\n     * @return the message\n     */\n    Message argumentArray(Serializable[] arguments);\n    \n    /**\n     * Argument. Similar to the other argument methods, this one handles collections.\n     *\n     * @param arguments the arguments\n     *\n     * @return the message\n     */\n    Message argument(Collection<Serializable> arguments);\n\n    /**\n     * @return the message key (or plain text) of the current message\n     */\n    String getTemplate();\n\n    /**\n     * @return all named and numbered arguments\n     */\n    Object[] getArguments();\n\n    /**\n     * Renders the Message to a String, using the {@link MessageContext} which created the Message.\n     */\n    String toString();\n\n    /**\n     * Renders the Message to a String, using an arbitrary {@link MessageContext}.\n     */\n    String toString(MessageContext messageContext);\n\n    /**\n     * Renders the Message to a String, using the {@link MessageContext} which created the Message. While resolving the\n     * message we will first search for a messageTemplate with the given category by just adding an underscore '_' and\n     * the category String to the {@link #getTemplate()}. If no such template exists we will fall back to the version\n     * without the category String.\n     * <p>\n     * DeltaSpike JSF messages e.g. distinguish between categories\n     * {@code &quot;summary&quot;} and {@code &quot;detail&quot;}\n     * to allow a short and a more detailed explanation in Error, Warn and Info popups at the same time.\n     * </p>\n     */\n    String toString(String category);\n\n    /**\n     * Renders the Message to a String, using an arbitrary {@link MessageContext}. While resolving the message we will\n     * first search for a messageTemplate with the given category by just adding an underscore '_' and the category\n     * String to the {@link #getTemplate()}. If no such template exists we will fall back to the version without the\n     * category String.\n     */\n    String toString(MessageContext messageContext, String category);\n\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/MessageBundle.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Marker annotation for a message-bundle interface which provides type-safe messages.\n *\n * <p>\n * This annotation must only be used on interfaces. If this annotation gets used on a concrete class, a deployment error\n * results!</p>\n *\n * <h3>Type-safe Messages</h3>\n * <p>\n * Each method on an interface annotated with <code>&#064;MessageBundle</code> will form a type-safe message. The\n * message lookup key (resource bundle key) can either be defined by annotating those methods with\n * &#064;{@link MessageTemplate}) or by convention. if no &#064;{@link MessageTemplate} annotation is used on a method,\n * the case sensitive method name name will be used as resource key.</p>\n *\n * <h3>Message Parameters</h3>\n * <p>\n * The parameters of the declared methods will be automatically passed as message parameters to the\n * {@link org.apache.deltaspike.core.api.message.MessageResolver}. Please note that all passed parameters should be\n * {@link java.io.Serializable}. If a parameter is not Serializable, we will instead store the <code>toString()</code>\n * of the passed parameter.</p>\n *\n *\n * <h3>Message Sources</h3>\n * <p>\n * The {@link java.util.ResourceBundle} or other resource lookup source which might be used is determined by the\n * {@link org.apache.deltaspike.core.api.message.MessageResolver} in conjunction with\n * {@link org.apache.deltaspike.core.api.message.MessageContext#messageSource(String...)}. The fully qualified class\n * name of the interface annotated with &#064;MessageBundle will automatically be registered as additional\n * <code>messageSource</code> for those messages.</p>\n * <p>\n * By default the Message Source is a resource bundle with the same name as the {@code &#064;MessageBundle}\n * annotated interface, e.g. {@code com.acme.MyMessages_en.properties}.\n * </p>\n *\n * <p>\n * <code>&#064;MessageBundle</code> can be combined with {@link MessageContextConfig} to further customize the\n * message resolution and processing. To use a different resourcebundle, e.g. \n * {@code somepath/myownmessages_en.properties} you might write:\n * <pre>\n * &#064;MessageBundle\n * &#064;MessageContextConfig(messageSource = \"somepath/myownmessages\")\n * </pre>\n *\n * </p>\n *\n * <p>\n * Debug hint: Set a breakpoint in <code>MessageBundleInvocationHandler#invoke</code>. This will get called for every\n * message bundle invocation.</p>\n */\n@Stereotype\n\n@Target({ TYPE })\n@Retention(RUNTIME)\n@Documented\npublic @interface MessageBundle\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/MessageContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport java.io.Serializable;\nimport java.util.List;\n\n/**\n * Central context for handling dynamic messages.\n * <br/>\n * Instances of this type are mutable but also {@link Cloneable}. If you need a new instance, then use\n * {@link Object#clone()}.\n */\npublic interface MessageContext extends LocaleResolver, Serializable, Cloneable\n{\n    /**\n     * Clones the current MessageContext.\n     */\n    MessageContext clone();\n\n    /**\n     * @return a message based on the current context modifiable via a fluent API\n     */\n    Message message();\n\n    /**\n     * Configures a message source instance for use by a {@link MessageResolver}.\n     *\n     * @param messageSource message source to add\n     *\n     * @return the instance of the current message context builder\n     */\n    MessageContext messageSource(String... messageSource);\n\n    /**\n     * @param messageInterpolator a new message interpolator to be set\n     * @return the instance of the current message context builder\n     */\n    MessageContext messageInterpolator(MessageInterpolator messageInterpolator);\n\n    /**\n     * @param messageResolver a new message resolver to be set\n     * @return the instance of the current message context builder\n     */\n    MessageContext messageResolver(MessageResolver messageResolver);\n\n    /**\n     * @param localeResolver a new locale resolver to be set\n     * @return the instance of the current message context builder\n     */\n    MessageContext localeResolver(LocaleResolver localeResolver);\n\n    /**\n     * @return the current message interpolator\n     */\n    MessageInterpolator getMessageInterpolator();\n\n    /**\n     * @return the current message resolver\n     */\n    MessageResolver getMessageResolver();\n\n    /**\n     * @return the current locale resolver\n     */\n    LocaleResolver getLocaleResolver();\n\n    /**\n     * @return list of registered message sources\n     */\n    List<String> getMessageSources();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/MessageContextConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Configures message resolution and processing of a {@link MessageBundle}.\n */\n@Target({ TYPE })\n@Retention(RUNTIME)\n@Documented\npublic @interface MessageContextConfig\n{\n    /**\n     * <p>Additional message source.</p>\n     *\n     * <p>A message source is a lookup hint for the {@link MessageResolver}. For the default MessageResolver this is the\n     * name of the {@link java.util.ResourceBundle}.</p>\n     *\n     * <p>Example: To use 2 additional ResourceBundles for the lookup, you can configure the MessageContextConfig like\n     * this:\n     * <pre>\n     *  &#064;MessageBundle\n     *  &#064;MessageContextConfig(messageSource = {\"mycomp.ErrorMessages\",\"mycomp.BusinessMessages\"})\n     *  public interface MyCompanyMessages {...\n     * </pre>.\n     * </p>\n     *\n     * @return classes of the message-sources\n     */\n    String[] messageSource() default { };\n\n    /**\n     * {@link MessageResolver} to use for resolution of message templates to message text.\n     *\n     * @return class of the {@link MessageResolver} bean or the default marker\n     */\n    Class<? extends MessageResolver> messageResolver() default MessageResolver.class;\n\n    /**\n     * {@link MessageInterpolator} to use for interpolation of placeholders in the resolved text.\n     *\n     * @return class of the {@link MessageInterpolator} bean or the default marker\n     */\n    Class<? extends MessageInterpolator> messageInterpolator() default MessageInterpolator.class;\n\n    /**\n     * {@link LocaleResolver} providing the locale for message template resolution.\n     *\n     * @return class of the {@link LocaleResolver} bean or the default marker\n     */\n    Class<? extends LocaleResolver> localeResolver() default LocaleResolver.class;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/MessageInterpolator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport java.io.Serializable;\nimport java.util.Locale;\n\nimport org.apache.deltaspike.core.api.config.DeltaSpikeConfig;\n\n/**\n * Implementations are responsible to replace placeholders in a message with the final value.\n *\n * <p>\n * An application can provide a custom implementation as &#064;Alternative.</p>\n *\n * <p>\n * A simple implementation which uses the {@link String#format(java.util.Locale, String, Object...)} will be used by\n * default.</p>\n */\npublic interface MessageInterpolator extends Serializable, DeltaSpikeConfig\n{\n    /**\n     * Replaces the arguments of the given message with the given arguments.\n     *\n     * @param messageText the message text which has to be interpolated\n     * @param arguments   a list of numbered and/or named arguments for the current message\n     * @param locale      to use for the formatting\n     *\n     * @return the final (interpolated) message text if it was possible to replace the parameters with the given\n     *         arguments, or the unmodified messageText otherwise\n     */\n    String interpolate(String messageText, Serializable[] arguments, Locale locale);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/MessageResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport java.io.Serializable;\n\n/**\n * Implementations have to resolve the text stored for a given key in the message source they are aware of.\n * Implementations should always be &#064;Dependent scoped!\n */\npublic interface MessageResolver extends Serializable\n{\n    String MISSING_RESOURCE_MARKER = \"???\";\n\n    /**\n     *\n     * @param messageContext  messageContext which should be used\n     * @param messageTemplate the message key (or inline text) of the current message\n     * @param category        the category of the message, e.g. 'longText'. Can be <code>null</code>\n     *\n     * @return the final but not interpolated message text or <code>null</code> if an error happened or the resource\n     *         could not be resolved.\n     */\n    String getMessage(MessageContext messageContext, String messageTemplate, String category);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/MessageTemplate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.message;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Provides the message (template) for type-safe messages.\n *\n * <p>\n * This only works on interfaces which are annotated with {@link MessageBundle}.</p>\n *\n * <p>\n * Depending on the {@link org.apache.deltaspike.core.api.message.MessageResolver} this message template value might be\n * used as key to lookup internationalized values from a {@link java.util.ResourceBundle}.</p>\n *\n * <p>\n * A MessageTemplate value which starts and ends with brackets '{', '}' will be interpreted as key for resolving from a\n * ResourceBundle or any other lookup mechanism determined by the\n * {@link org.apache.deltaspike.core.api.message.MessageResolver}. A small example:\n * <pre>\n * &#064;MessageTemplate(\"{welcome_to}\")\n * </pre> This will lookup a <code>welcome_to = Hello to Aruba</code> from the configured resource bundle.\n * </p>\n *\n * <p>\n * MessageTemplate values without '{', '}' bracelets will be directly used without resource lookup.</p>\n */\n@Target(METHOD)\n@Retention(RUNTIME)\n@Documented\npublic @interface MessageTemplate\n{\n    /**\n     * The default format string of this message.\n     *\n     * @return the format string\n     */\n    String value();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/monitoring/InvocationMonitored.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.monitoring;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Use this annotation to mark a bean as being monitored.\n * This will activate a CDI Interceptor which will track\n * all method invocations on that class and measure how\n * often they got invoked and how much time they consume.\n *\n * At the end of a request the final times will get sent out\n * as {@link MonitorResultEvent}.\n */\n@Inherited\n@InterceptorBinding\n@Target( { ElementType.TYPE, ElementType.METHOD } )\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface InvocationMonitored\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/monitoring/MonitorResultEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.monitoring;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.concurrent.atomic.AtomicLong;\n\n/**\n * This class will be used as event to transport final monitor values\n *\n * @see InvocationMonitored\n */\n@Vetoed\npublic class MonitorResultEvent\n{\n    private Map<String, AtomicInteger> methodInvocations = new HashMap<String, AtomicInteger>();\n\n    private Map<String, AtomicInteger> classInvocations  = new HashMap<String, AtomicInteger>();\n\n    private Map<String, AtomicLong> methodDurations = new HashMap<String, AtomicLong>();\n\n    public MonitorResultEvent(Map<String, AtomicInteger> methodInvocations,\n                              Map<String, AtomicInteger> classInvocations,\n                              Map<String, AtomicLong> methodDurations)\n    {\n        this.methodInvocations = methodInvocations;\n        this.classInvocations = classInvocations;\n        this.methodDurations = methodDurations;\n    }\n\n\n    /**\n     * @return Map with Counters for all method invocations\n     * key = fully qualified method name (includes class)\n     * value = AtomicInteger with invocation count value\n     */\n    public Map<String, AtomicInteger> getMethodInvocations()\n    {\n        return methodInvocations;\n    }\n\n    /**\n     * @return Map with Counter for all class invocations\n     * key = fully qualified class name\n     * value = AtomicInteger with invocation count value\n     */\n    public Map<String, AtomicInteger> getClassInvocations()\n    {\n        return classInvocations;\n    }\n\n\n    /**\n     * @return Map with duration for all method invocations\n     * key = fully qualified method name (includes class)\n     * value = AtomicLong with duration nanos\n     */\n    public Map<String, AtomicLong> getMethodDurations()\n    {\n        return methodDurations;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/projectstage/ProjectStage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.projectstage;\n\n\nimport org.apache.deltaspike.core.util.ServiceUtils;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.Serializable;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.logging.Logger;\n\n/**\n * This class is the base of all ProjectStages. A ProjectStage identifies the environment the application currently runs\n * in. It provides the same functionality as the JSF2 ProjectStage but has a few additional benefits:\n * <ul>\n * <li>it works for JSF 1.0, JSF 1.1 and JSF 1.2 applications</li>\n * <li>it works in pure backends and unit tests without any JSF API</li>\n * <li>it is dynamic. Everyone can add their own ProjectStages!</li>\n * </ul>\n *\n * <p>\n * Technically this is kind of a 'dynamic enum'.</p>\n *\n * <p>\n * The following ProjectStages are provided by default:</p>\n * <ul>\n * <li>UnitTest</li>\n * <li>Development</li>\n * <li>SystemTest</li>\n * <li>IntegrationTest</li>\n * <li>Staging</li>\n * <li>Production</li>\n * </ul>\n *\n * <p>\n * The following resolution mechanism is used to determine the current ProjectStage:</p>\n * <ul>\n * <li>TODO specify!</li>\n * </ul>\n *\n * <p>\n * New ProjectStages can be added via the {@link java.util.ServiceLoader} mechanism. A class deriving from\n * {@link ProjectStage} must be provided and used for creating a single static instance of it.</p>\n *\n * <p>\n * Custom ProjectStages can be implemented by writing anonymous ProjectStage members into a registered\n * {@link ProjectStageHolder} as shown in the following example:</p>\n *\n * <pre>\n * package org.apache.deltaspike.test.core.api.projectstage;\n * public class TestProjectStages implements ProjectStageHolder {\n *     public static final class MyOwnProjectStage extends ProjectStage {};\n *     public static final MyOwnProjectStage MyOwnProjectStage = new MyOwnProjectStage();\n *\n *     public static final class MyOtherProjectStage extends ProjectStage {};\n *     public static final MyOtherProjectStage MyOtherProjectStage = new MyOtherProjectStage();\n * }\n * </pre>\n *\n * <p>\n * To activate those ProjectStages, you have to register the ProjectStageHolder class to get picked up via the\n * ServiceLoader mechanism. Simply create a file\n * <pre>\n * META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder\n * </pre> which contains the fully qualified class name of custom ProjectStageHolder implementation:\n * <pre>\n * # this class now gets picked up by java.util.ServiceLoader\n * org.apache.deltaspike.test.core.api.projectstage.TestProjectStages\n * </pre>\n * </p>\n *\n * <p>\n * You can use your own ProjectStages exactly the same way as all the ones provided by the system:\n * <pre>\n * ProjectStage myOwnPs = ProjectStage.valueOf(\"MyOwnProjectStage\");\n * if (myOwnPs.equals(MyOwnProjectStage.MyOwnProjectStage)) ...\n * </pre>\n * </p>\n *\n * <p>\n * <b>Note:</b> DeltaSpike will only find {@link ProjectStageHolder}s which are accessible by this very class. If you\n * deploy the deltaspike-core jar to a shared EAR classloader, it will e.g. <i>not</i> be able to register ProjectStages\n * defined in a web application's WEB-INF/classes directory!\n * </p>\n *\n */\n@Vetoed\npublic abstract class ProjectStage implements Serializable\n{\n    private static final long serialVersionUID = -1210639662598734888L;\n\n    /**\n     * This map contains a static map with all registered projectStages.\n     *\n     * We don't need to use a ConcurrentHashMap because writing to it will\n     * only be performed in the static initializer block which is guaranteed\n     * to be atomic by the VM spec.\n     */\n    private static Map<String, ProjectStage> projectStages = new HashMap<String, ProjectStage>();\n\n    /**\n     * All the registered ProjectStage values.\n     * We don't need to make this volatile because of the classloader guarantees of\n     * the VM.\n     */\n    private static ProjectStage[] values = null;\n\n    /**\n     * logger for the ProjectStage\n     */\n    private static final Logger LOG = Logger.getLogger(ProjectStage.class.getName());\n\n\n    /**\n     * The static initializer block will register all custom ProjectStages\n     * by simply touching their classes due loading it with the.\n     * {@link java.util.ServiceLoader}.\n     */\n    static\n    {\n        List<ProjectStageHolder> projectStageHolders =\n            ServiceUtils.loadServiceImplementations(ProjectStageHolder.class);\n\n        for (ProjectStageHolder projectStageHolder : projectStageHolders)\n        {\n            LOG.fine(\"registering ProjectStages from ProjectStageHolder \" + projectStageHolder.getClass().getName());\n        }\n    }\n\n\n    /** the name of the ProjectStage*/\n    private String psName;\n\n    /**\n     * The protected constructor will register the given ProjectStage via its name.\n     * The name is returned by the {@link #toString()} method of the ProjectStage.\n     */\n    protected ProjectStage()\n    {\n        String projectStageClassName = getClass().getSimpleName();\n        psName = projectStageClassName;\n\n        init(projectStageClassName, this);\n    }\n\n    /**\n     * This function exists to prevent findbugs from complaining about\n     * setting a static member from a non-static function.\n     *\n     * @param projectStageClassName name of the project-stage\n     * @param projectStage instance of the project-stage\n     */\n    private static void init(String projectStageClassName, ProjectStage projectStage)\n    {\n        if (!projectStages.containsKey(projectStageClassName))\n        {\n            projectStages.put(projectStageClassName, projectStage);\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"ProjectStage with name \" + projectStageClassName + \" already exists!\");\n        }\n\n        // we cannot do this in the static block since it's not really deterministic\n        // when all ProjectStages got resolved.\n        values = projectStages.values().toArray(new ProjectStage[ projectStages.size() ]);\n    }\n\n    /**\n     * @param projectStageClassName the name of the ProjectStage\n     * @return the ProjectStage which is identified by it's name\n     */\n    public static ProjectStage valueOf(String projectStageClassName)\n    {\n        return projectStages.get(projectStageClassName);\n    }\n\n    /**\n     * Exposes all registered {@link ProjectStage} implementations.\n     *\n     * @return provided and custom ProjectStage implementations\n     */\n    public static ProjectStage[] values()\n    {\n        ProjectStage[] result = new ProjectStage[values.length];\n        System.arraycopy(values, 0, result, 0, values.length);\n        return result;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String toString()\n    {\n        return psName;\n    }\n\n    // CHECKSTYLE:OFF\n\n    /**\n     * Project-stage for unit-tests\n     */\n    @Vetoed\n    public static final class UnitTest extends ProjectStage implements TestStage\n    {\n        private static final long serialVersionUID = -7910349894182034559L;\n    }\n\n    /**\n     * Type-safe {@link ProjectStage}\n     */\n    public static final UnitTest UnitTest = new UnitTest();\n\n    /**\n     * Project-stage for development\n     */\n    @Vetoed\n    public static final class Development extends ProjectStage\n    {\n        private static final long serialVersionUID = 1977308277341527250L;\n    }\n\n    /**\n     * Type-safe {@link ProjectStage}\n     */\n    public static final Development Development = new Development();\n\n    /**\n     * Project-stage for system-tests\n     */\n    @Vetoed\n    public static final class SystemTest extends ProjectStage implements TestStage\n    {\n        private static final long serialVersionUID = -7444003351466372539L;\n    }\n\n    /**\n     * Type-safe {@link ProjectStage}\n     */\n    public static final SystemTest SystemTest = new SystemTest();\n\n    /**\n     * Project-stage for integration-tests\n     */\n    @Vetoed\n    public static final class IntegrationTest extends ProjectStage implements TestStage\n    {\n        private static final long serialVersionUID = 2034474361615347127L;\n    }\n\n    /**\n     * Type-safe {@link ProjectStage}\n     */\n    public static final IntegrationTest IntegrationTest = new IntegrationTest();\n\n    /**\n     * Project-stage for staging\n     */\n    @Vetoed\n    public static final class Staging extends ProjectStage\n    {\n        private static final long serialVersionUID = -8426149532860809553L;\n    }\n\n    /**\n     * Type-safe {@link ProjectStage}\n     */\n    public static final Staging Staging = new Staging();\n\n    /**\n     * Default project-stage for production\n     */\n    @Vetoed\n    public static final class Production extends ProjectStage\n    {\n        private static final long serialVersionUID = -4030601958667812084L;\n    }\n\n    /**\n     * Type-safe {@link ProjectStage}\n     */\n    public static final Production Production = new Production();\n\n    // CHECKSTYLE:ON\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/projectstage/ProjectStageHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.projectstage;\n\n/**\n * A marker interface for custom ProjectStage holders. A ProjectStage holder is a class which contains one or more\n * {@link ProjectStage}s.\n *\n * <p>\n * Any custom ProjectStageHolder must get registered via the {@link java.util.ServiceLoader} mechanism. Simply create a\n * file\n * <pre>\n *     META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder\n * </pre> and write the fully qualified class name of your ProjectStageHolder into it.\n * </p>\n */\npublic interface ProjectStageHolder\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/projectstage/TestStage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.projectstage;\n\n/**\n * Marker interface for {@link ProjectStage} implementations which are used for tests. E.g. used to enable logging in\n * all 'testing' ProjectStages.\n */\npublic interface TestStage\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.provider;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.AfterDeploymentValidation;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeShutdown;\nimport jakarta.enterprise.inject.spi.CDI;\nimport jakarta.enterprise.inject.spi.Extension;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.core.util.ClassUtils;\n\n\n/**\n * This class provides access to the {@link BeanManager} by registering the current {@link BeanManager} in an extension\n * and making it available via a singleton factory for the current application.\n *\n * <p>This is really handy when you need to access CDI functionality from places where no injection is available.</p>\n *\n * <p>If a simple but manual bean lookup is needed, it's easier to use the {@link BeanProvider}.</p>\n * \n * <p>As soon as an application shuts down, the reference to the {@link BeanManager} is removed.</p>\n * \n * <p>\n * Usage:\n\n * <pre>\n * BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();</pre>\n * </p>\n * <p>\n * <b>Attention:</b> This approach is intended for use in user code at runtime. If BeanManagerProvider is used during\n * Container boot (in an Extension), non-portable behaviour results. During bootstrapping, an Extension shall\n * &#064;Inject BeanManager to get access to the underlying BeanManager (see e.g. {@link #cleanupFinalBeanManagers}).\n * This is the only way to guarantee that the right BeanManager is obtained in more complex Container scenarios.</p>\n */\npublic class BeanManagerProvider implements Extension\n{\n    private static final Logger  LOG = Logger.getLogger(BeanManagerProvider.class.getName());\n\n    private static BeanManagerProvider bmpSingleton;\n\n    /**\n     * This data container is used for storing the BeanManager for each web application. This is needed in EAR or other\n     * multi-webapp scenarios when the DeltaSpike classes (jars) are provided in a shared ClassLoader.\n     */\n    private static class BeanManagerInfo\n    {\n        /**\n         * The BeanManager picked up via Extension loading.\n         */\n        private BeanManager loadTimeBm;\n\n        /**\n         * The final BeanManager. After the container did finally boot, we first try to resolve them from JNDI, and only\n         * if we don't find any BM there we take the ones picked up at startup.\n         */\n        private BeanManager finalBm;\n\n        /**\n         * Whether the CDI Application has finally booted. Please note that this is only a nearby value as there is no\n         * reliable event for this status in EE6.\n         */\n        private boolean booted;\n    }\n\n    /**\n     * The BeanManagerInfo for the current ClassLoader.\n     * \n     * <p><b>Attention:</b> This instance must only be used through the {@link #bmpSingleton} singleton!</p>\n     */\n    private volatile Map<ClassLoader, BeanManagerInfo> bmInfos = new ConcurrentHashMap<>();\n\n    /**\n     * Indicates whether the {@link BeanManagerProvider} has been initialized. Usually it's not necessary to call this\n     * method in application code. It's useful e.g. for other frameworks to check if DeltaSpike and the CDI container in\n     * general have been started.\n     *\n     * @return true if the BeanManagerProvider is ready to be used\n     */\n    public static boolean isActive()\n    {\n        // CDI#current delegation enabled, skip everything\n        if (CoreBaseConfig.BeanManagerIntegration.DELEGATE_LOOKUP)\n        {\n            return bmpSingleton != null;\n        }\n\n        return bmpSingleton != null && bmpSingleton.bmInfos.containsKey(ClassUtils.getClassLoader(null));\n    }\n\n    /**\n     * Returns the current provider instance which provides access to the current {@link BeanManager}.\n     *\n     * @throws IllegalStateException if the {@link BeanManagerProvider} isn't ready to be used. That's the case if the\n     *                               environment isn't configured properly and therefore the {@link AfterBeanDiscovery}\n     *                               hasn't been called before this method gets called.\n     * @return the singleton BeanManagerProvider\n     */\n    public static BeanManagerProvider getInstance()\n    {\n        if (bmpSingleton == null)\n        {\n            throw new IllegalStateException(\"No \" + BeanManagerProvider.class.getName() + \" in place! \" +\n                    \"Please ensure that you configured the CDI implementation of your choice properly. \" +\n                    \"If your setup is correct, please clear all caches and compiled artifacts.\");\n        }\n        return bmpSingleton;\n    }\n\n    /**\n     * It doesn't really matter which of the system events is used to obtain the BeanManager, but\n     * {@link AfterBeanDiscovery} has been chosen since it allows all events which occur after the\n     * {@link AfterBeanDiscovery} to use the {@link BeanManagerProvider}.\n     *\n     * @param afterBeanDiscovery event which we don't actually use ;)\n     * @param beanManager        the BeanManager we store and make available.\n     */\n    public void setBeanManager(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)\n    {\n        setBeanManagerProvider(this);\n\n        // CDI#current delegation enabled, skip everything\n        if (CoreBaseConfig.BeanManagerIntegration.DELEGATE_LOOKUP &&\n            resolveBeanManagerViaStaticHelper() != null)\n        {\n            return;\n        }\n\n        BeanManagerInfo bmi = getBeanManagerInfo(ClassUtils.getClassLoader(null));\n        bmi.loadTimeBm = beanManager;\n    }\n\n    /**\n     * The active {@link BeanManager} for the current application (current {@link ClassLoader}). This method will throw\n     * an {@link IllegalStateException} if the BeanManager cannot be found.\n     *\n     * @return the current BeanManager, never <code>null</code>\n     *\n     * @throws IllegalStateException if the BeanManager cannot be found\n     */\n    public BeanManager getBeanManager()\n    {\n        // CDI#current delegation enabled, skip everything\n        if (CoreBaseConfig.BeanManagerIntegration.DELEGATE_LOOKUP)\n        {\n            BeanManager bm = resolveBeanManagerViaStaticHelper();\n            if (bm != null)\n            {\n                return bm;\n            }\n        }\n\n        BeanManagerInfo bmi = getBeanManagerInfo(ClassUtils.getClassLoader(null));\n\n        if (!bmi.booted)\n        {\n            // This is a workaround for some containers with messed up EAR handling.\n            // Those containers might boot up with the shared ear ClassLoader\n            // and later run the WARs with their own child ClassLoaders.\n            if (bmi.loadTimeBm == null)\n            {\n                BeanManagerInfo parentBmi = getParentBeanManagerInfo(ClassUtils.getClassLoader(null));\n                if (parentBmi != null)\n                {\n                    bmi.loadTimeBm = parentBmi.loadTimeBm;\n                }\n            }\n        }\n\n        BeanManager result = bmi.finalBm;\n\n        if (result == null)\n        {\n            synchronized (bmi)\n            {\n                result = bmi.finalBm;\n                if (result == null)\n                {\n                    // first we look for a BeanManager from JNDI\n                    result = resolveBeanManagerViaJndi();\n\n                    if (result == null)\n                    {\n                        // if none found, we take the one we got from the Extension loading\n                        result = bmi.loadTimeBm;\n                    }\n\n                    if (result == null)\n                    {\n                        throw new IllegalStateException(\"Unable to find BeanManager. \" +\n                                \"Please ensure that you configured the CDI implementation of your choice properly.\");\n                    }\n\n                    // store the resolved BeanManager in the result cache until #cleanupFinalBeanManagers gets called\n                    // -> afterwards the next call of #getBeanManager will trigger the final lookup\n                    bmi.finalBm = result;\n                }\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * By cleaning the final BeanManager map after the deployment gets validated, premature loading of information from\n     * JNDI is prevented in cases where the container might not be fully setup yet.\n     *\n     * This might happen if the BeanManagerProvider is used in an extension during CDI bootstrap. This should be\n     * generally avoided. Instead, an injected BeanManager should be used in Extensions and propagated using setters.\n     *\n     * In EARs with multiple webapps, each WAR might get a different Extension. This depends on the container used.\n     */\n    public void cleanupFinalBeanManagers(@Observes AfterDeploymentValidation adv)\n    {\n        // CDI#current delegation enabled, skip everything\n        if (CoreBaseConfig.BeanManagerIntegration.DELEGATE_LOOKUP &&\n            resolveBeanManagerViaStaticHelper() != null)\n        {\n            return;\n        }\n\n        for (BeanManagerInfo bmi : bmpSingleton.bmInfos.values())\n        {\n            bmi.finalBm = null;\n            bmi.booted = true;\n\n            /*possible issue with >weld< based servers:\n            if #getBeanManager gets called in a custom AfterDeploymentValidation observer >after< this observer,\n            the wrong bean-manager might get stored (not deterministic due to the unspecified order of observers).\n            finally a bean-manager for a single bda will be stored and returned (which isn't the bm exposed via jndi).*/\n        }\n    }\n\n    /**\n     * Cleanup on container shutdown.\n     *\n     * @param beforeShutdown CDI shutdown event\n     */\n    public void cleanupStoredBeanManagerOnShutdown(@Observes BeforeShutdown beforeShutdown)\n    {\n        // CDI#current delegation enabled, skip everything\n        if (CoreBaseConfig.BeanManagerIntegration.DELEGATE_LOOKUP)\n        {\n            return;\n        }\n\n        if (bmpSingleton == null)\n        {\n            // this happens if there has been a failure at startup\n            return;\n        }\n\n        bmpSingleton.bmInfos.remove(ClassUtils.getClassLoader(null));\n    }\n\n    /**\n     * Get the BeanManager from the JNDI registry.\n     *\n     * @return current {@link BeanManager} which is provided via JNDI\n     */\n    private BeanManager resolveBeanManagerViaJndi()\n    {\n        try\n        {\n            // this location is specified in JSR-299 and must be\n            // supported in all certified EE environments\n            return (BeanManager) new InitialContext().lookup(\"java:comp/BeanManager\");\n        }\n        catch (NamingException e)\n        {\n            //workaround didn't work -> return null\n            return null;\n        }\n    }\n\n    private BeanManager resolveBeanManagerViaStaticHelper()\n    {\n        try\n        {\n            return CDI.current().getBeanManager();\n        }\n        catch (Throwable t)\n        {\n            LOG.log(Level.FINEST, \"failed to delegate bean-manager lookup -> fallback to default.\", t);\n            return null;\n        }\n    }\n\n    /**\n     * Get or create the BeanManagerInfo for the given ClassLoader.\n     */\n    private BeanManagerInfo getBeanManagerInfo(ClassLoader cl)\n    {\n        BeanManagerInfo bmi = bmpSingleton.bmInfos.get(cl);\n\n        if (bmi == null)\n        {\n            synchronized (this)\n            {\n                bmi = bmpSingleton.bmInfos.get(cl);\n                if (bmi == null)\n                {\n                    bmi = new BeanManagerInfo();\n                    bmpSingleton.bmInfos.put(cl, bmi);\n                    if (cl.getParent() != null && !bmpSingleton.bmInfos.containsKey(cl.getParent()))\n                    {\n                        bmpSingleton.bmInfos.put(cl.getParent(), bmi);\n                    }\n                }\n            }\n        }\n\n        return bmi;\n    }\n\n    /**\n     * This function exists to prevent findbugs from complaining about setting a static member from a non-static\n     * function.\n     *\n     * @param beanManagerProvider the bean-manager-provider which should be used if there isn't an existing provider\n     *\n     * @return the first BeanManagerProvider\n     */\n    private static BeanManagerProvider setBeanManagerProvider(BeanManagerProvider beanManagerProvider)\n    {\n        if (bmpSingleton == null)\n        {\n            bmpSingleton = beanManagerProvider;\n        }\n\n        return bmpSingleton;\n    }\n\n    /**\n     * This method recurses into the parent ClassLoaders and checks whether a BeanManagerInfo for it exists.\n     *\n     * @return the BeanManagerInfo of the parent ClassLoader hierarchy if any exists, or <code>null</code> if there is\n     *         no {@link BeanManagerInfo} for the ClassLoaders in the hierarchy.\n     */\n    private BeanManagerInfo getParentBeanManagerInfo(ClassLoader classLoader)\n    {\n        ClassLoader parentClassLoader = classLoader.getParent();\n        if (parentClassLoader == null)\n        {\n            return null;\n        }\n\n        BeanManagerInfo bmi = getBeanManagerInfo(parentClassLoader);\n        if (bmi == null)\n        {\n            // recursive call up to the root ClassLoader\n            bmi = getParentBeanManagerInfo(parentClassLoader);\n        }\n\n        return bmi;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.provider;\n\nimport jakarta.enterprise.inject.Any;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * This class contains utility methods for resolution of contextual references in situations where no injection is\n * available because the current class is not managed by the CDI Container. This can happen in e.g. a JPA 2.0\n * EntityListener, a ServletFilter, a Spring managed Bean, etc.\n *\n * <p>\n * <b>Attention:</b> This approach is intended for use in user code at runtime. If BeanProvider is used during Container\n * boot (in an Extension), non-portable behaviour results. The CDI specification only allows injection of the\n * BeanManager during CDI container boot time.</p>\n *\n * @see DependentProvider\n * @see BeanManagerProvider\n */\n@Vetoed\npublic final class BeanProvider\n{\n    private static final Logger LOG = Logger.getLogger(BeanProvider.class.getName());\n\n    private static final boolean LOG_DEPENDENT_WARNINGS;\n    static\n    {\n        LOG_DEPENDENT_WARNINGS =\n                Arrays.asList(ProjectStage.Development, ProjectStage.UnitTest).contains(\n                        ProjectStageProducer.getInstance().getProjectStage());\n    }\n\n    private BeanProvider()\n    {\n        // this is a utility class which doesn't get instantiated.\n    }\n\n    /**\n     * Get a Contextual Reference by its type and qualifiers. You can use this method to get contextual references of a\n     * given type. A \"Contextual Reference\" is a proxy which will automatically resolve the correct contextual instance\n     * when you access any method.\n     *\n     * <p>\n     * <b>Attention:</b> You shall not use this method to manually resolve a &#064;Dependent bean! The reason is that\n     * contextual instances usually live in the well-defined lifecycle of their injection point (the bean they got\n     * injected into). But if we manually resolve a &#064;Dependent bean, then it does <b>not</b> belong to such well\n     * defined lifecycle (because &#064;Dependent is not &#064;NormalScoped) and thus will not be automatically\n     * destroyed at the end of the lifecycle. You need to manually destroy this contextual instance via\n     * {@link jakarta.enterprise.context.spi.Contextual#destroy(Object, jakarta.enterprise.context.spi.CreationalContext)}.\n     * Thus you also need to manually store the CreationalContext and the Bean you used to create the contextual\n     * instance.</p>\n     *\n     * @param type       the type of the bean in question\n     * @param qualifiers additional qualifiers which further distinct the resolved bean\n     * @param <T>        target type\n     *\n     * @return the resolved Contextual Reference\n     *\n     * @throws IllegalStateException if the bean could not be found.\n     * @see #getContextualReference(Class, boolean, Annotation...)\n     */\n    public static <T> T getContextualReference(Class<T> type, Annotation... qualifiers)\n    {\n        return getContextualReference(type, false, qualifiers);\n    }\n\n    /**\n     * {@link #getContextualReference(Class, Annotation...)} which returns <code>null</code> if the 'optional' parameter\n     * is set to <code>true</code>.\n     *\n     * @param type       the type of the bean in question\n     * @param optional   if <code>true</code> it will return <code>null</code> if no bean could be found or created.\n     *                   Otherwise it will throw an {@code IllegalStateException}\n     * @param qualifiers additional qualifiers which distinguish the resolved bean\n     * @param <T>        target type\n     *\n     * @return the resolved Contextual Reference\n     *\n     * @see #getContextualReference(Class, Annotation...)\n     */\n    public static <T> T getContextualReference(Class<T> type, boolean optional, Annotation... qualifiers)\n    {\n        BeanManager beanManager = getBeanManager();\n\n        return getContextualReference(beanManager, type, optional, qualifiers);\n    }\n\n    /**\n     * {@link #getContextualReference(Class, Annotation...)} which returns <code>null</code> if the 'optional' parameter\n     * is set to <code>true</code>. This method is intended for usage where the BeanManger is known, e.g. in Extensions.\n     *\n     * @param beanManager the BeanManager to use\n     * @param type        the type of the bean in question\n     * @param optional    if <code>true</code> it will return <code>null</code> if no bean could be found or created.\n     *                    Otherwise it will throw an {@code IllegalStateException}\n     * @param qualifiers  additional qualifiers which further distinct the resolved bean\n     * @param <T>         target type\n     *\n     * @return the resolved Contextual Reference\n     *\n     * @see #getContextualReference(Class, Annotation...)\n     */\n    public static <T> T getContextualReference(BeanManager beanManager,\n                                               Class<T> type,\n                                               boolean optional,\n                                               Annotation... qualifiers)\n    {\n        Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers);\n\n        if (beans == null || beans.isEmpty())\n        {\n            if (optional)\n            {\n                return null;\n            }\n\n            throw new IllegalStateException(\"Could not find beans for Type=\" + type\n                    + \" and qualifiers:\" + Arrays.toString(qualifiers));\n        }\n\n        return getContextualReference(type, beanManager, beans);\n    }\n\n    /**\n     * Get a Contextual Reference by its EL Name. This only works for beans with the &#064;Named annotation.\n     *\n     * <p>\n     * <b>Attention:</b> please see the notes on manually resolving &#064;Dependent beans in\n     * {@link #getContextualReference(Class, java.lang.annotation.Annotation...)}!</p>\n     *\n     * @param name the EL name of the bean\n     *\n     * @return the resolved Contextual Reference\n     *\n     * @throws IllegalStateException if the bean could not be found.\n     * @see #getContextualReference(String, boolean)\n     */\n    public static Object getContextualReference(String name)\n    {\n        return getContextualReference(name, false);\n    }\n\n    /**\n     * Get a Contextual Reference by its EL Name. This only works for beans with the &#064;Named annotation.\n     *\n     * <p>\n     * <b>Attention:</b> please see the notes on manually resolving &#064;Dependent beans in\n     * {@link #getContextualReference(Class, java.lang.annotation.Annotation...)}!</p>\n     *\n     * @param name     the EL name of the bean\n     * @param optional if <code>true</code> it will return <code>null</code> if no bean could be found or created.\n     *                 Otherwise it will throw an {@code IllegalStateException}\n     *\n     * @return the resolved Contextual Reference\n     */\n    public static Object getContextualReference(String name, boolean optional)\n    {\n        return getContextualReference(name, optional, Object.class);\n    }\n\n    /**\n     * Get a Contextual Reference by its EL Name. This only works for beans with the &#064;Named annotation.\n     *\n     * <p>\n     * <b>Attention:</b> please see the notes on manually resolving &#064;Dependent beans in\n     * {@link #getContextualReference(Class, java.lang.annotation.Annotation...)}!</p>\n     *\n     * @param name     the EL name of the bean\n     * @param optional if <code>true</code> it will return <code>null</code> if no bean could be found or created.\n     *                 Otherwise it will throw an {@code IllegalStateException}\n     * @param type     the type of the bean in question - use {@link #getContextualReference(String, boolean)} if the\n     *                 type is unknown e.g. in dyn. use-cases\n     * @param <T>      target type\n     *\n     * @return the resolved Contextual Reference\n     */\n    public static <T> T getContextualReference(String name, boolean optional, Class<T> type)\n    {\n        return getContextualReference(getBeanManager(), name, optional, type);\n    }\n\n    /**\n     * <p>Get a Contextual Reference by its EL Name.\n     * This only works for beans with the &#064;Named annotation.</p>\n     *\n     * <p><b>Attention:</b> please see the notes on manually resolving &#064;Dependent bean\n     * in {@link #getContextualReference(Class, boolean, java.lang.annotation.Annotation...)}!</p>\n     *\n     *\n     * @param beanManager the BeanManager to use\n     * @param name the EL name of the bean\n     * @param optional if <code>true</code> it will return <code>null</code> if no bean could be found or created.\n     *                 Otherwise it will throw an {@code IllegalStateException}\n     * @param type the type of the bean in question - use {@link #getContextualReference(String, boolean)}\n     *             if the type is unknown e.g. in dyn. use-cases\n     * @param <T> target type\n     * @return the resolved Contextual Reference\n     */\n    public static <T> T getContextualReference(BeanManager beanManager, String name, boolean optional, Class<T> type)\n    {\n        Set<Bean<?>> beans = beanManager.getBeans(name);\n\n        if (beans == null || beans.isEmpty())\n        {\n            if (optional)\n            {\n                return null;\n            }\n\n            throw new IllegalStateException(\"Could not find beans for Type=\" + type\n                    + \" and name:\" + name);\n        }\n\n        return getContextualReference(type, beanManager, beans);\n    }\n\n    /**\n     * Get the Contextual Reference for the given bean.\n     *\n     * <p>\n     * <b>Attention:</b> please see the notes on manually resolving &#064;Dependent beans in\n     * {@link #getContextualReference(Class, java.lang.annotation.Annotation...)}!</p>\n     *\n     * @param type the type of the bean in question\n     * @param bean bean definition for the contextual reference\n     * @param <T>  target type\n     *\n     * @return the resolved Contextual Reference\n     */\n    public static <T> T getContextualReference(Class<T> type, Bean<T> bean)\n    {\n        return getContextualReference(type, getBeanManager(), bean);\n    }\n\n    private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Bean<?> bean)\n    {\n        //noinspection unchecked\n        return getContextualReference(type, beanManager, Collections.<Bean<?>> singleton(bean));\n    }\n\n    /**\n     * Get a list of Contextual References by type, regardless of qualifiers (including dependent scoped beans).\n     *\n     * You can use this method to get all contextual references of a given type. A 'Contextual Reference' is a proxy\n     * which will automatically resolve the correct contextual instance when you access any method.\n     *\n     * <p>\n     * <b>Attention:</b> please see the notes on manually resolving &#064;Dependent beans in\n     * {@link #getContextualReference(Class, java.lang.annotation.Annotation...)}!</p>\n     * <p>\n     * <b>Attention:</b> This will also return instances of beans for which an Alternative exists! The &#064;Alternative\n     * resolving is only done via {@link BeanManager#resolve(java.util.Set)} which we cannot use in this case!</p>\n     *\n     * @param type     the type of the bean in question\n     * @param optional if <code>true</code> it will return an empty list if no bean could be found or created. Otherwise\n     *                 it will throw an {@code IllegalStateException}\n     * @param <T>      target type\n     *\n     * @return the resolved list of Contextual Reference or an empty-list if optional is true\n     */\n    public static <T> List<T> getContextualReferences(Class<T> type, boolean optional)\n    {\n        return getContextualReferences(type, optional, true);\n    }\n\n    /**\n     * Get a list of Contextual References by type, regardless of the qualifier.\n     *\n     * Further details are available at {@link #getContextualReferences(Class, boolean)}.\n     * <p>\n     * <b>Attention:</b> please see the notes on manually resolving &#064;Dependent bean in\n     * {@link #getContextualReference(Class, java.lang.annotation.Annotation...)}!</p>\n     * <p>\n     * <b>Attention:</b> This will also return instances of beans for which an Alternative exists! The &#064;Alternative\n     * resolving is only done via {@link BeanManager#resolve(java.util.Set)} which we cannot use in this case!</p>\n     *\n     * @param type                      the type of the bean in question\n     * @param optional                  if <code>true</code> it will return an empty list if no bean could be found or\n     *                                  created. Otherwise it will throw an {@code IllegalStateException}\n     * @param includeDefaultScopedBeans specifies if dependent scoped beans should be included in the result\n     * @param <T>                       target type\n     *\n     * @return the resolved list of Contextual Reference or an empty-list if optional is true\n     */\n    public static <T> List<T> getContextualReferences(Class<T> type,\n                                                      boolean optional,\n                                                      boolean includeDefaultScopedBeans)\n    {\n        BeanManager beanManager = getBeanManager();\n\n        Set<Bean<T>> beans = getBeanDefinitions(type, optional, includeDefaultScopedBeans, beanManager);\n\n        List<T> result = new ArrayList<T>(beans.size());\n\n        for (Bean<?> bean : beans)\n        {\n            //noinspection unchecked\n            result.add(getContextualReference(type, beanManager, bean));\n        }\n        return result;\n    }\n\n    public static <T> DependentProvider<T> getDependent(Class<T> type, Annotation... qualifiers)\n    {\n        BeanManager beanManager = getBeanManager();\n        return getDependent(beanManager, type, qualifiers);\n    }\n\n    public static <T> DependentProvider<T> getDependent(BeanManager beanManager, Class<T> type,\n                                                        Annotation... qualifiers)\n    {\n        Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers);\n        @SuppressWarnings(\"unchecked\")\n        Bean<T> bean = (Bean<T>) beanManager.resolve(beans);\n        return createDependentProvider(beanManager, type, bean);\n    }\n\n    public static <T> DependentProvider<T> getDependent(String name)\n    {\n        BeanManager beanManager = getBeanManager();\n        return getDependent(beanManager, name);\n    }\n\n    public static <T> DependentProvider<T> getDependent(BeanManager beanManager, String name)\n    {\n        Set<Bean<?>> beans = beanManager.getBeans(name);\n        @SuppressWarnings(\"unchecked\")\n        Bean<T> bean = (Bean<T>) beanManager.resolve(beans);\n        @SuppressWarnings(\"unchecked\")\n        Class<T> beanClass = (Class<T>) bean.getBeanClass();\n\n        return createDependentProvider(beanManager, beanClass, bean);\n    }\n\n    private static <T> DependentProvider<T> createDependentProvider(BeanManager beanManager, Class<T> type,\n                                                                    Bean<T> bean)\n    {\n        CreationalContext<T> cc = beanManager.createCreationalContext(bean);\n        @SuppressWarnings(\"unchecked\")\n        T instance = (T) beanManager.getReference(bean, type, cc);\n\n        return new DependentProvider<T>(bean, cc, instance);\n    }\n\n    /**\n     * Get a set of {@link Bean} definitions by type, regardless of qualifiers.\n     *\n     * @param type                      the type of the bean in question\n     * @param optional                  if <code>true</code> it will return an empty set if no bean could be found.\n     *                                  Otherwise it will throw an {@code IllegalStateException}\n     * @param includeDefaultScopedBeans specifies whether dependent scoped beans should be included in the result\n     * @param <T>                       target type\n     *\n     * @return the resolved set of {@link Bean} definitions or an empty set if optional is true\n     */\n    public static <T> Set<Bean<T>> getBeanDefinitions(Class<T> type,\n                                                      boolean optional,\n                                                      boolean includeDefaultScopedBeans)\n    {\n        BeanManager beanManager = getBeanManager();\n        \n        return getBeanDefinitions(type, optional, includeDefaultScopedBeans, beanManager);\n    }\n    \n    /**\n     * Get a set of {@link Bean} definitions by type, regardless of qualifiers.\n     *\n     * @param type                      the type of the bean in question\n     * @param optional                  if <code>true</code> it will return an empty set if no bean could be found.\n     *                                  Otherwise it will throw an {@code IllegalStateException}\n     * @param includeDefaultScopedBeans specifies whether dependent scoped beans should be included in the result\n     * @param <T>                       target type\n     * @param beanManager               the {@link BeanManager} to use\n     *\n     * @return the resolved set of {@link Bean} definitions or an empty set if optional is true\n     */\n    public static <T> Set<Bean<T>> getBeanDefinitions(Class<T> type,\n                                                       boolean optional,\n                                                       boolean includeDefaultScopedBeans,\n                                                       BeanManager beanManager)\n    {\n        Set<Bean<?>> beans = beanManager.getBeans(type, Any.Literal.INSTANCE);\n\n        if (beans == null || beans.isEmpty())\n        {\n            if (optional)\n            {\n                return Collections.emptySet();\n            }\n\n            throw new IllegalStateException(\"Could not find beans for Type=\" + type);\n        }\n\n        if (!includeDefaultScopedBeans)\n        {\n            beans = filterDefaultScopedBeans(beans);\n        }\n        \n        Set<Bean<T>> result = new HashSet<Bean<T>>();\n        \n        for (Bean<?> bean : beans)\n        {\n            //noinspection unchecked\n            @SuppressWarnings(\"unchecked\")\n            Bean<T> beanT = (Bean<T>) bean;\n            result.add(beanT);\n        }\n        \n        return result;\n    }\n    \n    /**\n     * Performs dependency injection on an instance. Useful for instances which aren't managed by CDI.\n     * <p/>\n     * <b>Attention:</b><br/>\n     * The resulting instance isn't managed by CDI; only fields annotated with @Inject get initialized.\n     *\n     * @param instance current instance\n     * @param <T>      current type\n     *\n     * @return instance with injected fields (if possible - or null if the given instance is null)\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <T> T injectFields(T instance)\n    {\n        if (instance == null)\n        {\n            return null;\n        }\n\n        BeanManager beanManager = getBeanManager();\n\n        CreationalContext<T> creationalContext = beanManager.createCreationalContext(null);\n\n        AnnotatedType<T> annotatedType = beanManager.createAnnotatedType((Class<T>) instance.getClass());\n        InjectionTarget<T> injectionTarget = beanManager.getInjectionTargetFactory(annotatedType)\n            .createInjectionTarget(null);\n        injectionTarget.inject(instance, creationalContext);\n        return instance;\n    }\n\n    private static Set<Bean<?>> filterDefaultScopedBeans(Set<Bean<?>> beans)\n    {\n        Set<Bean<?>> result = new HashSet<Bean<?>>(beans.size());\n\n        for (Bean<?> currentBean : beans)\n        {\n            if (!Dependent.class.isAssignableFrom(currentBean.getScope()))\n            {\n                result.add(currentBean);\n            }\n        }\n        return result;\n    }\n\n    /**\n     * Internal helper method to resolve the right bean and resolve the contextual reference.\n     *\n     * @param type the type of the bean in question\n     * @param beanManager current bean-manager\n     * @param beans beans in question\n     * @param <T> target type\n     * @return the contextual reference\n     */\n    private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans)\n    {\n        Bean<?> bean = beanManager.resolve(beans);\n\n        logWarningIfDependent(bean);\n\n        CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean);\n\n        @SuppressWarnings({ \"unchecked\", \"UnnecessaryLocalVariable\" })\n        T result = (T) beanManager.getReference(bean, type, creationalContext);\n        return result;\n    }\n\n    /**\n     * Log a warning if the given bean is of &#064;Dependent scope as we cannot properly clean up the contextual\n     * instance afterwards.\n     */\n    private static void logWarningIfDependent(Bean<?> bean)\n    {\n        if (LOG_DEPENDENT_WARNINGS && bean.getScope().equals(Dependent.class))\n        {\n            LOG.log(Level.WARNING, \"BeanProvider shall not be used to create @Dependent scoped beans. \"\n                    + \"Bean: \" + bean.toString());\n        }\n    }\n\n    /**\n     * Internal method to resolve the BeanManager via the {@link BeanManagerProvider}.\n     *\n     * @return current BeanManager\n     */\n    private static BeanManager getBeanManager()\n    {\n        return BeanManagerProvider.getInstance().getBeanManager();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/DependentProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.provider;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport jakarta.inject.Provider;\n\nimport java.io.IOException;\nimport java.io.NotSerializableException;\nimport java.io.ObjectInputStream;\nimport java.io.ObjectOutputStream;\nimport java.io.Serializable;\n\n/**\n * A {@link Provider} for &#064;Dependent scoped contextual instances. We need this to be able to properly clean them up\n * when they are not needed anymore via the {@link #destroy()} method.\n *\n * Instances of this class can be retrieved using the {@link BeanProvider}.\n *\n * Instances of this class are Serializable if the wrapped contextual instance is Serializable.\n *\n * @see BeanProvider#getDependent(java.lang.Class, java.lang.annotation.Annotation...)\n */\npublic class DependentProvider<T> implements Provider<T>, Serializable\n{\n    private static final long serialVersionUID = 23423413412001L;\n\n    private T instance;\n    private CreationalContext<T> creationalContext;\n    private transient Bean<T> bean;\n\n    DependentProvider(Bean<T> bean, CreationalContext<T> creationalContext, T instance)\n    {\n        this.bean = bean;\n        this.creationalContext = creationalContext;\n        this.instance = instance;\n    }\n\n    @Override\n    public T get()\n    {\n        return instance;\n    }\n\n    /**\n     * This method will properly destroy the &#064;Dependent scoped instance.\n     * It will have no effect if the bean is NormalScoped as those have their\n     * own lifecycle which we must not disrupt.\n     */\n    public void destroy()\n    {\n        if (!BeanManagerProvider.getInstance().getBeanManager().isNormalScope(bean.getScope()))\n        {\n            bean.destroy(instance, creationalContext);\n        }\n    }\n\n    private void writeObject(ObjectOutputStream out) throws IOException\n    {\n        if (!(bean instanceof PassivationCapable))\n        {\n            throw new NotSerializableException(\"Bean is not PassivationCapable: \" + bean.toString());\n        }\n        String passivationId = ((PassivationCapable) bean).getId();\n        if (passivationId == null)\n        {\n            throw new NotSerializableException(bean.toString());\n        }\n\n        out.writeLong(serialVersionUID);\n        out.writeObject(passivationId);\n        out.writeObject(instance);\n        out.writeObject(creationalContext);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException\n    {\n        long oldSerialId = in.readLong();\n        if (oldSerialId != serialVersionUID)\n        {\n            throw new NotSerializableException(getClass().getName() + \" serialVersion does not match\");\n        }\n        String passivationId = (String) in.readObject();\n        bean = (Bean<T>) BeanManagerProvider.getInstance().getBeanManager().getPassivationCapableBean(passivationId);\n        instance = (T) in.readObject();\n        creationalContext = (CreationalContext<T>) in.readObject();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/scope/ConversationGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.scope;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * \n * @see GroupedConversationScoped\n * @see ConversationSubGroup\n */\n@Target( { PARAMETER, FIELD, METHOD, CONSTRUCTOR, TYPE } )\n@Retention(RUNTIME)\n@Documented\n\n@Qualifier\npublic @interface ConversationGroup\n{\n    /**\n     * Class or interface which should be used as type-safe key for identification of the conversation group.\n     *\n     * @return class or interface which should be used as key\n     */\n    Class<?> value();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/scope/ConversationSubGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.scope;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Represents a subgroup of a conversation group. Useful for closing a subset of {@code @GroupConversationScoped} beans\n * in a {@code ConversationGroup}.\n *\n * <pre>\n * public class MyGroup{}\n *\n * &#064;ConversationScoped\n * &#064;ConversationGroup(MyGroup.class)\n * public class BeanA {}\n *\n * &#064;ConversationScoped\n * &#064;ConversationGroup(MyGroup.class)\n * public class BeanB {}\n *\n * &#064;ConversationScoped\n * &#064;ConversationGroup(MyGroup.class)\n * public class BeanC {}\n *\n * &#064;ConversationSubGroup(of = MyGroup.class, subGroup = {BeanA.class, BeanB.class})\n * public class MySubGroup {}\n * </pre> or\n * <pre>\n * &#064;ConversationSubGroup(subGroup = {BeanA.class, BeanB.class})\n * public class MySubGroup extends MyGroup {}\n *\n * //...\n * this.groupedConversationManager.closeConversation(MySubGroup.class)\n * </pre> or it's possible to use implicit subgroups (point to the interface instead of the bean class itself):\n * <pre>\n * public interface MyUseCase {}\n *\n * &#064;ConversationSubGroup(of = MyGroup.class, subGroup = MyUseCase.class)\n * public class ImplicitSubGroup {}\n *\n * &#064;Named(\"myController\")\n * &#064;ConversationScoped\n * &#064;ConversationGroup(MyGroup.class)\n * public class MyController implements Serializable, MyUseCase\n * {\n *    //...\n * }\n * //...\n * this.groupedConversationManager.closeConversation(ImplicitSubGroup.class)\n * </pre>\n * \n * @see ConversationGroup\n * @see GroupedConversationScoped\n */\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\npublic @interface ConversationSubGroup\n{\n    /**\n     * Optionally defines the base conversation group.\n     *\n     * @return base conversation group or ConversationSubGroup if the subgroup inherits from the base conversation group\n     */\n    Class<?> of() default ConversationSubGroup.class;\n\n    /**\n     * Members of the subgroup.\n     *\n     * @return beans to include in the subgroup\n     */\n    Class<?>[] subGroup();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/scope/GroupedConversation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.scope;\n\nimport java.io.Serializable;\n\npublic interface GroupedConversation extends Serializable\n{\n    void close();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/scope/GroupedConversationScoped.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.scope;\n\nimport jakarta.enterprise.context.NormalScope;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target( { METHOD,TYPE,FIELD } )\n@Retention(RUNTIME)\n@Inherited\n@Documented\n@NormalScope(passivating = true)\npublic @interface GroupedConversationScoped\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/scope/ViewAccessScoped.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.scope;\n\nimport jakarta.enterprise.context.NormalScope;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * The scope is active as long as its bean is accessed by a view. Basically &#064;ViewAccessScoped is a DeltaSpike\n * Conversation which automatically gets ended when the next view tree gets restored without hitting the bean.\n */\n@Target( { METHOD,TYPE,FIELD } )\n@Retention(RUNTIME)\n@Inherited\n@Documented\n@NormalScope(passivating = true)\npublic @interface ViewAccessScoped\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/scope/WindowScoped.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.scope;\n\nimport jakarta.enterprise.context.NormalScope;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Beans in this scope are bound to an application window (or browser tab).\n */\n@Target( { METHOD,TYPE,FIELD } )\n@Retention(RUNTIME)\n@Inherited\n@Documented\n@NormalScope(passivating = true)\npublic @interface WindowScoped\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/throttling/Throttled.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.throttling;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.concurrent.TimeUnit;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Mark a bean/method as relying on a throttler.\n */\n@InterceptorBinding\n@Retention(RUNTIME)\n@Target({ TYPE, METHOD })\npublic @interface Throttled\n{\n    /**\n     * @return the duration to wait to acquire the permits.\n     */\n    @Nonbinding\n    long timeout() default 0L;\n\n    /**\n     * @return the unit of timeout().\n     */\n    @Nonbinding\n    TimeUnit timeoutUnit() default TimeUnit.MILLISECONDS;\n\n    /**\n     * @return how many permits to require.\n     */\n    @Nonbinding\n    int weight() default 1;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/throttling/Throttling.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.api.throttling;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport java.util.concurrent.Semaphore;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Configure the throttler associated to the class/method.\n */\n@Retention(RUNTIME)\n@Target({ TYPE, METHOD })\npublic @interface Throttling\n{\n    /**\n     * @return how to get the semaphore. Default to a plain Semaphore of the JVM.\n     */\n    @Nonbinding\n    Class<? extends SemaphoreFactory> factory() default SemaphoreFactory.class;\n\n    /**\n     * @return true if the semaphore is fair false otherwise.\n     */\n    @Nonbinding\n    boolean fair() default false;\n\n    /**\n     * @return how many permits has the semaphore.\n     */\n    @Nonbinding\n    int permits() default 1;\n\n    /**\n     * @return name/bucket of this configuration (allow to have multiple buckets per class but default is 1 per class).\n     */\n    @Nonbinding\n    String name() default \"\";\n\n    interface SemaphoreFactory\n    {\n        /**\n         * @param method the intercepted method.\n         * @param name bucket name.\n         * @param fair should the semaphore be fair.\n         * @param permits maximum permits the semaphore shoulg get.\n         * @return the semaphore build accordingly the parameters.\n         */\n        Semaphore newSemaphore(AnnotatedMethod<?> method, String name, boolean fair, int permits);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/InterceptorStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi;\n\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n/**\n * Base interface for all interceptor strategies which allow to provide\n * custom implementations for DeltaSpike interceptors.\n */\npublic interface InterceptorStrategy extends Serializable\n{\n    /**\n     * Method which will be invoked by the interceptor method annotated with {@link jakarta.interceptor.AroundInvoke}\n     * @param invocationContext current invocation-context\n     * @return result of the intercepted method\n     * @throws Exception exception which might be thrown by the intercepted method\n     */\n    Object execute(InvocationContext invocationContext) throws Exception;\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/ClassDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.activation;\n\nimport java.io.Serializable;\n\n/**\n * <p>DeltaSpike allows you to deactivate pre-configured parts (like Extensions, event-broadcasters,...).\n * Therefore DeltaSpike offers {@link ClassDeactivator} and {@link Deactivatable}.</p>\n *\n * <p>A {@link ClassDeactivator} allows to specify deactivated classes (if they implement {@link Deactivatable})\n * which can't be deactivated/customized via std. CDI mechanisms\n * (like the veto-method or alternative/specialized CDI-beans).\n * This might be the case e.g. for CDI Extensions because CDI mechanisms are not available at startup time.</p>\n *\n * <p>Use it mainly to deactivate specific parts explicitly (blacklist approach),\n * if there is an issue with such parts (and waiting for the next release isn't an option).</p>\n *\n * <p>A class-deactivator will be resolved from the environment via the default resolvers or via a custom resolver which\n * allows to use any type of configuration-format. See {@link org.apache.deltaspike.core.api.config.ConfigResolver}\n * for more information about how to configure it. The configuration key is\n * <code>org.apache.deltaspike.core.spi.activation.ClassDeactivator</code></p>\n *\n * <p>All ClassDeactivators will get picked up in order of their ordinal and might explicitly activate or\n * deactivate {@link Deactivatable} classes. Returning a <code>null</code> value means that the ClassDeactivator\n * doesn't care about the Deactivatable class.</p>\n *\n * <p>An implementation has to be stateless.</p>\n */\npublic interface ClassDeactivator extends Serializable\n{\n    /**\n     * Provides classes which should be deactivated.\n     *\n     * @param targetClass class which should be checked\n     * @return {@link Boolean#FALSE} if class should get activated, {@link Boolean#FALSE} if class must be available\n     *         and <code>null</code> to let it as is (defined by default or other\n     */\n    Boolean isActivated(Class<? extends Deactivatable> targetClass);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/activation/Deactivatable.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.activation;\n\n/**\n * <p>Interface to allow easier detection of deactivatable classes.</p>\n *\n * <p>These classes are activated by default and can be disabled on demand (e.g. via CDI config).\n * Since CDI, JSF,... currently don't allow to deactivate default implementations,\n * DeltaSpike has to introduce a proprietary mechanism.</p>\n *\n * <p>This is e.g. used to disable CDI Extensions in DeltaSpike and might get\n * used for other Extension libraries as well.</p>\n *\n * <p><b>Note:</b> It is suggested that the implementations\n * use the {@link org.apache.deltaspike.core.util.ClassDeactivationUtils} for implementing the lookup</p>\n */\npublic interface Deactivatable\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/BaseConfigPropertyProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config;\n\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.BeanUtils;\n\n/**\n * <p>This contains the fundamental parts for implementing own\n * ConfigProperty producers.</p>\n *\n * <h2>Providing own Converters and Type injection</h2>\n * <p>DeltaSpikes own configuration system natively supports only Strings.\n * If you'd like to apply own Converters or extract other types from those Strings,\n * you can simply do this by providing an own Qualifier and a simple\n * CDI producer method for it.</p>\n *\n * <p>First we write a simple Qualifier:\n * <pre>\n * &#064;Target({ PARAMETER, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE })\n * &#064;Retention(RUNTIME)\n * &#064;ConfigProperty(named=\"unused\") // the name\n * &#064;Qualifier\n * public @interface NumberConfig\n * {\n *     &#064;Nonbinding\n *     boolean name(); // the name of the configuration-key to lookup the value\n *\n *     &#064;Nonbinding\n *     String defaultValue() default ConfigProperty.NULL;\n *\n *     &#064;Nonbinding\n *     boolean pattern(); // the pattern for NumberFormatter\n * }\n * </pre>\n * </p>\n *\n * <p>The producer method implementation is pretty easy as well:\n * <pre>\n * &#064;ApplicationScoped\n * public class NumberConfigProducer extends BaseConfigPropertyProducer\n * {\n *     &#064;Produces\n *     &#064;Dependent\n *     &#064;NumberConfig\n *     public Float produceNumberConfig(InjectionPoint injectionPoint)\n *     {\n *         // resolve the annotation\n *         NumberConfig metaData = getAnnotation(injectionPoint, NumberConfig.class);\n\n *         // get the configured value from the underlying configuration system\n *         String configuredValue = getPropertyValue(metaData.name(), metaData.defaultValue());\n *         if (configuredValue == null)\n *         {\n *             return null;\n *         }\n *\n *         // format according to the given pattern\n *         DecimalFormat df = new DecimalFormat(metaData.pattern(), new DecimalFormatSymbols(Locale.US));\n *         return df.parse(configuredValue).floatValue();\n *     }\n * }\n * </pre>\n * </p>\n\n */\npublic abstract class BaseConfigPropertyProducer\n{\n    /**\n     * <p>Inspects the given InjectionPoint and search for a {@link ConfigProperty}\n     * annotation or an Annotation with a {@link ConfigProperty} meta-Annotation.\n     * The name and defaultValue information will be used to resolve the\n     * configured value.</p>\n     *\n     * @param injectionPoint current injection point\n     * @return the configured value for the given InjectionPoint\n     */\n    protected String getStringPropertyValue(InjectionPoint injectionPoint)\n    {\n        ConfigProperty configProperty = getAnnotation(injectionPoint, ConfigProperty.class);\n\n        if (configProperty == null)\n        {\n            throw new IllegalStateException(\"producer method called without @ConfigProperty being present!\");\n        }\n\n        return getPropertyValue(injectionPoint, String.class);\n    }\n\n    protected <T> T getPropertyValue(InjectionPoint injectionPoint, Class<T> ipCls)\n    {\n        return getUntypedPropertyValue(injectionPoint, ipCls);\n    }\n\n    protected <T> T getUntypedPropertyValue(InjectionPoint injectionPoint, Type ipCls)\n    {\n        ConfigProperty configProperty = getAnnotation(injectionPoint, ConfigProperty.class);\n\n        if (configProperty == null)\n        {\n            throw new IllegalStateException(\"producer method called without @ConfigProperty being present!\");\n        }\n\n        return readEntry(configProperty.name(), configProperty.defaultValue(), ipCls,\n                configProperty.converter(), configProperty.parameterizedBy(),\n                configProperty.projectStageAware(), configProperty.evaluateVariables());\n    }\n\n    /**\n     * @param propertyName the name of the property key\n     * @param defaultValue the default value to return if no configured property is found or\n     *                     {@link ConfigProperty#NULL} if no default value should be returned.\n     * @return the configured value or the defaultValue according to the NULL logic.\n     */\n    protected String getPropertyValue(String propertyName, String defaultValue)\n    {\n        String configuredValue;\n        if (ConfigProperty.NULL.equals(defaultValue))\n        {\n            // no special defaultValue has been configured\n            configuredValue = ConfigResolver.getProjectStageAwarePropertyValue(propertyName);\n        }\n        else\n        {\n            configuredValue = ConfigResolver.getProjectStageAwarePropertyValue(propertyName, defaultValue);\n        }\n        return configuredValue;\n    }\n\n    /**\n     * @param injectionPoint current injection point\n     * @param targetType target type\n     * @param <T> type\n     * @return annotation instance extracted from the injection point which matches the given type\n     */\n    protected <T extends Annotation> T getAnnotation(InjectionPoint injectionPoint, Class<T> targetType)\n    {\n        return BeanUtils.extractAnnotation(injectionPoint.getAnnotated(), targetType);\n    }\n\n    public <T> T readEntry(final String key, final String stringDefault, final Type ipCls,\n                           final Class<? extends ConfigResolver.Converter> converterType,\n                           final String parameterizedBy, final boolean projectStageAware, final boolean evaluate)\n    {\n        final ConfigResolver.TypedResolver<T> resolver = asResolver(\n                key, stringDefault, ipCls, converterType, parameterizedBy, projectStageAware, evaluate);\n        return resolver.getValue();\n    }\n\n    public <T> ConfigResolver.TypedResolver<T> asResolver(final String key, final String stringDefault,\n                                                          final Type ipCls,\n                                                          final Class<? extends ConfigResolver.Converter> converterType,\n                                                          final String parameterizedBy,\n                                                          final boolean projectStageAware, final boolean evaluate)\n    {\n        final Config config = ConfigResolver.getConfig();\n        final ConfigResolver.UntypedResolver<String> untypedResolver = config.resolve(key);\n\n        final ConfigResolver.TypedResolver<T> resolver;\n\n        if (ConfigResolver.Converter.class != converterType)\n        {\n            resolver = untypedResolver.as(ipCls, BeanProvider.getContextualReference(converterType));\n        }\n        else if (converterExists(config, ipCls))\n        {\n            resolver = untypedResolver.as(Class.class.cast(ipCls));\n        }\n        else\n        {\n            resolver = untypedResolver.asBean(Class.class.cast(ipCls));\n        }\n\n        resolver.withCurrentProjectStage(projectStageAware);\n\n        if (!ConfigProperty.NULL.equals(stringDefault))\n        {\n            resolver.withStringDefault(stringDefault);\n        }\n        if (!ConfigProperty.NULL.equals(parameterizedBy))\n        {\n            resolver.parameterizedBy(parameterizedBy);\n        }\n        return resolver.evaluateVariables(evaluate);\n    }\n\n    /**\n     * TODO we should make Converters for single attributes configurable.\n     * Until then the list is fixed.\n     * See TypedResolverImpl#convert\n     */\n    private boolean converterExists(Config config, Type ipCls)\n    {\n        return (String.class == ipCls ||\n                Integer.class == ipCls ||\n                Boolean.class == ipCls ||\n                Long.class == ipCls ||\n                Float.class == ipCls ||\n                Double.class == ipCls ||\n                Class.class == ipCls\n                );\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config;\n\n/**\n * <p>A filter which can be added to the\n * {@link org.apache.deltaspike.core.api.config.ConfigResolver}.\n * The filter can be used to decrypt config values or prepare\n * values for logging.</p>\n *\n * <p>Registering a {@code ConfigFilter} can either be done via the\n * {@code java.util.ServiceLoader} pattern or by manually adding it via\n * {@link org.apache.deltaspike.core.api.config.ConfigResolver#addConfigFilter(ConfigFilter)}.</p>\n */\npublic interface ConfigFilter\n{\n    /**\n     * Filter the given configuration value\n     * @param key\n     * @param value\n     * @return the filtered value or the original input String if no filter shall be applied\n     */\n    String filterValue(String key, String value);\n\n    /**\n     * Filter the given configuration value for usage in logs.\n     * This might be used to mask out passwords, etc.\n     * @param key\n     * @param value\n     * @return the filtered value or the original input String if no filter shall be applied\n     */\n    String filterValueForLog(String key, String value);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config;\n\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Consumer;\n\n/**\n * <p>Implement this interfaces to provide a ConfigSource.\n * A ConfigSource provides properties from a specific place, like\n * JNDI configuration, a properties file, etc</p>\n * \n * <p>The custom implementation can be 'registered' using a\n * {@link ConfigSourceProvider} or via the\n * {@link java.util.ServiceLoader} mechanism. In the later case\n * it must get registered via creating a\n * <i>META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource</i>\n * file and adding the fully qualified class name of your ConfigSource\n * implementation into it. </p>\n *\n * <p>If a ConfigSource implements the {@link java.lang.AutoCloseable} interface it will automatically\n * be released when the Config is shut down.</p>\n */\npublic interface ConfigSource\n{\n    /**\n     * The default name for the ordinal field.\n     * Any ConfigSource might use it's own though or even return a hardcoded\n     * in {@link #getOrdinal()}.\n     */\n    String DELTASPIKE_ORDINAL = \"deltaspike_ordinal\";\n\n    /**\n     * The default value if no special ordinal is defined for this ConfigSource.\n     */\n    int DELTASPIKE_DEFAULT_ORDINAL = 100;\n    \n    /**\n     * Lookup order:\n     *\n     * <ol>\n     *     <li>System properties (ordinal 400)</li>\n     *     <li>Environment properties (ordinal 300)</li>\n     *     <li>JNDI values (ordinal 200)</li>\n     *     <li>Properties file values (/META-INF/apache-deltaspike.properties) (ordinal 100)</li>\n     * </ol>\n     * <p/>\n     * <p><b>Important Hints for custom implementations</b>:</p>\n     * <p>\n     * If a custom implementation should be invoked <b>before</b> the default implementations, use a value &gt; 400\n     * </p>\n     * <p>\n     * If a custom implementation should be invoked <b>after</b> the default implementations, use a value &lt; 100\n     * </p>\n     * <p>\n     *\n     *     <b>IMPORTANT: </b> Have a look at the abstract base-implementation DeltaSpike is using internally,\n     *     if a custom implementation should load the ordinal value from the config-source like the default\n     *     implementations provided by DeltaSpike do.\n     *\n     * </p>\n     * <p/>\n     * <p>Reordering of the default order of the config-sources:</p>\n     * <p>Example: If the properties file/s should be used <b>before</b> the other implementations,\n     * you have to configure an ordinal &gt; 400. That means, you have to add e.g. deltaspike_ordinal=401 to\n     * /META-INF/apache-deltaspike.properties . Hint: In case of property files every file is handled as independent\n     * config-source, but all of them have ordinal 400 by default (and can be reordered in a fine-grained manner.</p>\n     *\n     * <p>This method will only get evaluated once at startup and whenever a new ConfigSource is added.</p>\n     *\n     * @return the 'importance' aka ordinal of the configured values. The higher, the more important.\n     */\n    default int getOrdinal()\n    {\n        String ordinal = getPropertyValue(DELTASPIKE_ORDINAL);\n        if (ordinal != null && ordinal.length() > 0)\n        {\n            return Integer.valueOf(ordinal);\n        }\n        return DELTASPIKE_DEFAULT_ORDINAL;\n    }\n\n    /**\n     * Return properties contained in this config source.\n     * @return Properties available in this config source.\n     */\n    Map<String, String> getProperties();\n\n    /**\n     * @param key for the property\n     * @return configured value or <code>null</code> if this ConfigSource doesn't provide any value for the given key.\n     */\n    String getPropertyValue(String key);\n\n    /**\n     * @return the 'name' of the configuration source, e.g. 'property-file mylocation/myproperty.properties'\n     */\n    String getConfigName();\n    \n    /**\n     * Determines if this config source should be scanned for its list of properties.\n     * \n     * Generally, slow ConfigSources should return false here. \n     * \n     * @return true if this ConfigSource should be scanned for its list of properties, \n     * false if it should not be scanned.\n     */\n    default boolean isScannable()\n    {\n        return true;\n    }\n\n    /**\n     * This callback should get invoked if an attribute change got detected inside the ConfigSource.\n     *\n     * An example would be a database backed ConfigSource which scans the DB every second in a background task.\n     * And once it detects a change in values, it will notify the Config about the changed attributes\n     * by invoking {@code reportAttributeChange.accept(changedKeys);}\n     *\n     * @param reportAttributeChange will be set by the {@link org.apache.deltaspike.core.api.config.Config} after this\n     *                              {@code ConfigSource} got created and before any configured values\n     *                              get served.\n     */\n    default void setOnAttributeChange(Consumer<Set<String>> reportAttributeChange)\n    {\n        // do nothing by default. Just for compat with older ConfigSources.\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config;\n\nimport java.util.List;\n\n/**\n * <p>Implement this interfaces to provide a ConfigSource provider which\n * is able to maintain multiple ConfigSources. This is e.g. needed if\n * there are multiple property files of a given name.</p>\n * \n * <p>If a ConfigSource like JNDI only exists once, then there is no need\n * to implement it via the ConfigSourceProvider but should directly\n * expose a {@link ConfigSource}.</p>\n *\n * <p>A ConfigSourceProvider will get picked up via the\n * {@link java.util.ServiceLoader} mechanism and must get registered via\n * META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider</p>\n */\npublic interface ConfigSourceProvider\n{\n\n    /**\n     * @return For each e.g. property file, we return a single ConfigSource or an empty list if no ConfigSource exists.\n     */\n    List<ConfigSource> getConfigSources();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config;\n\nimport java.util.Set;\n\npublic interface ConfigValidator\n{\n    /**\n     * @return a set of violation-messages if an invalid state is found\n     * those messages will be used to add one deployment-problem per message\n     */\n    Set<String> processValidation();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigDescriptorValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\n\n/**\n * Allows to validate the final view-config descriptors before they get deployed.\n * Since the config-descriptor contains e.g. the final path,\n * it's also possible to validate if the corresponding file exists.\n * Use {@link ViewConfigRoot} to configure 1-n validators.\n */\npublic interface ConfigDescriptorValidator\n{\n    /**\n     * Validates the given config-descriptor\n     * @param configDescriptor (merged) config-descriptor directly before it gets deployed\n     * @return true if the descriptor is valid, false otherwise\n     */\n    boolean isValid(ConfigDescriptor configDescriptor);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigNodeConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\n\n/**\n * Allows to provide multiple strategies to process the nodes of the built config-tree.\n * Use {@link ViewConfigRoot} to configure a custom converter.\n */\npublic interface ConfigNodeConverter\n{\n    /**\n     * Converts a {@link ViewConfigNode} created during the scanning process to the final {@link ConfigDescriptor}\n     * used at runtime\n     */\n    ConfigDescriptor convert(ViewConfigNode node);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigPreProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport java.lang.annotation.Annotation;\n\n/**\n * Allows to change the found meta-data (e.g. replace default values - example:\n * Page.extension needs \"\" as a default for the meta-data-merging process, but \"xhtml\" should be the final default)\n * or the {@link ViewConfigNode} itself. E.g. to register callbacks supported by the meta-data\n * (see {@link org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData#preProcessor()} )\n *\n * @param <T> meta-data type\n */\npublic interface ConfigPreProcessor<T extends Annotation>\n{\n    /**\n     * @param metaData The annotation-instance which was found or the inherited instance.\n     *                 Since it's possible to override annotation-attributes alongside the inheritance-path,\n     *                 it can be a merged representation.\n     *                 To get rid of meta-data which is only inherited,\n     *                 it's required to check the presence of the physical annotation e.g. via\n     *                 ViewConfigNode#getSource#isAnnotationPresent\n     *                 and return a synthetic literal-instance (as a marker/placeholder),\n     *                 because 'null' isn't supported as return-value.\n     * @param viewConfigNode Instance which represents the current node\n     * @return The annotation-instance which should be used for the final meta-data\n     */\n    T beforeAddToConfig(T metaData, ViewConfigNode viewConfigNode);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/InlineMetaDataTransformer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport java.lang.annotation.Annotation;\n\n/**\n * Allows to transform an annotation annotated with @InlineViewMetaData to an annotation annotated with @ViewMetaData.\n * This transformer is optional and only needed if it should result in the same at runtime, but the inline-meta-data\n * needs a different syntax via a different annotation (compared to the view-config meta-data).\n * E.g. see @ViewRef vs. @ViewControllerRef.\n *\n * @param <I> type of the inline-meta-data\n * @param <T> type of the target-meta-data\n */\npublic interface InlineMetaDataTransformer\n        <I extends Annotation /*inline metadata*/, T extends Annotation /*target metadata*/>\n{\n    T convertToViewMetaData(I inlineMetaData, Class<?> sourceClass);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/TargetViewConfigProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport java.lang.annotation.Annotation;\n\n/**\n * It's restricted to reference {@link ViewConfig} classes to force more solid references.\n * (This restriction is intended.)\n * To reference folder-nodes, it's needed that the corresponding config-class implements {@link ViewConfig} as well.\n *\n * It's used instead of a marker annotation to be more flexible (e.g. for special cases like conditional references).\n *\n * @param <T> type of the annotation which provides the information about the target view-config/s\n */\npublic interface TargetViewConfigProvider<T extends Annotation>\n{\n    Class<? extends ViewConfig>[] getTarget(T inlineMetaData);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigInheritanceStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\n\n/**\n * Allows to customize the inheritance-strategy for meta-data.\n * E.g. inheritance via std. java inheritance vs. inheritance via nested interfaces.\n * Use {@link ViewConfigRoot} to configure a custom inheritance-strategy.\n */\npublic interface ViewConfigInheritanceStrategy\n{\n    /**\n     * @param viewConfigNode current view-config node\n     * @return annotation instances which should be merged with the annotation instances of the node itself\n     */\n    List<Annotation> resolveInheritedMetaData(ViewConfigNode viewConfigNode);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigNode.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\n/**\n * Node-type used for building the meta-data-tree during the bootstrapping process.\n */\npublic interface ViewConfigNode\n{\n    ViewConfigNode getParent();\n\n    List<ViewConfigNode> getChildren();\n\n    Class<?> getSource();\n\n    Set<Annotation> getMetaData();\n\n    List<Annotation> getInheritedMetaData();\n\n    Map<Class<? extends Annotation>, List<CallbackDescriptor>> getCallbackDescriptors();\n\n    //TODO\n    List<CallbackDescriptor> getCallbackDescriptors(Class<? extends Annotation> metaDataType);\n\n    void registerCallbackDescriptors(Class<? extends Annotation> metaDataType, CallbackDescriptor callbackDescriptor);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigRoot.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Allows to customize the default behaviour for processing the meta-data-tree\n */\n\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\n\n/**\n * Optional annotation which allows to provide custom implementations.\n * Only annotate one {@link org.apache.deltaspike.core.api.config.view.ViewConfig} class which represents the root node.\n */\npublic @interface ViewConfigRoot\n{\n    Class<? extends ViewConfigResolver> viewConfigResolver()\n        default ViewConfigResolver.class;\n\n    Class<? extends ConfigNodeConverter> configNodeConverter()\n        default ConfigNodeConverter.class;\n\n    Class<? extends ViewConfigInheritanceStrategy> viewConfigInheritanceStrategy()\n        default ViewConfigInheritanceStrategy.class;\n\n    Class<? extends ConfigDescriptorValidator>[] configDescriptorValidators()\n        default { };\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/filter/ClassFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.filter;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\npublic interface ClassFilter extends Deactivatable\n{\n    boolean isFiltered(Class<?> currentClass);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/future/FutureableStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.future;\n\nimport org.apache.deltaspike.core.spi.InterceptorStrategy;\n\npublic interface FutureableStrategy extends InterceptorStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/lock/LockedStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.lock;\n\nimport org.apache.deltaspike.core.spi.InterceptorStrategy;\n\npublic interface LockedStrategy extends InterceptorStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/scope/conversation/GroupedConversationManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.scope.conversation;\n\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.util.Set;\n\npublic interface GroupedConversationManager extends Serializable\n{\n    /**\n     * @param conversationGroup group of the conversation in question\n     * @param qualifiers        optional qualifiers for the conversation\n     * @return the removed conversation - null otherwise\n     */\n    ContextualStorage closeConversation(Class<?> conversationGroup, Annotation... qualifiers);\n\n    /**\n     * destroys all conversation of a group independent of the qualifiers\n     *\n     * @param conversationGroup group of the conversation in question\n     * @return the removed storages - null otherwise\n     */\n    Set<ContextualStorage> closeConversationGroup(Class<?> conversationGroup);\n\n    /**\n     * invalidate all conversations immediately (within the current window)\n     */\n    void closeConversations();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/scope/viewaccess/ViewAccessContextManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.scope.viewaccess;\n\nimport java.io.Serializable;\n\npublic interface ViewAccessContextManager extends Serializable\n{\n    void close();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/scope/window/WindowContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.scope.window;\n\nimport java.io.Serializable;\n\n/**\n * <p>We support the general notion of multiple 'windows'\n * That might be different parallel edit pages in a\n * desktop application (think about different open documents\n * in an editor) or multiple browser tabs in a\n * web application.</p>\n * <p>For web applications each browser tab or window will be\n * represented by an own {@link WindowContext} slice. All those\n * {@link WindowContext} slices will be held in the users servlet\n * session as &#064;SessionScoped bean.\n * </p>\n * <p>Every WindowContext is uniquely identified via a\n * 'windowId' inside the current Session.\n * Each Thread is associated with at most\n * one single windowId at a time. The {@link WindowContext}\n * is the interface which allows resolving the current <i>windowId</i>\n * associated with this very Thread.</p>\n */\npublic interface WindowContext extends Serializable\n{\n    /**\n     * @return the <i>windowId</i> associated with the very Thread or <code>null</code>.\n     */\n    String getCurrentWindowId();\n\n    /**\n     * Set the current windowId as the currently active for the very Thread.\n     * If no WindowContext exists with the very windowId we will create a new one.\n     * @param windowId\n     */\n    void activateWindow(String windowId);\n\n    /**\n     * close the WindowContext with the given windowId.\n     * @return <code>true</code> if any did exist, <code>false</code> otherwise\n     */\n    boolean closeWindow(String windowId);\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/scope/window/WindowContextQuotaHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.scope.window;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport java.io.Serializable;\n\n/**\n * Allows to create a custom handler for a custom window-quota\n */\npublic interface WindowContextQuotaHandler extends Deactivatable, Serializable\n{\n    void checkWindowContextQuota(String windowId);\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/throttling/ThrottledStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.spi.throttling;\n\nimport org.apache.deltaspike.core.spi.InterceptorStrategy;\n\npublic interface ThrottledStrategy extends InterceptorStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AggregatedClassLoader.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport java.io.IOException;\nimport java.net.URL;\nimport java.util.Arrays;\nimport java.util.Enumeration;\nimport java.util.Iterator;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Set;\n\npublic class AggregatedClassLoader extends ClassLoader\n{\n\n    private final List<ClassLoader> classLoaders;\n\n    public AggregatedClassLoader(List<ClassLoader> classLoaders)\n    {\n        super();\n        this.classLoaders = classLoaders;\n    }\n\n    public static AggregatedClassLoader newInstance()\n    {\n        return new AggregatedClassLoader(Arrays.asList(\n                AggregatedClassLoader.class.getClassLoader(),\n                Thread.currentThread().getContextClassLoader(),\n                ClassLoader.getSystemClassLoader()));\n    }\n\n    @Override\n    public URL getResource(String name)\n    {\n        for (ClassLoader loader : classLoaders)\n        {\n            URL url = loader.getResource(name);\n            if (url != null)\n            {\n                return url;\n            }\n        }\n        return super.getResource(name);\n    }\n\n    @Override\n    public Enumeration<URL> getResources(String name) throws IOException\n    {\n        final Set<URL> result = new LinkedHashSet<URL>();\n        \n        for (ClassLoader loader : classLoaders)\n        {\n            Enumeration<URL> urls = loader.getResources(name);\n            while (urls.hasMoreElements())\n            {\n                result.add(urls.nextElement());\n            }\n        }\n        \n        return new Enumeration<URL>()\n        {\n            private final Iterator<URL> iterator = result.iterator();\n\n            @Override\n            public URL nextElement()\n            {\n                return iterator.next();\n            }\n\n            @Override\n            public boolean hasMoreElements()\n            {\n                return iterator.hasNext();\n            }\n        };\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/Annotateds.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.AnnotatedCallable;\nimport jakarta.enterprise.inject.spi.AnnotatedConstructor;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\n/**\n * <p>\n * Utilities for working with {@link Annotated}s.\n * </p>\n * <p/>\n * <p>\n * Includes utilities to check the equality of and create unique id's for\n * <code>Annotated</code> instances.\n * </p>\n */\npublic final class Annotateds\n{\n    private static final char SEPARATOR = ';';\n\n    private Annotateds()\n    {\n        // this is a utility class with statics only\n    }\n\n    /**\n     * Does the first stage of comparing AnnoatedCallables, however it cannot\n     * compare the method parameters\n     */\n    @Vetoed\n    private static class AnnotatedCallableComparator<T>\n        implements Comparator<AnnotatedCallable<? super T>>, Serializable\n    {\n\n        public int compare(AnnotatedCallable<? super T> arg0, AnnotatedCallable<? super T> arg1)\n        {\n            // compare the names first\n            int result = (arg0.getJavaMember().getName().compareTo(arg1.getJavaMember().getName()));\n            if (result != 0)\n            {\n                return result;\n            }\n            result = arg0.getJavaMember().getDeclaringClass().getName().compareTo(arg1.getJavaMember()\n                    .getDeclaringClass().getName());\n            if (result != 0)\n            {\n                return result;\n            }\n            result = arg0.getParameters().size() - arg1.getParameters().size();\n            return result;\n        }\n\n    }\n\n    @Vetoed\n    private static class AnnotatedMethodComparator<T>\n        implements Comparator<AnnotatedMethod<? super T>>, Serializable\n    {\n\n        private AnnotatedCallableComparator<T> callableComparator = new AnnotatedCallableComparator<T>();\n\n        public static <T> Comparator<AnnotatedMethod<? super T>> instance()\n        {\n            return new AnnotatedMethodComparator<T>();\n        }\n\n        public int compare(AnnotatedMethod<? super T> arg0, AnnotatedMethod<? super T> arg1)\n        {\n            int result = callableComparator.compare(arg0, arg1);\n            if (result != 0)\n            {\n                return result;\n            }\n            for (int i = 0; i < arg0.getJavaMember().getParameterTypes().length; ++i)\n            {\n                Class<?> p0 = arg0.getJavaMember().getParameterTypes()[i];\n                Class<?> p1 = arg1.getJavaMember().getParameterTypes()[i];\n                result = p0.getName().compareTo(p1.getName());\n                if (result != 0)\n                {\n                    return result;\n                }\n            }\n            return 0;\n        }\n\n    }\n\n    @Vetoed\n    private static class AnnotatedConstructorComparator<T>\n        implements Comparator<AnnotatedConstructor<? super T>>, Serializable\n    {\n\n        private AnnotatedCallableComparator<T> callableComparator = new AnnotatedCallableComparator<T>();\n\n        public static <T> Comparator<AnnotatedConstructor<? super T>> instance()\n        {\n            return new AnnotatedConstructorComparator<T>();\n        }\n\n        public int compare(AnnotatedConstructor<? super T> arg0, AnnotatedConstructor<? super T> arg1)\n        {\n            int result = callableComparator.compare(arg0, arg1);\n            if (result != 0)\n            {\n                return result;\n            }\n            for (int i = 0; i < arg0.getJavaMember().getParameterTypes().length; ++i)\n            {\n                Class<?> p0 = arg0.getJavaMember().getParameterTypes()[i];\n                Class<?> p1 = arg1.getJavaMember().getParameterTypes()[i];\n                result = p0.getName().compareTo(p1.getName());\n                if (result != 0)\n                {\n                    return result;\n                }\n            }\n            return 0;\n        }\n\n    }\n\n    @Vetoed\n    private static class AnnotatedFieldComparator<T>\n        implements Comparator<AnnotatedField<? super T>>, Serializable\n    {\n\n        public static <T> Comparator<AnnotatedField<? super T>> instance()\n        {\n            return new AnnotatedFieldComparator<T>();\n        }\n\n        public int compare(AnnotatedField<? super T> arg0, AnnotatedField<? super T> arg1)\n        {\n            if (arg0.getJavaMember().getName().equals(arg1.getJavaMember().getName()))\n            {\n                return arg0.getJavaMember().getDeclaringClass().getName().compareTo(arg1.getJavaMember()\n                        .getDeclaringClass().getName());\n            }\n            return arg0.getJavaMember().getName().compareTo(arg1.getJavaMember().getName());\n        }\n\n    }\n\n    @Vetoed\n    private static class AnnotationComparator implements Comparator<Annotation>, Serializable\n    {\n\n        public static final Comparator<Annotation> INSTANCE = new AnnotationComparator();\n\n        public int compare(Annotation arg0, Annotation arg1)\n        {\n            return arg0.annotationType().getName().compareTo(arg1.annotationType().getName());\n        }\n    }\n\n    @Vetoed\n    private static class MethodComparator implements Comparator<Method>\n    {\n\n        public static final Comparator<Method> INSTANCE = new MethodComparator();\n\n        public int compare(Method arg0, Method arg1)\n        {\n            return arg0.getName().compareTo(arg1.getName());\n        }\n    }\n\n    /**\n     * Generates a deterministic signature for an {@link AnnotatedType}. Two\n     * <code>AnnotatedType</code>s that have the same annotations and underlying\n     * type will generate the same signature.\n     * <p/>\n     * This can be used to create a unique bean id for a passivation capable bean\n     * that is added directly through the SPI.\n     *\n     * @param annotatedType The type to generate a signature for\n     * @return A string representation of the annotated type\n     */\n    public static <X> String createTypeId(AnnotatedType<X> annotatedType)\n    {\n        return createTypeId(annotatedType.getJavaClass(), annotatedType.getAnnotations(), annotatedType.getMethods(),\n                annotatedType.getFields(), annotatedType.getConstructors());\n    }\n\n    /**\n     * Generates a unique signature for a concrete class. Annotations are not\n     * read directly from the class, but are read from the\n     * <code>annotations</code>, <code>methods</code>, <code>fields</code> and\n     * <code>constructors</code> arguments\n     *\n     * @param clazz        The java class type\n     * @param annotations  Annotations present on the java class\n     * @param methods      The AnnotatedMethods to include in the signature\n     * @param fields       The AnnotatedFields to include in the signature\n     * @param constructors The AnnotatedConstructors to include in the signature\n     * @return A string representation of the type\n     */\n    public static <X> String createTypeId(Class<X> clazz, Collection<Annotation> annotations,\n                                          Collection<AnnotatedMethod<? super X>> methods,\n                                          Collection<AnnotatedField<? super X>> fields,\n                                          Collection<AnnotatedConstructor<X>> constructors)\n    {\n        StringBuilder builder = new StringBuilder();\n\n        builder.append(clazz.getName());\n        builder.append(createAnnotationCollectionId(annotations));\n        builder.append(\"{\");\n\n        // now deal with the fields\n        List<AnnotatedField<? super X>> sortedFields = new ArrayList<AnnotatedField<? super X>>();\n        sortedFields.addAll(fields);\n        Collections.sort(sortedFields, AnnotatedFieldComparator.<X>instance());\n        for (AnnotatedField<? super X> field : sortedFields)\n        {\n            if (!field.getAnnotations().isEmpty())\n            {\n                builder.append(createFieldId(field));\n                builder.append(SEPARATOR);\n            }\n        }\n\n        // methods\n        List<AnnotatedMethod<? super X>> sortedMethods = new ArrayList<AnnotatedMethod<? super X>>();\n        sortedMethods.addAll(methods);\n        Collections.sort(sortedMethods, AnnotatedMethodComparator.<X>instance());\n        for (AnnotatedMethod<? super X> method : sortedMethods)\n        {\n            if (!method.getAnnotations().isEmpty() || hasMethodParameters(method))\n            {\n                builder.append(createCallableId(method));\n                builder.append(SEPARATOR);\n            }\n        }\n\n        // constructors\n        List<AnnotatedConstructor<? super X>> sortedConstructors = new ArrayList<AnnotatedConstructor<? super X>>();\n        sortedConstructors.addAll(constructors);\n        Collections.sort(sortedConstructors, AnnotatedConstructorComparator.<X>instance());\n        for (AnnotatedConstructor<? super X> constructor : sortedConstructors)\n        {\n            if (!constructor.getAnnotations().isEmpty() || hasMethodParameters(constructor))\n            {\n                builder.append(createCallableId(constructor));\n                builder.append(SEPARATOR);\n            }\n        }\n        builder.append(\"}\");\n\n        return builder.toString();\n    }\n\n    /**\n     * Generates a deterministic signature for an {@link AnnotatedField}. Two\n     * <code>AnnotatedField</code>s that have the same annotations and\n     * underlying field will generate the same signature.\n     */\n    public static <X> String createFieldId(AnnotatedField<X> field)\n    {\n        return createFieldId(field.getJavaMember(), field.getAnnotations());\n    }\n\n    /**\n     * Creates a deterministic signature for a {@link Field}.\n     *\n     * @param field       The field to generate the signature for\n     * @param annotations The annotations to include in the signature\n     */\n    public static <X> String createFieldId(Field field, Collection<Annotation> annotations)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(field.getDeclaringClass().getName());\n        builder.append('.');\n        builder.append(field.getName());\n        builder.append(createAnnotationCollectionId(annotations));\n        return builder.toString();\n    }\n\n    /**\n     * Generates a deterministic signature for an {@link AnnotatedCallable}. Two\n     * <code>AnnotatedCallable</code>s that have the same annotations and\n     * underlying callable will generate the same signature.\n     */\n    public static <X> String createCallableId(AnnotatedCallable<X> method)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(method.getJavaMember().getDeclaringClass().getName());\n        builder.append('.');\n        builder.append(method.getJavaMember().getName());\n        builder.append(createAnnotationCollectionId(method.getAnnotations()));\n        builder.append(createParameterListId(method.getParameters()));\n        return builder.toString();\n    }\n\n    /**\n     * Creates a deterministic signature for a {@link Method}.\n     *\n     * @param method      The method to generate the signature for\n     * @param annotations The annotations to include in the signature\n     * @param parameters  The {@link AnnotatedParameter}s to include in the\n     *                    signature\n     */\n    public static <X> String createMethodId(Method method, Set<Annotation> annotations,\n                                            List<AnnotatedParameter<X>> parameters)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(method.getDeclaringClass().getName());\n        builder.append('.');\n        builder.append(method.getName());\n        builder.append(createAnnotationCollectionId(annotations));\n        builder.append(createParameterListId(parameters));\n        return builder.toString();\n    }\n\n    /**\n     * Creates a deterministic signature for a {@link Constructor}.\n     *\n     * @param constructor The constructor to generate the signature for\n     * @param annotations The annotations to include in the signature\n     * @param parameters  The {@link AnnotatedParameter}s to include in the\n     *                    signature\n     */\n    public static <X> String createConstructorId(Constructor<X> constructor, Set<Annotation> annotations,\n                                                 List<AnnotatedParameter<X>> parameters)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(constructor.getDeclaringClass().getName());\n        builder.append('.');\n        builder.append(constructor.getName());\n        builder.append(createAnnotationCollectionId(annotations));\n        builder.append(createParameterListId(parameters));\n        return builder.toString();\n    }\n\n    /**\n     * Generates a unique string representation of a list of\n     * {@link AnnotatedParameter}s.\n     */\n    public static <X> String createParameterListId(List<AnnotatedParameter<X>> parameters)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"(\");\n        for (int i = 0; i < parameters.size(); ++i)\n        {\n            AnnotatedParameter<X> ap = parameters.get(i);\n            builder.append(createParameterId(ap));\n            if (i + 1 != parameters.size())\n            {\n                builder.append(',');\n            }\n        }\n        builder.append(\")\");\n        return builder.toString();\n    }\n\n    /**\n     * Creates a string representation of an {@link AnnotatedParameter}.\n     */\n    public static <X> String createParameterId(AnnotatedParameter<X> annotatedParameter)\n    {\n        return createParameterId(annotatedParameter.getBaseType(), annotatedParameter.getAnnotations());\n    }\n\n    /**\n     * Creates a string representation of a given type and set of annotations.\n     */\n    public static <X> String createParameterId(Type type, Set<Annotation> annotations)\n    {\n        StringBuilder builder = new StringBuilder();\n        if (type instanceof Class<?>)\n        {\n            Class<?> c = (Class<?>) type;\n            builder.append(c.getName());\n        }\n        else\n        {\n            builder.append(type.toString());\n        }\n        builder.append(createAnnotationCollectionId(annotations));\n        return builder.toString();\n    }\n\n    /**\n     * <p>\n     * Compares {@link AnnotatedField}s for equality.\n     * </p>\n     * <p>\n     * Two {@link AnnotatedField}s are considered equal if they have the same\n     * underlying field and annotations.\n     * </p>\n     */\n    public static boolean compareAnnotatedField(AnnotatedField<?> f1, AnnotatedField<?> f2)\n    {\n        if (!f1.getJavaMember().equals(f2.getJavaMember()))\n        {\n            return false;\n        }\n        return compareAnnotated(f1, f2);\n    }\n\n    /**\n     * <p>\n     * Compare {@link AnnotatedCallable}s for equality.\n     * </p>\n     * <p/>\n     * <p>\n     * Two {@link AnnotatedCallable}s are considered equal if they have the same\n     * underlying callable and annotations.\n     * </p>\n     */\n    public static boolean compareAnnotatedCallable(AnnotatedCallable<?> m1, AnnotatedCallable<?> m2)\n    {\n        if (!m1.getJavaMember().equals(m2.getJavaMember()))\n        {\n            return false;\n        }\n        if (!compareAnnotated(m1, m2))\n        {\n            return false;\n        }\n        return compareAnnotatedParameters(m1.getParameters(), m2.getParameters());\n    }\n\n    /**\n     * <p>\n     * Compares two {@link AnnotatedType}s for equality.\n     * </p>\n     * <p/>\n     * <p>\n     * Two {@link AnnotatedType}s are considered equal if they have the same\n     * underlying type and annotations, and all members have the same\n     * annotations.\n     * </p>\n     */\n    public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2)\n    {\n        if (!t1.getJavaClass().equals(t2.getJavaClass()))\n        {\n            return false;\n        }\n        if (!compareAnnotated(t1, t2))\n        {\n            return false;\n        }\n\n        if (t1.getFields().size() != t2.getFields().size())\n        {\n            return false;\n        }\n        Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();\n        for (AnnotatedField<?> f : t2.getFields())\n        {\n            fields.put(f.getJavaMember(), f);\n        }\n        for (AnnotatedField<?> f : t1.getFields())\n        {\n            if (fields.containsKey(f.getJavaMember()))\n            {\n                if (!compareAnnotatedField(f, fields.get(f.getJavaMember())))\n                {\n                    return false;\n                }\n            }\n            else\n            {\n                return false;\n            }\n        }\n\n        if (t1.getMethods().size() != t2.getMethods().size())\n        {\n            return false;\n        }\n        Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();\n        for (AnnotatedMethod<?> f : t2.getMethods())\n        {\n            methods.put(f.getJavaMember(), f);\n        }\n        for (AnnotatedMethod<?> f : t1.getMethods())\n        {\n            if (methods.containsKey(f.getJavaMember()))\n            {\n                if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember())))\n                {\n                    return false;\n                }\n            }\n            else\n            {\n                return false;\n            }\n        }\n        if (t1.getConstructors().size() != t2.getConstructors().size())\n        {\n            return false;\n        }\n        Map<Constructor<?>, AnnotatedConstructor<?>> constructors =\n                new HashMap<Constructor<?>, AnnotatedConstructor<?>>();\n        for (AnnotatedConstructor<?> f : t2.getConstructors())\n        {\n            constructors.put(f.getJavaMember(), f);\n        }\n        for (AnnotatedConstructor<?> f : t1.getConstructors())\n        {\n            if (constructors.containsKey(f.getJavaMember()))\n            {\n                if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember())))\n                {\n                    return false;\n                }\n            }\n            else\n            {\n                return false;\n            }\n        }\n        return true;\n\n    }\n\n    private static <X> boolean hasMethodParameters(AnnotatedCallable<X> callable)\n    {\n        for (AnnotatedParameter<X> parameter : callable.getParameters())\n        {\n            if (!parameter.getAnnotations().isEmpty())\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private static String createAnnotationCollectionId(Collection<Annotation> annotations)\n    {\n        if (annotations.isEmpty())\n        {\n            return \"\";\n        }\n\n        StringBuilder builder = new StringBuilder();\n        builder.append('[');\n\n        List<Annotation> annotationList = new ArrayList<Annotation>(annotations.size());\n        annotationList.addAll(annotations);\n        Collections.sort(annotationList, AnnotationComparator.INSTANCE);\n\n        for (Annotation a : annotationList)\n        {\n            builder.append('@');\n            builder.append(a.annotationType().getName());\n            builder.append('(');\n            Method[] declaredMethods = a.annotationType().getDeclaredMethods();\n            List<Method> methods = new ArrayList<Method>(declaredMethods.length);\n            methods.addAll(Arrays.asList(declaredMethods));\n            Collections.sort(methods, MethodComparator.INSTANCE);\n\n            for (int i = 0; i < methods.size(); ++i)\n            {\n                Method method = methods.get(i);\n                try\n                {\n                    Object value = method.invoke(a);\n                    builder.append(method.getName());\n                    builder.append('=');\n                    if (value.getClass().isArray())\n                    {\n                        Class<?> componentType = value.getClass().getComponentType();\n                        if (componentType.isAnnotation())\n                        {\n                            builder.append(Arrays.asList((Object[]) value));\n                        }\n                        else if (componentType instanceof Class<?>)\n                        {\n                            builder.append(createArrayId(value));\n                        }\n                        else\n                        {\n                            builder.append(value.toString());\n                        }\n                    }\n                    else\n                    {\n                        builder.append(value.toString());\n                    }\n                }\n                catch (NullPointerException e)\n                {\n                    throw new RuntimeException(\"NullPointerException accessing annotation member, annotation:\"\n                            + a.annotationType().getName() + \" member: \" + method.getName(), e);\n                }\n                catch (IllegalArgumentException e)\n                {\n                    throw new RuntimeException(\"IllegalArgumentException accessing annotation member, annotation:\"\n                            + a.annotationType().getName() + \" member: \" + method.getName(), e);\n                }\n                catch (IllegalAccessException e)\n                {\n                    throw new RuntimeException(\"IllegalAccessException accessing annotation member, annotation:\"\n                            + a.annotationType().getName() + \" member: \" + method.getName(), e);\n                }\n                catch (InvocationTargetException e)\n                {\n                    throw new RuntimeException(\"InvocationTargetException accessing annotation member, annotation:\"\n                            + a.annotationType().getName() + \" member: \" + method.getName(), e);\n                }\n                if (i + 1 != methods.size())\n                {\n                    builder.append(',');\n                }\n            }\n            builder.append(')');\n        }\n        builder.append(']');\n        return builder.toString();\n    }\n\n    /**\n     * Appends comma separated list of class names from classArray to builder\n     */\n    private static String createArrayId(Object value)\n    {\n        if (value instanceof int[])\n        {\n            return Arrays.toString((int[]) value);\n        }\n        if (value instanceof short[])\n        {\n            return Arrays.toString((short[]) value);\n        }\n        if (value instanceof byte[])\n        {\n            return Arrays.toString((byte[]) value);\n        }\n        if (value instanceof char[])\n        {\n            return Arrays.toString((char[]) value);\n        }\n        if (value instanceof long[])\n        {\n            return Arrays.toString((long[]) value);\n        }\n        if (value instanceof float[])\n        {\n            return Arrays.toString((float[]) value);\n        }\n        if (value instanceof double[])\n        {\n            return Arrays.toString((double[]) value);\n        }\n        if (value instanceof String[])\n        {\n            return Arrays.toString((String[]) value);\n        }\n\n        return createClassArrayId((Class<?>[]) value);\n    }\n\n    /**\n     * Appends comma separated list of class names from classArray to builder\n     */\n    private static String createClassArrayId(Class<?>[] classArray)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append('[');\n        for (int i = 0; i < classArray.length; i++)\n        {\n            builder.append(classArray[i].getName());\n            if (i + 1 != classArray.length)\n            {\n                builder.append(',');\n            }\n        }\n        builder.append(']');\n        return builder.toString();\n    }\n\n    /**\n     * Compares two annotated elements to see if they have the same annotations\n     */\n    private static boolean compareAnnotated(Annotated a1, Annotated a2)\n    {\n        return a1.getAnnotations().equals(a2.getAnnotations());\n    }\n\n    /**\n     * Compares two annotated elements to see if they have the same annotations\n     */\n    private static boolean compareAnnotatedParameters(List<? extends AnnotatedParameter<?>> p1,\n                                                      List<? extends AnnotatedParameter<?>> p2)\n    {\n        if (p1.size() != p2.size())\n        {\n            return false;\n        }\n        for (int i = 0; i < p1.size(); ++i)\n        {\n            if (!compareAnnotated(p1.get(i), p2.get(i)))\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/AnnotationUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\n\n@Vetoed\npublic abstract class AnnotationUtils\n{\n    private AnnotationUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static <T extends Annotation> T extractAnnotationFromMethodOrClass(\n        BeanManager beanManager, Method targetMethod, Class targetClass, Class<T> targetAnnotationType)\n    {\n        T result = extractAnnotationFromMethod(beanManager, targetMethod, targetAnnotationType);\n\n        if (result == null)\n        {\n            //see DELTASPIKE-517\n            Class unproxiedTargetClass = ProxyUtils.getUnproxiedClass(targetClass);\n\n            // and if not found search on the class\n            result = findAnnotation(beanManager, unproxiedTargetClass.getAnnotations(), targetAnnotationType);\n        }\n        return result;\n    }\n\n    public static <T extends Annotation> T extractAnnotationFromMethod(\n        BeanManager beanManager, Method targetMethod, Class<T> targetAnnotationType)\n    {\n        return findAnnotation(beanManager, targetMethod.getAnnotations(), targetAnnotationType);\n    }\n\n    public static  <T extends Annotation> T findAnnotation(\n            BeanManager beanManager, Annotation[] annotations, Class<T> targetAnnotationType)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (targetAnnotationType.equals(annotation.annotationType()))\n            {\n                return (T) annotation;\n            }\n            if (beanManager.isStereotype(annotation.annotationType()))\n            {\n                T result = findAnnotation(\n                        beanManager, annotation.annotationType().getAnnotations(), targetAnnotationType);\n                if (result != null)\n                {\n                    return result;\n                }\n            }\n        }\n        return null;\n    }\n\n    //based on org.apache.webbeans.container.BeanCacheKey#getQualifierHashCode\n    public static int getQualifierHashCode(Annotation annotation)\n    {\n        Class annotationClass = annotation.annotationType();\n\n        int hashCode = getTypeHashCode(annotationClass);\n\n        for (Method member : annotationClass.getDeclaredMethods())\n        {\n            if (member.isAnnotationPresent(Nonbinding.class))\n            {\n                continue;\n            }\n\n            final Object annotationMemberValue = ReflectionUtils.invokeMethod(annotation, member, Object.class, true);\n\n            final int arrayValue;\n            if (annotationMemberValue == null /*possible with literals*/)\n            {\n                arrayValue = 0;\n            }\n            else if (annotationMemberValue.getClass().isArray())\n            {\n                Class<?> annotationMemberType = annotationMemberValue.getClass().getComponentType();\n                if (annotationMemberType.isPrimitive())\n                {\n                    if (Long.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((long[]) annotationMemberValue);\n                    }\n                    else if (Integer.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((int[]) annotationMemberValue);\n                    }\n                    else if (Short.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((short[]) annotationMemberValue);\n                    }\n                    else if (Double.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((double[]) annotationMemberValue);\n                    }\n                    else if (Float.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((float[]) annotationMemberValue);\n                    }\n                    else if (Boolean.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((boolean[]) annotationMemberValue);\n                    }\n                    else if (Byte.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((byte[]) annotationMemberValue);\n                    }\n                    else if (Character.TYPE == annotationMemberType)\n                    {\n                        arrayValue = Arrays.hashCode((char[]) annotationMemberValue);\n                    }\n                    else\n                    {\n                        arrayValue = 0;\n                    }\n                }\n                else\n                {\n                    arrayValue = Arrays.hashCode((Object[]) annotationMemberValue);\n                }\n            }\n            else\n            {\n                arrayValue = annotationMemberValue.hashCode();\n            }\n\n            hashCode = 29 * hashCode + arrayValue;\n            hashCode = 29 * hashCode + member.getName().hashCode();\n        }\n\n        return hashCode;\n    }\n\n    private static int getTypeHashCode(Type type)\n    {\n        int typeHash = type.hashCode();\n        if (typeHash == 0 && type instanceof Class)\n        {\n            return ((Class)type).getName().hashCode();\n        }\n\n        return typeHash;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ArraysUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * A collection of utilities for working with Arrays\n */\n@Vetoed\npublic abstract class ArraysUtils\n{\n    private ArraysUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Create a set from an array. If the array contains duplicate objects, the\n     * last object in the array will be placed in resultant set.\n     *\n     * @param <T>   the type of the objects in the set\n     * @param array the array from which to create the set\n     * @return the created sets\n     */\n    public static <T> Set<T> asSet(T... array)\n    {\n        Set<T> result = new HashSet<T>();\n        Collections.addAll(result, array);\n        return result;\n    }\n\n    public static boolean isEmpty(Object[] array)\n    {\n        return array == null || array.length == 0;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/BeanConfiguratorUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Typed;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.configurator.BeanConfigurator;\nimport jakarta.inject.Named;\n\nimport java.beans.Introspector;\nimport java.lang.annotation.Annotation;\n\n\npublic class BeanConfiguratorUtils\n{\n    private BeanConfiguratorUtils()\n    {\n    }\n\n    public static <T> BeanConfigurator<T> read(BeanManager beanManager,\n                                           BeanConfigurator<T> beanConfigurator,\n                                           AnnotatedType<T> type)\n    {\n        // Weld doesnt support interfaces...\n        if (!type.getJavaClass().isInterface())\n        {\n            return beanConfigurator.read(type);\n        }\n\n        boolean qualifierAdded = false;\n\n        for (Annotation annotation : type.getAnnotations())\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                beanConfigurator.addQualifier(annotation);\n                qualifierAdded = true;\n            }\n            else if (beanManager.isScope(annotation.annotationType()))\n            {\n                beanConfigurator.scope(annotation.annotationType());\n            }\n            else if (beanManager.isStereotype(annotation.annotationType()))\n            {\n                beanConfigurator.addStereotype(annotation.annotationType());\n            }\n            if (annotation instanceof Named)\n            {\n                String name = ((Named) annotation).value();\n                if (name == null || name.isBlank())\n                {\n                    name = Introspector.decapitalize(type.getJavaClass().getSimpleName());\n                }\n                beanConfigurator.name(name);\n            }\n        }\n\n        if (type.isAnnotationPresent(Typed.class))\n        {\n            Typed typed = type.getAnnotation(Typed.class);\n            beanConfigurator.types(typed.value());\n        }\n        else\n        {\n            for (Class<?> c = type.getJavaClass(); c != Object.class && c != null; c = c.getSuperclass())\n            {\n                beanConfigurator.addTypes(c);\n            }\n            beanConfigurator.addTypes(type.getJavaClass().getInterfaces());\n            beanConfigurator.addTypes(Object.class);\n        }\n\n        if (!qualifierAdded)\n        {\n            beanConfigurator.addQualifier(Default.Literal.INSTANCE);\n        }\n        beanConfigurator.addQualifier(Any.Literal.INSTANCE);\n\n        return beanConfigurator;\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/BeanUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport org.apache.deltaspike.core.util.metadata.builder.ImmutableInjectionPoint;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\n/**\n * A set of utility methods for working with beans.\n */\n@Vetoed\npublic abstract class BeanUtils\n{\n\n    private BeanUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Extract the qualifiers from a set of annotations.\n     *\n     * @param beanManager the beanManager to use to determine if an annotation is\n     *                    a qualifier\n     * @param annotations the annotations to check\n     * @return any qualifiers present in <code>annotations</code>\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static Set<Annotation> getQualifiers(BeanManager beanManager, Iterable<Annotation> annotations)\n    {\n        Set<Annotation> qualifiers = new HashSet<Annotation>();\n\n        for (Annotation annotation : annotations)\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                qualifiers.add(annotation);\n            }\n        }\n\n        return qualifiers;\n    }\n\n    /**\n     * Extract the qualifiers from a set of annotations.\n     *\n     * @param beanManager the beanManager to use to determine if an annotation is\n     *                    a qualifier\n     * @param annotations the annotations to check\n     * @return any qualifiers present in <code>annotations</code>\n     */\n    public static Set<Annotation> getQualifiers(BeanManager beanManager, Annotation[]... annotations)\n    {\n        Set<Annotation> qualifiers = new HashSet<Annotation>();\n        for (Annotation[] annotationArray : annotations)\n        {\n            for (Annotation annotation : annotationArray)\n            {\n                if (beanManager.isQualifier(annotation.annotationType()))\n                {\n                    qualifiers.add(annotation);\n                }\n            }\n        }\n        return qualifiers;\n    }\n\n    /**\n     * @param annotated element to search in\n     * @param targetType target type to search for\n     * @param <T> type of the Annotation which get searched\n     * @return annotation instance extracted from the annotated member\n     */\n    public static <T extends Annotation> T extractAnnotation(Annotated annotated, Class<T> targetType)\n    {\n        T result = annotated.getAnnotation(targetType);\n\n        if (result == null)\n        {\n            for (Annotation annotation : annotated.getAnnotations())\n            {\n                result = annotation.annotationType().getAnnotation(targetType);\n\n                if (result != null)\n                {\n                    break;\n                }\n            }\n        }\n\n        return result;\n    }\n\n\n    /**\n     * Given a method, and the bean on which the method is declared, create a\n     * collection of injection points representing the parameters of the method.\n     *\n     * @param <X>           the type declaring the method\n     * @param method        the method\n     * @param declaringBean the bean on which the method is declared\n     * @param beanManager   the bean manager to use to create the injection points\n     * @return the injection points\n     */\n    public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean,\n                                                                 BeanManager beanManager)\n    {\n        List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>();\n        for (AnnotatedParameter<X> parameter : method.getParameters())\n        {\n            InjectionPoint injectionPoint =\n                new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false);\n\n            injectionPoints.add(injectionPoint);\n        }\n        return injectionPoints;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ClassDeactivationUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * Helper methods for {@link ClassDeactivator}\n */\n@Vetoed\npublic abstract class ClassDeactivationUtils\n{\n    private static final Logger LOG = Logger.getLogger(ClassDeactivationUtils.class.getName());\n\n    /**\n     * This Map holds the ClassLoader as first level to make it possible to have different configurations per \n     * WebApplication in an EAR or other Multi-ClassLoader scenario.\n     *\n     * The Map then contains a List of {@link ClassDeactivator}s in order of their configured ordinal.\n     */\n    private static Map<ClassLoader, List<ClassDeactivator>> classDeactivatorMap\n        = new ConcurrentHashMap<>();\n\n    /**\n     * Cache for the result. It won't contain many classes but it might be accessed frequently.\n     * Valid entries are only true or false. If an entry isn't available or null, it gets calculated.\n     */\n    private static Map<Class<? extends Deactivatable>, Boolean> activationStatusCache\n        = new ConcurrentHashMap<Class<? extends Deactivatable>, Boolean>();\n\n    private static ProjectStage previouslyDetectedProjectStage;\n\n    private ClassDeactivationUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Flush the caches to prevent ClassLoader leaks.\n     * This is called internally by DeltaSpike.\n     * Users do not have to explicitly call this method.\n     * Does not have side effects as the cache is idempotent anyway.\n     */\n    public static void clearCache()\n    {\n        classDeactivatorMap.clear();\n    }\n\n    /**\n     * Evaluates if the given {@link Deactivatable} is active.\n     *\n     * @param targetClass {@link Deactivatable} under test.\n     * @return <code>true</code> if it is active, <code>false</code> otherwise\n     */\n    public static boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        performProjectStageDependentCleanup();\n\n        //just to support parallel access to #isActivated (+ reset) in project-stage unit-test and development\n        Map<Class<? extends Deactivatable>, Boolean> activeCache = activationStatusCache;\n        Boolean activatedClassCacheEntry = activeCache.get(targetClass);\n\n        if (activatedClassCacheEntry == null)\n        {\n            initDeactivatableCacheFor(targetClass, activeCache);\n            activatedClassCacheEntry = activeCache.get(targetClass);\n        }\n        return activatedClassCacheEntry;\n    }\n\n    private static void performProjectStageDependentCleanup()\n    {\n        ProjectStage currentProjectStage = ProjectStageProducer.getInstance().getProjectStage();\n\n        if (previouslyDetectedProjectStage != currentProjectStage)\n        {\n            previouslyDetectedProjectStage = currentProjectStage;\n            //don't use #clear to support parallel access to #isActivated (+ reset) without synchronization\n            activationStatusCache = new ConcurrentHashMap<Class<? extends Deactivatable>, Boolean>();\n\n            //#clear is ok here due to the handling in the synchronized method #initDeactivatableCacheFor\n            classDeactivatorMap.clear();\n        }\n        else if (currentProjectStage == ProjectStage.UnitTest || currentProjectStage == ProjectStage.Development)\n        {\n            activationStatusCache = new ConcurrentHashMap<Class<? extends Deactivatable>, Boolean>();\n        }\n    }\n\n    private static synchronized void initDeactivatableCacheFor(Class<? extends Deactivatable> targetClass,\n                                                               Map<Class<? extends Deactivatable>, Boolean> activeCache)\n    {\n        Boolean activatedClassCacheEntry = activeCache.get(targetClass);\n\n        if (activatedClassCacheEntry != null) //double-check\n        {\n            return;\n        }\n\n        List<ClassDeactivator> classDeactivators = getClassDeactivators();\n\n        Boolean isActivated = Boolean.TRUE;\n        Class<? extends ClassDeactivator> deactivatedBy = null;\n\n        LOG.fine(\"start evaluation if \" + targetClass.getName() + \" is de-/activated\");\n\n        // we get the classActivators ordered by it's ordinal\n        // thus the last one which returns != null 'wins' ;)\n        for (ClassDeactivator classDeactivator : classDeactivators)\n        {\n            Boolean isLocallyActivated = classDeactivator.isActivated(targetClass);\n\n            if (isLocallyActivated != null)\n            {\n                isActivated = isLocallyActivated;\n\n                /*\n                * Check and log the details across class-deactivators\n                */\n                if (!isActivated)\n                {\n                    deactivatedBy = classDeactivator.getClass();\n                    LOG.fine(\"Deactivating class \" + targetClass);\n                }\n                else if (deactivatedBy != null)\n                {\n                    LOG.fine(\"Reactivation of: \" + targetClass.getName() + \" by \" +\n                            classDeactivator.getClass().getName() +\n                            \" - original deactivated by: \" + deactivatedBy.getName() + \".\\n\" +\n                            \"If that isn't the intended behaviour, you have to use a higher ordinal for \" +\n                            deactivatedBy.getName());\n                }\n            }\n        }\n\n        cacheResult(targetClass, isActivated, activeCache);\n    }\n\n    private static void cacheResult(Class<? extends Deactivatable> targetClass, Boolean activated,\n                                    Map<Class<? extends Deactivatable>, Boolean> activeCache)\n    {\n        activeCache.put(targetClass, activated);\n        if (LOG.isLoggable(Level.FINE))\n        {\n            LOG.fine(\"class: \" + targetClass.getName() + \" activated=\" + activated);\n        }\n    }\n\n    /**\n     * @return the List of configured @{link ClassDeactivator}s for the current context ClassLoader.\n     */\n    private static List<ClassDeactivator> getClassDeactivators()\n    {\n        ClassLoader classLoader = ClassUtils.getClassLoader(null);\n        List<ClassDeactivator> classDeactivators = classDeactivatorMap.get(classLoader);\n\n        if (classDeactivators == null)\n        {\n            return initConfiguredClassDeactivators(classLoader);\n        }\n\n        return classDeactivators;\n    }\n\n    //synchronized isn't needed - #initDeactivatableCacheFor is already synchronized\n    private static List<ClassDeactivator> initConfiguredClassDeactivators(ClassLoader classLoader)\n    {\n        List<String> classDeactivatorClassNames = ConfigResolver.getAllPropertyValues(ClassDeactivator.class.getName());\n\n        List<ClassDeactivator> classDeactivators = new ArrayList<ClassDeactivator>();\n\n        for (String classDeactivatorClassName : classDeactivatorClassNames)\n        {\n            LOG.fine(\"processing ClassDeactivator: \" + classDeactivatorClassName);\n\n            try\n            {\n                ClassDeactivator currentClassDeactivator =\n                        (ClassDeactivator) ClassUtils.instantiateClassForName(classDeactivatorClassName);\n                classDeactivators.add(currentClassDeactivator);\n            }\n            catch (Exception e)\n            {\n                LOG.warning(classDeactivatorClassName + \" can't be instantiated\");\n                throw new IllegalStateException(e);\n            }\n        }\n\n        classDeactivatorMap.put(classLoader, classDeactivators);\n        return classDeactivators;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ClassUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Method;\nimport jakarta.enterprise.inject.Vetoed;\n\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.jar.Manifest;\nimport java.util.jar.Attributes;\nimport java.net.URL;\n\n/**\n * Util methods for classes, {@link ClassLoader} and {@link Manifest} handling.\n *\n * Abstract to not get picked up as CDI bean on old containers.\n */\n@Vetoed\npublic abstract class ClassUtils\n{\n    /**\n     * Constructor which prevents the instantiation of this class\n     */\n    private ClassUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Detect the right ClassLoader.\n     * The lookup order is determined by:\n     * <ol>\n     * <li>ContextClassLoader of the current Thread</li>\n     * <li>ClassLoader of the given Object 'o'</li>\n     * <li>ClassLoader of this very ClassUtils class</li>\n     * </ol>\n     *\n     * @param o if not <code>null</code> it may get used to detect the classloader.\n     * @return The {@link ClassLoader} which should get used to create new instances\n     */\n    public static ClassLoader getClassLoader(Object o)\n    {\n        return getClassLoaderInternal(o);\n    }\n\n\n    private static ClassLoader getClassLoaderInternal(Object o)\n    {\n        ClassLoader loader = Thread.currentThread().getContextClassLoader();\n\n        if (loader == null && o != null)\n        {\n            loader = o.getClass().getClassLoader();\n        }\n\n        if (loader == null)\n        {\n            loader = ClassUtils.class.getClassLoader();\n        }\n\n        return loader;\n    }\n\n\n    /**\n     * Checks whether the CDI rules for proxyable beans are met.\n     * See\n     * <a href=\"https://docs.jboss.org/cdi/spec/1.2/cdi-spec-with-assertions.html#unproxyable\">\n     *     CDI spec unproxyable bean types</a>\n     *\n     * @param type\n     * @return {@code true} if all proxy conditions are met, {@code false} otherwise\n     */\n    public static boolean isProxyableClass(Type type)\n    {\n        Class clazz = null;\n        if (type instanceof Class)\n        {\n            clazz = (Class) type;\n        }\n        if (type instanceof ParameterizedType && ((ParameterizedType) type).getRawType() instanceof Class)\n        {\n            clazz = (Class) ((ParameterizedType) type).getRawType();\n        }\n        if (clazz == null)\n        {\n            return false;\n        }\n\n        // classes which don’t have a non-private constructor with no parameters\n        try\n        {\n            Constructor constructor = clazz.getConstructor();\n            if (Modifier.isPrivate(constructor.getModifiers()))\n            {\n                return false;\n            }\n        }\n        catch (NoSuchMethodException e)\n        {\n            return false;\n        }\n\n        // classes which are declared final\n        if (Modifier.isFinal(clazz.getModifiers()))\n        {\n            return false;\n        }\n\n        // classes which have non-static, final methods with public, protected or default visibility,\n        for (Method method : clazz.getMethods())\n        {\n            if (method.getDeclaringClass() == Object.class)\n            {\n                continue;\n            }\n\n            if (!method.isBridge() && !method.isSynthetic() && !Modifier.isStatic(method.getModifiers()) &&\n                !Modifier.isPrivate(method.getModifiers()) && Modifier.isFinal(method.getModifiers()))\n            {\n                return false;\n            }\n        }\n\n\n        // primitive types,\n        // and array types.\n        if (clazz.isPrimitive() || clazz.isArray())\n        {\n            return false;\n\n        }\n        return true;\n    }\n\n    /**\n     * Tries to load a class based on the given name and interface or abstract class.\n     * @param name name of the concrete class\n     * @param targetType target type (interface or abstract class)\n     * @param <T> current type\n     * @return loaded class or null if it isn't in the classpath\n     */\n    public static <T> Class<T> tryToLoadClassForName(String name, Class<T> targetType)\n    {\n        return (Class<T>) tryToLoadClassForName(name);\n    }\n    \n    /**\n     * Tries to load a class based on the given name and interface or abstract class.\n     * @param name name of the concrete class\n     * @param targetType target type (interface or abstract class)\n     * @param classLoader The {@link ClassLoader}.\n     * @param <T> current type\n     * @return loaded class or null if it isn't in the classpath\n     */\n    public static <T> Class<T> tryToLoadClassForName(String name, Class<T> targetType, ClassLoader classLoader)\n    {\n        return (Class<T>) tryToLoadClassForName(name, classLoader);\n    }\n\n    /**\n     * Tries to load a class based on the given name\n     * @param name name of the class\n     * @return loaded class or <code>null</code> if it isn't in the classpath\n     */\n    public static Class tryToLoadClassForName(String name)\n    {\n        try\n        {\n            return loadClassForName(name);\n        }\n        catch (ClassNotFoundException e)\n        {\n            //do nothing - it's just a try\n            return null;\n        }\n    }\n    \n    /**\n     * Tries to load a class based on the given name\n     * @param name name of the class\n     * @param classLoader The {@link ClassLoader}.\n     * @return loaded class or <code>null</code> if it isn't in the classpath\n     */\n    public static Class tryToLoadClassForName(String name, ClassLoader classLoader)\n    {\n        try\n        {\n            return classLoader.loadClass(name);\n        }\n        catch (ClassNotFoundException e)\n        {\n            //do nothing - it's just a try\n            return null;\n        }\n    }\n\n    /**\n     * Loads class for the given name\n     * @param name name of the class\n     * @return loaded class\n     * @throws ClassNotFoundException if the class can't be loaded\n     */\n    public static Class loadClassForName(String name) throws ClassNotFoundException\n    {\n        try\n        {\n            // Try WebApp ClassLoader first\n            return Class.forName(name, false, // do not initialize for faster startup\n                    getClassLoader(null));\n        }\n        catch (ClassNotFoundException ignore)\n        {\n            // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)\n            return Class.forName(name, false, // do not initialize for faster startup\n                    ClassUtils.class.getClassLoader());\n        }\n    }\n\n    /**\n     * Instantiates a given class via the default constructor\n     * @param targetClass class which should be instantiated\n     * @param <T> current type\n     * @return created instance or null if the instantiation failed\n     */\n    public static <T> T tryToInstantiateClass(Class<T> targetClass)\n    {\n        try\n        {\n            return targetClass.newInstance();\n        }\n        catch (InstantiationException e)\n        {\n            //do nothing - it was just a try\n        }\n        catch (IllegalAccessException e)\n        {\n            //do nothing - it was just a try\n        }\n        return null;\n    }\n\n    /**\n     * Tries to instantiate a class for the given name and type via the default constructor\n     * @param className name of the class\n     * @param targetType target type\n     * @param <T> current type\n     * @return created instance or null if the instantiation failed\n     */\n    public static <T> T tryToInstantiateClassForName(String className, Class<T> targetType)\n    {\n        Object result = tryToInstantiateClassForName(className);\n\n        //noinspection unchecked\n        return result != null ? (T) result : null;\n    }\n\n    /**\n     * Tries to instantiate a class for the given name via the default constructor\n     * @param className name of the class\n     * @return created instance or null if the instantiation failed\n     */\n    public static Object tryToInstantiateClassForName(String className)\n    {\n        try\n        {\n            return instantiateClassForName(className);\n        }\n        catch (Exception e)\n        {\n            //do nothing - it was just a try\n        }\n        return null;\n    }\n\n    /**\n     * Creates an instance for the given class-name\n     * @param className name of the class which should be instantiated\n     * @return created instance\n     * @throws ClassNotFoundException if the instantiation failed\n     * @throws IllegalAccessException if the instantiation failed\n     * @throws InstantiationException if the instantiation failed\n     */\n    public static Object instantiateClassForName(String className)\n        throws ClassNotFoundException, IllegalAccessException, InstantiationException\n    {\n        return loadClassForName(className).newInstance();\n    }\n\n    /**\n     * Reads the version of the jar which contains the given class\n     * @param targetClass class within the jar\n     * @return version-string which has been found in the manifest or null if there is no version information available\n     */\n    public static String getJarVersion(Class targetClass)\n    {\n        String manifestFileLocation = getManifestFileLocationOfClass(targetClass);\n\n        try\n        {\n            return new Manifest(new URL(manifestFileLocation).openStream())\n                    .getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n    /**\n     * Reads the VCS revision which was used for creating the jar\n     * @param targetClass class within the jar\n     * @return revision-string which has been found in the manifest or null if there is no information available\n     */\n    public static String getRevision(Class targetClass)\n    {\n        String manifestFileLocation = getManifestFileLocationOfClass(targetClass);\n\n        try\n        {\n            return new Manifest(new URL(manifestFileLocation).openStream())\n                    .getMainAttributes().getValue(\"Revision\");\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n    private static String getManifestFileLocationOfClass(Class targetClass)\n    {\n        String manifestFileLocation;\n\n        try\n        {\n            manifestFileLocation = getManifestLocation(targetClass);\n        }\n        catch (Exception e)\n        {\n            //in this case we have a proxy\n            manifestFileLocation = getManifestLocation(targetClass.getSuperclass());\n        }\n        return manifestFileLocation;\n    }\n\n    private static String getManifestLocation(Class targetClass)\n    {\n        String classFilePath = targetClass.getCanonicalName().replace('.', '/') + \".class\";\n        String manifestFilePath = \"/META-INF/MANIFEST.MF\";\n\n        String classLocation = targetClass.getResource(targetClass.getSimpleName() + \".class\").toString();\n        return classLocation.substring(0, classLocation.indexOf(classFilePath) - 1) + manifestFilePath;\n    }\n\n    /**\n     * Checks if the given class contains a method with the same signature.\n     * \n     * @param targetClass The class to check\n     * @param method The source method\n     * @return if it contains a method with the same signature.\n     */\n    public static boolean containsMethod(Class<?> targetClass, Method method)\n    {\n        return extractMethod(targetClass, method) != null;\n    }\n\n    /**\n     * Extracts a method with same signature as the source method.\n     * \n     * @param clazz The target class\n     * @param sourceMethod The source method.\n     * @return the extracted method or <code>null</code>\n     */\n    public static Method extractMethod(Class<?> clazz, Method sourceMethod)\n    {\n        try\n        {\n            String name = sourceMethod.getName();\n            return clazz != null ? clazz.getMethod(name, sourceMethod.getParameterTypes()) : null;\n        }\n        catch (NoSuchMethodException e)\n        {\n            return null;\n        }\n    }\n\n    /**\n     * Extract a method with the given name and parameterTypes.\n     * Return {@code null} if no such visible method exists on the given class.\n     *\n     * @param clazz\n     * @param methodName\n     * @param parameterTypes\n     * @return\n     */\n    public static Method extractMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)\n    {\n        try\n        {\n            return clazz != null ? clazz.getMethod(methodName, parameterTypes) : null;\n        }\n        catch (NoSuchMethodException e)\n        {\n            return null;\n        }\n    }\n\n    /**\n     * Checks if the given class has a method with the same signature, taking in to account generic types\n     * @param targetClass\n     * @param method\n     * @return if it contains a method with the same signature.\n     */\n    public static boolean containsPossiblyGenericMethod(Class<?> targetClass, Method method)\n    {\n        return extractPossiblyGenericMethod(targetClass, method) != null;\n    }\n\n    /**\n     * Extracts a method matching the source method, allowing generic type parameters to be substituted as\n     * long as they are properly castable.\n     *\n     * @param clazz The target class\n     * @param sourceMethod The source method.\n     * @return the extracted method or <code>null</code>\n     */\n    public static Method extractPossiblyGenericMethod(Class<?> clazz, Method sourceMethod)\n    {\n        Method exactMethod = extractMethod(clazz, sourceMethod);\n        if (exactMethod == null)\n        {\n            String methodName = sourceMethod.getName();\n            Class<?>[] parameterTypes = sourceMethod.getParameterTypes();\n            for (Method method : clazz.getMethods())\n            {\n                if (method.getName().equals(methodName) &&\n                        allSameType(method.getParameterTypes(), parameterTypes))\n                {\n                    return method;\n                }\n            }\n            return null;\n        }\n        else\n        {\n            return exactMethod;\n        }\n    }\n\n    /**\n     * Whether all of the parameters from left to right are equivalent.\n     * In order to support generics, it takes the form of left.isAssignableFrom(right)\n     * @param left left hand side to check\n     * @param right right hand side to check\n     * @return whether all of the left classes can be assigned to the right hand side types\n     */\n    private static boolean allSameType(Class<?>[] left, Class<?>[] right)\n    {\n        if (left.length != right.length)\n        {\n            return false;\n        }\n        for (int p = 0; p < left.length; p++)\n        {\n            if (!left[p].isAssignableFrom(right[p]))\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n    \n    public static boolean returns(Method method, Class<?> clazz)\n    {\n        return method.getReturnType().isAssignableFrom(clazz);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ContextUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport java.lang.annotation.Annotation;\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\n\n/**\n * A set of utility methods for working with contexts.\n */\n@Vetoed\npublic abstract class ContextUtils\n{\n    private ContextUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Checks if the context for the given scope annotation is active.\n     *\n     * @param scopeAnnotationClass The scope annotation (e.g. @RequestScoped.class)\n     * @return If the context is active.\n     */\n    public static boolean isContextActive(Class<? extends Annotation> scopeAnnotationClass)\n    {\n        return isContextActive(scopeAnnotationClass, BeanManagerProvider.getInstance().getBeanManager());\n    }\n\n    /**\n     * Checks if the context for the given scope annotation is active.\n     *\n     * @param scopeAnnotationClass The scope annotation (e.g. @RequestScoped.class)\n     * @param beanManager The {@link BeanManager}\n     * @return If the context is active.\n     */\n    public static boolean isContextActive(Class<? extends Annotation> scopeAnnotationClass, BeanManager beanManager)\n    {\n        try\n        {\n            if (beanManager.getContext(scopeAnnotationClass) == null\n                    || !beanManager.getContext(scopeAnnotationClass).isActive())\n            {\n                return false;\n            }\n        }\n        catch (ContextNotActiveException e)\n        {\n            return false;\n        }\n\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ExceptionUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.reflect.Constructor;\n\n@Vetoed\npublic abstract class ExceptionUtils\n{\n    private ExceptionUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static RuntimeException throwAsRuntimeException(Throwable throwable)\n    {\n        //Attention: helper which allows to use a trick to throw\n        // a catched checked exception without a wrapping exception\n        new ExceptionHelper<RuntimeException>().throwException(throwable);\n        return null; //not needed due to the helper trick, but it's easier for using it\n    }\n\n    public static void changeAndThrowException(Throwable throwable, String customMessage)\n    {\n        Throwable newThrowable = createNewException(throwable, customMessage);\n        //Attention: helper which allows to use a trick to throw a cached checked exception without a wrapping exception\n        new ExceptionHelper<RuntimeException>().throwException(newThrowable);\n    }\n\n    private static Throwable createNewException(Throwable throwable, String message)\n    {\n        Class<? extends Throwable> throwableClass = throwable.getClass();\n\n        try\n        {\n            Constructor<? extends Throwable> constructor = throwableClass.getDeclaredConstructor(String.class);\n            constructor.setAccessible(true);\n            Throwable result = constructor.newInstance(message);\n            result.initCause(throwable.getCause());\n            return result;\n        }\n        catch (Exception e)\n        {\n            //use the original exception if there is any issue\n            return throwable;\n        }\n    }\n\n    @SuppressWarnings({ \"unchecked\" })\n    private static class ExceptionHelper<T extends Throwable>\n    {\n        private void throwException(Throwable exception) throws T\n        {\n            try\n            {\n                //exception-type is only checked at compile-time\n                throw (T) exception;\n            }\n            catch (ClassCastException e)\n            {\n                //doesn't happen with existing JVMs! - if that changes the local ClassCastException needs to be ignored\n                //-> throw original exception\n                if (e.getStackTrace()[0].toString().contains(getClass().getName()))\n                {\n                    if (exception instanceof RuntimeException)\n                    {\n                        throw (RuntimeException) exception;\n                    }\n                    throw new RuntimeException(exception);\n                }\n                //if the exception to throw is a ClassCastException, throw it\n                throw e;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/HierarchyDiscovery.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.TypeVariable;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * Utility class for resolving all bean types from a given type.\n */\n//X TODO: Look at merging this with ClassUtils perhaps\n//X TODO: JavaDoc\n//X TODO review\n@Vetoed\npublic class HierarchyDiscovery\n{\n    private final Type type;\n\n    private Map<Type, Class<?>> types;\n\n    public HierarchyDiscovery(Type type)\n    {\n        this.type = type;\n    }\n\n    protected void add(Class<?> clazz, Type type)\n    {\n        types.put(type, clazz);\n    }\n\n    public Set<Type> getTypeClosure()\n    {\n        if (types == null)\n        {\n            init();\n        }\n        // Return an independent set with no ties to the BiMap used\n        return new HashSet<Type>(types.keySet());\n    }\n\n    private void init()\n    {\n        types = new HashMap<Type, Class<?>>();\n        try\n        {\n            discoverTypes(type);\n        }\n        catch (StackOverflowError e)\n        {\n            Logger logger = Logger.getLogger(HierarchyDiscovery.class.getName());\n\n            logger.log(Level.WARNING, \"type: \" + type.toString(), e);\n            Thread.dumpStack();\n            throw e;\n        }\n    }\n\n    public Type getResolvedType()\n    {\n        if (type instanceof Class<?>)\n        {\n            Class<?> clazz = (Class<?>) type;\n            return resolveType(clazz);\n        }\n        return type;\n    }\n\n    private void discoverTypes(Type type)\n    {\n        if (type != null)\n        {\n            if (type instanceof Class<?>)\n            {\n                Class<?> clazz = (Class<?>) type;\n                add(clazz, resolveType(clazz));\n                discoverFromClass(clazz);\n            }\n            else\n            {\n                Class<?> clazz = null;\n                if (type instanceof ParameterizedType)\n                {\n                    Type rawType = ((ParameterizedType) type).getRawType();\n                    if (rawType instanceof Class<?>)\n                    {\n                        discoverFromClass((Class<?>) rawType);\n                        clazz = (Class<?>) rawType;\n                    }\n                }\n                add(clazz, type);\n            }\n        }\n    }\n\n    private Type resolveType(Class<?> clazz)\n    {\n        if (clazz.getTypeParameters().length > 0)\n        {\n            TypeVariable<?>[] actualTypeParameters = clazz.getTypeParameters();\n\n            @SuppressWarnings(\"UnnecessaryLocalVariable\")\n            ParameterizedType parameterizedType =\n                    new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());\n            return parameterizedType;\n        }\n        else\n        {\n            return clazz;\n        }\n    }\n\n    private void discoverFromClass(Class<?> clazz)\n    {\n        discoverTypes(resolveType(type, type, clazz.getGenericSuperclass()));\n        for (Type c : clazz.getGenericInterfaces())\n        {\n            discoverTypes(resolveType(type, type, c));\n        }\n    }\n\n    /**\n     * Gets the actual types by resolving TypeParameters.\n     *\n     * @return actual type\n     */\n    private Type resolveType(Type beanType, Type beanType2, Type type)\n    {\n        if (type instanceof ParameterizedType)\n        {\n            if (beanType instanceof ParameterizedType)\n            {\n                return resolveParameterizedType((ParameterizedType) beanType, (ParameterizedType) type);\n            }\n            if (beanType instanceof Class<?>)\n            {\n                return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);\n            }\n        }\n\n        if (type instanceof TypeVariable<?>)\n        {\n            if (beanType instanceof ParameterizedType)\n            {\n                return resolveTypeParameter((ParameterizedType) beanType, beanType2, (TypeVariable<?>) type);\n            }\n            if (beanType instanceof Class<?>)\n            {\n                return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);\n            }\n        }\n        return type;\n    }\n\n    private Type resolveParameterizedType(ParameterizedType beanType, ParameterizedType parameterizedType)\n    {\n        Type rawType = parameterizedType.getRawType();\n        Type[] actualTypes = parameterizedType.getActualTypeArguments();\n\n        Type resolvedRawType = resolveType(beanType, beanType, rawType);\n        Type[] resolvedActualTypes = new Type[actualTypes.length];\n\n        for (int i = 0; i < actualTypes.length; i++)\n        {\n            resolvedActualTypes[i] = resolveType(beanType, beanType, actualTypes[i]);\n        }\n        // reconstruct ParameterizedType by types resolved TypeVariable.\n        return new ParameterizedTypeImpl(resolvedRawType, resolvedActualTypes, parameterizedType.getOwnerType());\n    }\n\n    private Type resolveTypeParameter(ParameterizedType type, Type beanType, TypeVariable<?> typeVariable)\n    {\n        // step1. raw type\n        Class<?> actualType = (Class<?>) type.getRawType();\n        TypeVariable<?>[] typeVariables = actualType.getTypeParameters();\n        Type[] actualTypes = type.getActualTypeArguments();\n        for (int i = 0; i < typeVariables.length; i++)\n        {\n            if (typeVariables[i].equals(typeVariable) && !actualTypes[i].equals(typeVariable))\n            {\n                return resolveType(this.type, beanType, actualTypes[i]);\n            }\n        }\n\n        // step2. generic super class\n        Type genericSuperType = actualType.getGenericSuperclass();\n        Type resolvedGenericSuperType = resolveType(genericSuperType, beanType, typeVariable);\n        if (!(resolvedGenericSuperType instanceof TypeVariable<?>))\n        {\n            return resolvedGenericSuperType;\n        }\n\n        // step3. generic interfaces\n        if (beanType instanceof ParameterizedType)\n        {\n            for (Type interfaceType : ((Class<?>) ((ParameterizedType) beanType).getRawType()).getGenericInterfaces())\n            {\n                Type resolvedType = resolveType(interfaceType, interfaceType, typeVariable);\n                if (!(resolvedType instanceof TypeVariable<?>))\n                {\n                    return resolvedType;\n                }\n            }\n        }\n\n        // don't resolve type variable\n        return typeVariable;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ParameterUtil.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Vetoed\npublic abstract class ParameterUtil\n{\n    private static boolean parameterSupported = true;\n    private static Class<?> parameterClass;\n    private static Method getNameMethod;\n    private static Method getParametersMethod;\n\n    static\n    {\n        try\n        {\n            parameterClass = Class.forName(\"java.lang.reflect.Parameter\");\n            getNameMethod = parameterClass.getMethod(\"getName\");\n            getParametersMethod = Method.class.getMethod(\"getParameters\");\n        }\n        catch (Exception e)\n        {\n            parameterSupported = false;\n            parameterClass = null;\n            getNameMethod = null;\n            getParametersMethod = null;\n        }\n    }\n\n    public static boolean isParameterSupported()\n    {\n        return parameterSupported;\n    }\n\n    public static String getName(Method method, int parameterIndex)\n    {\n        if (!isParameterSupported() || method == null)\n        {\n            return null;\n        }\n        try\n        {\n            Object[] parameters = (Object[]) getParametersMethod.invoke(method);\n            return (String) getNameMethod.invoke(parameters[parameterIndex]);\n        }\n        catch (IllegalAccessException e)\n        {\n        }\n        catch (InvocationTargetException e)\n        {\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ParameterizedTypeImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\n\n/**\n * A basic implementation of {@link ParameterizedType}.\n */\n@Vetoed\nclass ParameterizedTypeImpl implements ParameterizedType\n{\n    private final Type[] actualTypeArguments;\n    private final Type rawType;\n    private final Type ownerType;\n\n    ParameterizedTypeImpl(Type rawType, Type[] actualTypeArguments, Type ownerType)\n    {\n        this.actualTypeArguments = actualTypeArguments;\n        this.rawType = rawType;\n        this.ownerType = ownerType;\n    }\n\n    public Type[] getActualTypeArguments()\n    {\n        return Arrays.copyOf(actualTypeArguments, actualTypeArguments.length);\n    }\n\n    public Type getOwnerType()\n    {\n        return ownerType;\n    }\n\n    public Type getRawType()\n    {\n        return rawType;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return Arrays.hashCode(actualTypeArguments) ^ (ownerType == null ? 0 :\n                ownerType.hashCode()) ^ (rawType == null ? 0 : rawType.hashCode());\n    }\n\n    @Override\n    public boolean equals(Object obj)\n    {\n        if (this == obj)\n        {\n            return true;\n        }\n        else if (obj instanceof ParameterizedType)\n        {\n            ParameterizedType that = (ParameterizedType) obj;\n            Type thatOwnerType = that.getOwnerType();\n            Type thatRawType = that.getRawType();\n            return (ownerType == null ? thatOwnerType == null : ownerType.equals(thatOwnerType))\n                    && (rawType == null ? thatRawType == null : rawType.equals(thatRawType))\n                    && Arrays.equals(actualTypeArguments, that.getActualTypeArguments());\n        }\n        else\n        {\n            return false;\n        }\n\n    }\n\n    @Override\n    public String toString()\n    {\n        StringBuilder sb = new StringBuilder();\n        sb.append(rawType);\n        if (actualTypeArguments.length > 0)\n        {\n            sb.append(\"<\");\n            for (Type actualType : actualTypeArguments)\n            {\n                sb.append(actualType);\n                sb.append(\",\");\n            }\n            sb.delete(sb.length() - 1, sb.length());\n            sb.append(\">\");\n        }\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProjectStageProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Produces;\nimport java.io.Serializable;\nimport java.util.logging.Logger;\n\n/**\n * <p>Produces {@link org.apache.deltaspike.core.api.projectstage.ProjectStage} configurations.</p>\n *\n * <p>The producer will try to detect the currently active ProjectStage on startup\n * and use that for all generated fields.</p>\n * <p>Usage:</p>\n * Simply inject the current ProjectStage into any bean:\n * <pre>\n * public class MyBean {\n *   private @Inject ProjectStage projectStage;\n *\n *   public void fn() {\n *     if(projectStage == ProjectStage.Production) {\n *        // do some production stuff...\n *     }\n *   }\n * }\n * </pre>\n *\n * <p>Please note that there can only be one ProjectStage per EAR.</p>\n */\n@ApplicationScoped\npublic class ProjectStageProducer implements Serializable\n{\n    /**\n     * These config keys will get used to detect the ProjectStage.\n     * We iterate through them until we find the first non-empty value.\n     */\n    public static final String[] CONFIG_SETTING_KEYS =\n    {\n        //TODO discuss it\n        \"org.apache.deltaspike.ProjectStage\",\n        \"jakarta.faces.PROJECT_STAGE\",\n        \"faces.PROJECT_STAGE\"\n    };\n\n    protected static final Logger LOG = Logger.getLogger(ProjectStageProducer.class.getName());\n\n    private static final long serialVersionUID = -2987762608635612074L;\n\n\n    /**\n     * The detected ProjectStage\n     */\n    private static volatile ProjectStage projectStage;\n\n    /**\n     * for the singleton factory\n     */\n    private static volatile ProjectStageProducer projectStageProducer;\n\n    /**\n     * ProjectStageProducers must only be created by subclassing producers\n     */\n    protected ProjectStageProducer()\n    {\n    }\n\n    /**\n     * We can only produce @Dependent scopes since an enum is final.\n     * @return current ProjectStage\n     */\n    @Produces\n    @Dependent\n    @Default\n    public ProjectStage getProjectStage()\n    {\n        if (projectStage == null)\n        {\n            //triggers initialization\n            getInstance();\n        }\n        return projectStage;\n    }\n\n    /**\n     * <p>This factory method should only get used if there is absolutely no way\n     * to get the current {@link ProjectStage} via &#064;Inject.</p>\n     *\n     * <p></p>\n     *\n     * @return the ProjectStageProducer instance.\n     */\n    public static ProjectStageProducer getInstance()\n    {\n        if (projectStageProducer == null)\n        {\n            lazyInit();\n        }\n\n        if (projectStage == null)\n        {\n            projectStageProducer.initProjectStage();\n        }\n\n        return projectStageProducer;\n    }\n\n    private static synchronized void lazyInit()\n    {\n        // switch into paranoia mode\n        if (projectStageProducer != null)\n        {\n            return;\n        }\n\n        ProjectStageProducer newProjectStageProducer = new ProjectStageProducer();\n        newProjectStageProducer.initProjectStage();\n\n        projectStageProducer = newProjectStageProducer;\n    }\n\n    /**\n     * Resolves the project-stage configured for DeltaSpike\n     * @return the resolved {@link ProjectStage} or <code>null</code> if none defined.\n     */\n    protected ProjectStage resolveProjectStage()\n    {\n        for (String configLocation : CONFIG_SETTING_KEYS)\n        {\n            String stageName = ConfigResolver.getPropertyValue(configLocation);\n\n            if (stageName != null && !stageName.isEmpty())\n            {\n                return ProjectStage.valueOf(stageName);\n            }\n\n        }\n\n        return null;\n    }\n\n    protected void initProjectStage()\n    {\n        // switch into paranoia mode\n        synchronized (ProjectStageProducer.class)\n        {\n            if (projectStage == null)\n            {\n                projectStage = resolveProjectStage();\n\n                if (projectStage == null)\n                {\n                    projectStage = ProjectStage.Production;\n                }\n\n                LOG.info(\"Computed the following DeltaSpike ProjectStage: \" + projectStage);\n            }\n        }\n    }\n\n    /*\n     * Methods which might be needed for unit tests\n     */\n\n    /**\n     * Can be used esp. for internal tests.\n     * Usage:\n     * <pre>\n     * new ProjectStageProducer() {\n     *     &#064;Override\n     *     protected void reset() { super.reset(); }\n     * }.reset();\n     * </pre>\n     */\n    protected void reset()\n    {\n        resetCache();\n    }\n\n    /**\n     * This function exists to prevent findbugs to complain about\n     * setting a static member from a non-static function.\n     */\n    private static void resetCache()\n    {\n        projectStage = null;\n        projectStageProducer = null;\n    }\n\n    /**\n     * This function can be used to manually set the ProjectStage for the application.\n     * This is e.g. useful in unit tests.\n     * @param ps the ProjectStage to set\n     */\n    public static void setProjectStage(ProjectStage ps)\n    {\n        if (projectStage == null)\n        {\n            LOG.info(\"change project-stage to \" + ps);\n        }\n        else if (!projectStage.equals(ps))\n        {\n            LOG.info(\"change project-stage from \" + projectStage + \" to \" + ps);\n        }\n\n        projectStage = ps;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/PropertyFileUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.util.Collections;\nimport java.util.Enumeration;\nimport java.util.Locale;\nimport java.util.Properties;\nimport java.util.ResourceBundle;\nimport java.util.Vector;\n\n@Vetoed\npublic abstract class PropertyFileUtils\n{\n    /**\n     * Constructor which prevents the instantiation of this class\n     */\n    private PropertyFileUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static Enumeration<URL> resolvePropertyFiles(String propertyFileName) throws IOException\n    {\n        if (propertyFileName != null && (propertyFileName.contains(\"://\") || propertyFileName.startsWith(\"file:\")))\n        {\n            // the given string is actually already an URL\n            Vector<URL> propertyFileUrls = new Vector<URL>();\n            URL url = new URL(propertyFileName);\n\n            if (propertyFileName.startsWith(\"file:\"))\n            {\n                try\n                {\n                    File file = new File(url.toURI());\n                    if (file.exists())\n                    {\n                        propertyFileUrls.add(url);\n                    }\n                }\n                catch (URISyntaxException e)\n                {\n                    throw new IllegalStateException(\"Property file URL is malformed\", e);\n                }\n            }\n            else\n            {\n                propertyFileUrls.add(url);\n            }\n\n            return propertyFileUrls.elements();\n        }\n\n        if (propertyFileName != null)\n        {\n            File file = new File(propertyFileName);\n            if (file.exists())\n            {\n                return Collections.enumeration(Collections.singleton(file.toURI().toURL()));\n            }\n        }\n\n        ClassLoader cl = ClassUtils.getClassLoader(null);\n\n        Enumeration<URL> propertyFileUrls = cl.getResources(propertyFileName);\n\n        //fallback - see DELTASPIKE-98\n        if (!propertyFileUrls.hasMoreElements())\n        {\n            cl = PropertyFileUtils.class.getClassLoader();\n            propertyFileUrls = cl.getResources(propertyFileName);\n        }\n\n        return propertyFileUrls;\n    }\n\n    public static Properties loadProperties(URL url)\n    {\n        Properties props = new Properties();\n\n        InputStream inputStream = null;\n        try\n        {\n            inputStream = url.openStream();\n\n            if (inputStream != null)\n            {\n                props.load(inputStream);\n            }\n        }\n        catch (IOException e)\n        {\n            throw new IllegalStateException(e);\n        }\n        finally\n        {\n            try\n            {\n                if (inputStream != null)\n                {\n                    inputStream.close();\n                }\n            }\n            catch (IOException e)\n            {\n                // no worries, means that the file is already closed\n            }\n        }\n\n        return props;\n    }\n\n    /**\n     * @return the ResourceBundle for the current default Locale\n     */\n    public static ResourceBundle getResourceBundle(String bundleName)\n    {\n        return getResourceBundle(bundleName, Locale.getDefault());\n    }\n\n    /**\n     * This uses the correct ThreadContextClassLoader if deployed in an Container.\n     * @return the ResourceBundle for the current Locale\n     */\n    public static ResourceBundle getResourceBundle(String bundleName, Locale locale)\n    {\n        return ResourceBundle.getBundle(bundleName, locale, ClassUtils.getClassLoader(null));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProxyUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.reflect.Proxy;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Helper for proxies\n */\n@Vetoed\npublic abstract class ProxyUtils\n{\n    private ProxyUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * @param currentClass current class\n     * @return class of the real implementation\n     */\n    public static Class getUnproxiedClass(Class currentClass)\n    {\n        Class unproxiedClass = currentClass;\n        \n        while (isProxiedClass(unproxiedClass))\n        {\n            unproxiedClass = unproxiedClass.getSuperclass();\n        }\n\n        return unproxiedClass;\n    }\n\n    /**\n     * Analyses if the given class is a generated proxy class\n     * @param currentClass current class\n     * @return true if the given class is a known proxy class, false otherwise\n     */\n    public static boolean isProxiedClass(Class currentClass)\n    {\n        if (currentClass == null || currentClass.getSuperclass() == null)\n        {\n            return false;\n        }\n\n        String name = currentClass.getName();\n        return name.startsWith(currentClass.getSuperclass().getName())\n                    && (name.contains(\"$$\") // CDI\n                    || name.contains(\"_ClientProxy\") //Quarkus\n                    || name.contains(\"$HibernateProxy$\")); // Hibernate\n    }\n\n    public static List<Class<?>> getProxyAndBaseTypes(Class<?> proxyClass)\n    {\n        List<Class<?>> result = new ArrayList<Class<?>>();\n        result.add(proxyClass);\n        \n        if (isInterfaceProxy(proxyClass))\n        {\n            for (Class<?> currentInterface : proxyClass.getInterfaces())\n            {\n                if (proxyClass.getName().startsWith(currentInterface.getName()))\n                {\n                    result.add(currentInterface);\n                }\n            }\n        }\n        else\n        {\n            Class unproxiedClass = proxyClass.getSuperclass();\n            result.add(unproxiedClass);\n\n            while (isProxiedClass(unproxiedClass))\n            {\n                unproxiedClass = unproxiedClass.getSuperclass();\n                result.add(unproxiedClass);\n            }\n        }\n        return result;\n    }\n\n    public static boolean isInterfaceProxy(Class<?> proxyClass)\n    {\n        Class<?>[] interfaces = proxyClass.getInterfaces();\n        if (Proxy.class.equals(proxyClass.getSuperclass()) &&\n                interfaces != null && interfaces.length > 0)\n        {\n            return true;\n        }\n        \n        if (proxyClass.getSuperclass() != null && !proxyClass.getSuperclass().equals(Object.class))\n        {\n            return false;\n        }\n        \n        if (proxyClass.getName().contains(\"$$\"))\n        {\n            for (Class<?> currentInterface : interfaces)\n            {\n                if (proxyClass.getName().startsWith(currentInterface.getName()))\n                {\n                    return true;\n                }\n            }\n        }\n        \n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.util.Nonbinding;\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.lang.reflect.WildcardType;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n\n/**\n * Utilities for common reflection based actions. Some are basic Java Reflection based, others are CDI based.\n */\n@Vetoed\npublic abstract class ReflectionUtils\n{\n    private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];\n\n    private ReflectionUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Get all the declared fields on the class hierarchy. This <b>will</b>\n     * return overridden fields.\n     *\n     * @param clazz The class to search\n     * @return the set of all declared fields or an empty set if there are none\n     */\n    public static Set<Field> getAllDeclaredFields(Class<?> clazz)\n    {\n        HashSet<Field> fields = new HashSet<Field>();\n        for (Class<?> c = clazz; c != null && c != Object.class; c = c.getSuperclass())\n        {\n            Collections.addAll(fields, c.getDeclaredFields());\n        }\n        return fields;\n    }\n\n    /**\n     * Search the class hierarchy for a field with the given name. Will return\n     * the nearest match, starting with the class specified and searching up the\n     * hierarchy.\n     *\n     * @param clazz The class to search\n     * @param name  The name of the field to search for\n     * @return The field found, or null if no field is found\n     */\n    public static Field tryToFindDeclaredField(Class<?> clazz, String name)\n    {\n        for (Class<?> c = clazz; c != null && c != Object.class; c = c.getSuperclass())\n        {\n            try\n            {\n                return c.getDeclaredField(name);\n            }\n            catch (NoSuchFieldException e)\n            {\n                // No-op, we continue looking up the class hierarchy\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Get all the declared methods on the class hierarchy. This <b>will</b>\n     * return overridden methods.\n     *\n     * @param clazz The class to search\n     * @return the set of all declared methods or an empty set if there are none\n     */\n    public static Set<Method> getAllDeclaredMethods(Class<?> clazz)\n    {\n        HashSet<Method> methods = new HashSet<Method>();\n        for (Class<?> c = clazz; c != null && c != Object.class; c = c.getSuperclass())\n        {\n            Collections.addAll(methods, c.getDeclaredMethods());\n        }\n        return methods;\n    }\n\n    private static String buildInvokeMethodErrorMessage(Method method, Object obj, Object... args)\n    {\n        StringBuilder message = new StringBuilder(String.format(\n                \"Details: Exception invoking method [%s] on object [%s], using arguments [\", method.getName(), obj));\n        if (args != null)\n        {\n            for (int i = 0; i < args.length; i++)\n            {\n                message.append(i > 0 ? \", \" : \"\").append(args[i]);\n            }\n        }\n        message.append(\"]\");\n        return message.toString();\n    }\n\n    /**\n     * <p>\n     * Invoke the method on the instance, with any arguments specified, casting\n     * the result of invoking the method to the expected return type.\n     * </p>\n     * <p/>\n     * <p>\n     * This method wraps {@link Method#invoke(Object, Object...)}, converting the\n     * checked exceptions that {@link Method#invoke(Object, Object...)} specifies\n     * to runtime exceptions.\n     * </p>\n     * <p/>\n     * <p>\n     * If instructed, this method attempts to set the accessible flag of the method in a\n     * {@link java.security.PrivilegedAction} before invoking the method.\n     * </p>\n     *\n     * @param setAccessible flag indicating whether method should first be set as\n     *                      accessible\n     * @param method        the method to invoke\n     * @param instance      the instance to invoke the method\n     * @param args          the arguments to the method\n     * @return the result of invoking the method, or null if the method's return\n     *         type is void\n     * @throws RuntimeException            if this <code>Method</code> object enforces Java\n     *                                     language access control and the underlying method is\n     *                                     inaccessible or if the underlying method throws an exception or\n     *                                     if the initialization provoked by this method fails.\n     * @throws IllegalArgumentException    if the method is an instance method and\n     *                                     the specified <code>instance</code> argument is not an instance\n     *                                     of the class or interface declaring the underlying method (or\n     *                                     of a subclass or implementor thereof); if the number of actual\n     *                                     and formal parameters differ; if an unwrapping conversion for\n     *                                     primitive arguments fails; or if, after possible unwrapping, a\n     *                                     parameter value cannot be converted to the corresponding formal\n     *                                     parameter type by a method invocation conversion.\n     * @throws NullPointerException        if the specified <code>instance</code> is\n     *                                     null and the method is an instance method.\n     * @throws ClassCastException          if the result of invoking the method cannot be\n     *                                     cast to the expectedReturnType\n     * @throws ExceptionInInitializerError if the initialization provoked by this\n     *                                     method fails.\n     * @see Method#invoke(Object, Object...)\n     */\n    public static <T> T invokeMethod(Object instance, \n                                     Method method, Class<T> expectedReturnType,\n                                     boolean setAccessible,\n                                     Object... args)\n    {\n        if (setAccessible && !method.isAccessible())\n        {\n            method.setAccessible(true);\n        }\n\n        try\n        {\n            return expectedReturnType.cast(method.invoke(instance, args));\n        }\n        catch (InvocationTargetException e)\n        {\n            //re-visit DELTASPIKE-299 before changing this part\n            ExceptionUtils.throwAsRuntimeException(e.getCause());\n            //won't happen\n            return null;\n        }\n        catch (Exception e)\n        {\n            String customMessage = createCustomMessage(e, method, instance, args);\n            ExceptionUtils.changeAndThrowException(e, customMessage);\n            //won't happen\n            return null;\n        }\n    }\n\n    private static String createCustomMessage(Exception e, Method method, Object targetObject, Object... arguments)\n    {\n        return e.getMessage() + buildInvokeMethodErrorMessage(method, targetObject, arguments);\n    }\n\n    /**\n     * Extract the raw type, given a type.\n     *\n     * @param <T>  the type\n     * @param type the type to extract the raw type from\n     * @return the raw type, or null if the raw type cannot be determined.\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <T> Class<T> getRawType(Type type)\n    {\n        if (type instanceof Class<?>)\n        {\n            return (Class<T>) type;\n        }\n        else if (type instanceof ParameterizedType && ((ParameterizedType) type).getRawType() instanceof Class<?>)\n        {\n            return (Class<T>) ((ParameterizedType) type).getRawType();\n        }\n        return null;\n    }\n\n    /**\n     * Check if a class is serializable.\n     *\n     * @param clazz The class to check\n     * @return true if the class implements serializable or is a primitive (needed for type {@link Void}\n     */\n    public static boolean isSerializable(Class<?> clazz)\n    {\n        return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);\n    }\n\n    /**\n     * Checks if class is final\n     *\n     * @param clazz The class to check\n     * @return True if final, false otherwise\n     */\n    public static boolean isFinal(Class<?> clazz)\n    {\n        return Modifier.isFinal(clazz.getModifiers());\n    }\n\n    /**\n     * Checks if member is final\n     *\n     * @param member The member to check\n     * @return True if final, false otherwise\n     */\n    public static boolean isFinal(Member member)\n    {\n        return Modifier.isFinal(member.getModifiers());\n    }\n\n    /**\n     * Checks if member is private\n     *\n     * @param member The member to check\n     * @return True if final, false otherwise\n     */\n    public static boolean isPrivate(Member member)\n    {\n        return Modifier.isPrivate(member.getModifiers());\n    }\n\n    public static boolean isPackagePrivate(int mod)\n    {\n        return !(Modifier.isPrivate(mod) || Modifier.isProtected(mod) || Modifier.isPublic(mod));\n    }\n\n    /**\n     * Checks if type is static\n     *\n     * @param type Type to check\n     * @return True if static, false otherwise\n     */\n    public static boolean isStatic(Class<?> type)\n    {\n        return Modifier.isStatic(type.getModifiers());\n    }\n\n    /**\n     * Checks if member is static\n     *\n     * @param member Member to check\n     * @return True if static, false otherwise\n     */\n    public static boolean isStatic(Member member)\n    {\n        return Modifier.isStatic(member.getModifiers());\n    }\n\n    public static boolean isTransient(Member member)\n    {\n        return Modifier.isTransient(member.getModifiers());\n    }\n\n    /**\n     * Checks if a method is abstract\n     */\n    public static boolean isAbstract(Method method)\n    {\n        return Modifier.isAbstract(method.getModifiers());\n    }\n\n    /**\n     * Gets the actual type arguments of a class\n     *\n     * @param clazz The class to examine\n     * @return The type arguments\n     */\n    public static Type[] getActualTypeArguments(Class<?> clazz)\n    {\n        if (clazz == null)\n        {\n            throw new IllegalArgumentException(\"null isn't supported\");\n        }\n\n        return clazz.getTypeParameters();\n    }\n\n    /**\n     * Gets the actual type arguments of a Type\n     *\n     * @param type The type to examine\n     * @return The type arguments\n     */\n    public static Type[] getActualTypeArguments(Type type)\n    {\n        if (type instanceof Class)\n        {\n            return getActualTypeArguments((Class)type);\n        }\n\n        throw new IllegalArgumentException((type != null ? type.getClass().getName() : \"null\") + \" isn't supported\");\n    }\n\n    /**\n     * Checks if raw type is array type\n     *\n     * @param rawType The raw type to check\n     * @return True if array, false otherwise\n     */\n    public static boolean isArrayType(Class<?> rawType)\n    {\n        return rawType.isArray();\n    }\n\n    /**\n     * Checks if type is parameterized type\n     *\n     * @param type The type to check\n     * @return True if parameterized, false otherwise\n     */\n    public static boolean isParameterizedType(Class<?> type)\n    {\n        return type.getTypeParameters().length > 0;\n    }\n\n    public static boolean isParameterizedTypeWithWildcard(Class<?> type)\n    {\n        if (isParameterizedType(type))\n        {\n            return containsWildcards(type.getTypeParameters());\n        }\n        else\n        {\n            return false;\n        }\n    }\n\n    private static boolean containsWildcards(Type[] types)\n    {\n        for (Type type : types)\n        {\n            if (type instanceof WildcardType)\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public static boolean isPrimitive(Type type)\n    {\n        Class<?> rawType = getRawType(type);\n        return rawType != null && rawType.isPrimitive();\n    }\n\n    public static int calculateHashCodeOfAnnotation(Annotation annotation, boolean skipNonbindingMembers)\n    {\n        Class annotationClass = annotation.annotationType();\n\n        // the hashCode of an Annotation is calculated solely via the hashCodes\n        // of it's members. If there are no members, it is 0.\n        // thus we first need to get the annotation-class hashCode\n        int hashCode = calculateHashCodeOfType(annotationClass);\n\n        // and now add the hashCode of all it's Nonbinding members\n        // the following algorithm is defined by the Annotation class definition\n        // see the JavaDoc for Annotation!\n        // we only change it so far that we skip evaluating @Nonbinding members\n        final Method[] members = annotationClass.getDeclaredMethods();\n\n        for (Method member : members)\n        {\n            if (skipNonbindingMembers && member.isAnnotationPresent(Nonbinding.class))\n            {\n                // ignore the non binding\n                continue;\n            }\n\n            // Member value\n            final Object object = invokeMethod(annotation, member, Object.class, true, EMPTY_OBJECT_ARRAY);\n            final int value;\n            if (object.getClass().isArray())\n            {\n                Class<?> type = object.getClass().getComponentType();\n                if (type.isPrimitive())\n                {\n                    if (Long.TYPE == type)\n                    {\n                        value = Arrays.hashCode((long[]) object);\n                    }\n                    else if (Integer.TYPE == type)\n                    {\n                        value = Arrays.hashCode((int[])object);\n                    }\n                    else if (Short.TYPE == type)\n                    {\n                        value = Arrays.hashCode((short[])object);\n                    }\n                    else if (Double.TYPE == type)\n                    {\n                        value = Arrays.hashCode((double[])object);\n                    }\n                    else if (Float.TYPE == type)\n                    {\n                        value = Arrays.hashCode((float[])object);\n                    }\n                    else if (Boolean.TYPE == type)\n                    {\n                        value = Arrays.hashCode((boolean[])object);\n                    }\n                    else if (Byte.TYPE == type)\n                    {\n                        value = Arrays.hashCode((byte[])object);\n                    }\n                    else if (Character.TYPE == type)\n                    {\n                        value = Arrays.hashCode((char[])object);\n                    }\n                    else\n                    {\n                        value = 0;\n                    }\n                }\n                else\n                {\n                    value = Arrays.hashCode((Object[])object);\n                }\n            }\n            else\n            {\n                value = object.hashCode();\n            }\n\n            hashCode = 29 * hashCode + value;\n            hashCode = 29 * hashCode + member.getName().hashCode();\n        }\n\n        return hashCode;\n    }\n\n    /**\n     * We need this method as some weird JVMs return 0 as hashCode for classes.\n     * In that case we return the hashCode of the String.\n     */\n    public static int calculateHashCodeOfType(Type type)\n    {\n        int typeHash = type.hashCode();\n        if (typeHash == 0 && type instanceof Class)\n        {\n            return ((Class)type).getName().hashCode();\n            // the type.toString() is always the same: \"java.lang.Class@<hexid>\"\n            // was: return type.toString().hashCode();\n        }\n\n        return typeHash;\n    }\n    \n    public static boolean hasSameSignature(Method a, Method b)\n    {\n        return a.getName().equals(b.getName())\n                && a.getReturnType().equals(b.getReturnType())\n                && Arrays.equals(a.getParameterTypes(), b.getParameterTypes());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ServiceUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\n/**\n * Allows handling the lookup (with fallbacks) in a central place.\n * See DELTASPIKE-97\n */\n@Vetoed\npublic abstract class ServiceUtils\n{\n    private static final Logger LOG = Logger.getLogger(ServiceUtils.class.getName());\n\n    private ServiceUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static <T> List<T> loadServiceImplementations(Class<T> serviceType)\n    {\n        return loadServiceImplementations(serviceType, false);\n    }\n\n    public static <T> List<T> loadServiceImplementations(Class<T> serviceType,\n                                                         boolean ignoreServicesWithMissingDependencies)\n    {\n        return loadServiceImplementations(serviceType, ignoreServicesWithMissingDependencies, null);\n    }\n\n    public static <T> List<T> loadServiceImplementations(Class<T> serviceType,\n                                                         boolean ignoreServicesWithMissingDependencies,\n                                                         ClassLoader classLoader)\n    {\n        List<T> result = new ArrayList<T>();\n\n        Iterator<T> servicesIterator;\n        if (classLoader != null)\n        {\n            servicesIterator = ServiceLoader.load(serviceType, classLoader).iterator();\n        }\n        else\n        {\n            servicesIterator = ServiceLoader.load(serviceType).iterator();\n        }\n\n        if (!servicesIterator.hasNext())\n        {\n            ClassLoader fallbackClassLoader = ServiceUtils.class.getClassLoader();\n            servicesIterator = ServiceLoader.load(serviceType, fallbackClassLoader).iterator();\n        }\n\n        while (servicesIterator.hasNext())\n        {\n            try\n            {\n                T service = servicesIterator.next();\n\n                if (service instanceof Deactivatable &&\n                        !ClassDeactivationUtils.isActivated((Class<? extends Deactivatable>) service.getClass()))\n                {\n                    LOG.info(\"deactivated service: \" + service.getClass().getName());\n\n                    continue;\n                }\n                result.add(service);\n            }\n            catch (Throwable t)\n            {\n                if (!ignoreServicesWithMissingDependencies)\n                {\n                    throw ExceptionUtils.throwAsRuntimeException(t);\n                }\n                else\n                {\n                    LOG.info(\"service filtered - caused by \" + t.getMessage());\n                }\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/StringUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Vetoed\npublic abstract class StringUtils\n{\n    /**\n     * Constructor which prevents the instantiation of this class\n     */\n    private StringUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static boolean isEmpty(String string)\n    {\n        return string == null || string.trim().isEmpty();\n    }\n\n    public static boolean isNotEmpty(String text)\n    {\n        return !isEmpty(text);\n    }\n\n    /**\n     * Remove any non-numeric, non-alphanumeric Characters in the given String\n     * @param val\n     * @return the original string but any non-numeric, non-alphanumeric is replaced with a '_'\n     */\n    public static String removeSpecialChars(String val)\n    {\n        if (val == null)\n        {\n            return null;\n        }\n\n        int len = val.length();\n        char[] newBuf = new char[len];\n        val.getChars(0, len, newBuf, 0);\n        for (int i = 0; i < len; i++)\n        {\n            char c = newBuf[i];\n            if (c >= 'a' && c <= 'z' ||\n                c >= 'A' && c <= 'Z' ||\n                c >= '0' && c <= '9' ||\n                c == '-' ||\n                c == '_')\n            {\n                continue;\n            }\n\n            // every other char gets replaced with '_'\n            newBuf[i] = '_';\n        }\n\n        return new String(newBuf);\n    }\n\n}"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.context;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.context.spi.Context;\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * A skeleton containing the most important parts of a custom CDI Context.\n * An implementing Context needs to implement the missing methods from the\n * {@link Context} interface and {@link #getContextualStorage(Contextual, boolean)}.\n */\npublic abstract class AbstractContext implements Context\n{\n    /**\n     * Whether the Context is for a passivating scope.\n     */\n    private final boolean passivatingScope;\n\n    protected AbstractContext(BeanManager beanManager)\n    {\n        passivatingScope = beanManager.isPassivatingScope(getScope());\n    }\n\n    /**\n     * An implementation has to return the underlying storage which\n     * contains the items held in the Context.\n     * @param createIfNotExist whether a ContextualStorage shall get created if it doesn't yet exist.\n     * @return the underlying storage\n     */\n    protected abstract ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExist);\n\n    protected List<ContextualStorage> getActiveContextualStorages()\n    {\n        List<ContextualStorage> result = new ArrayList<ContextualStorage>();\n        result.add(getContextualStorage(null, false));\n        return result;\n    }\n\n    /**\n     * @return whether the served scope is a passivating scope\n     */\n    public boolean isPassivatingScope()\n    {\n        return passivatingScope;\n    }\n\n    @Override\n    public <T> T get(Contextual<T> bean)\n    {\n        checkActive();\n\n        ContextualStorage storage = getContextualStorage(bean, false);\n        if (storage == null)\n        {\n            return null;\n        }\n\n        Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();\n        ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));\n        if (contextualInstanceInfo == null)\n        {\n            return null;\n        }\n\n        return (T) contextualInstanceInfo.getContextualInstance();\n    }\n\n    @Override\n    public <T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)\n    {\n        if (creationalContext == null)\n        {\n            return get(bean);\n        }\n        \n        checkActive();\n\n        if (passivatingScope)\n        {\n            if (!(bean instanceof PassivationCapable))\n            {\n                throw new IllegalStateException(bean.toString() +\n                        \" doesn't implement \" + PassivationCapable.class.getName());\n            }\n        }\n\n        ContextualStorage storage = getContextualStorage(bean, true);\n\n        Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();\n        ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));\n\n        if (contextualInstanceInfo != null)\n        {\n            @SuppressWarnings(\"unchecked\")\n            final T instance =  (T) contextualInstanceInfo.getContextualInstance();\n\n            if (instance != null)\n            {\n                return instance;\n            }\n        }\n\n        return storage.createContextualInstance(bean, creationalContext);\n    }\n\n    /**\n     * Destroy the Contextual Instance of the given Bean.\n     * @param bean dictates which bean shall get cleaned up\n     * @return <code>true</code> if the bean was destroyed, <code>false</code> if there was no such bean.\n     */\n    public boolean destroy(Contextual bean)\n    {\n        ContextualStorage storage = getContextualStorage(bean, false);\n        if (storage == null)\n        {\n            return false;\n        }\n\n        ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().remove(storage.getBeanKey(bean));\n\n        if (contextualInstanceInfo == null)\n        {\n            return false;\n        }\n\n        destroyBean(bean, contextualInstanceInfo);\n\n        return true;\n    }\n\n    /**\n     * destroys all the Contextual Instances in the Storage returned by\n     * {@link #getContextualStorage(Contextual, boolean)}.\n     */\n    public void destroyAllActive()\n    {\n        List<ContextualStorage> storages = getActiveContextualStorages();\n        if (storages == null)\n        {\n            return;\n        }\n\n        for (ContextualStorage storage : storages)\n        {\n            if (storage != null)\n            {\n                destroyAllActive(storage);\n            }\n        }\n    }\n\n    /**\n     * Destroys all the Contextual Instances in the specified ContextualStorage.\n     * This is a static method to allow various holder objects to cleanup\n     * properly in &#064;PreDestroy.\n     */\n    public static Map<Object, ContextualInstanceInfo<?>> destroyAllActive(ContextualStorage storage)\n    {\n        //drop all entries in the storage before starting with destroying the original entries\n        Map<Object, ContextualInstanceInfo<?>> contextMap =\n                new HashMap<Object, ContextualInstanceInfo<?>>(storage.getStorage());\n        storage.getStorage().clear();\n\n        for (Map.Entry<Object, ContextualInstanceInfo<?>> entry : contextMap.entrySet())\n        {\n            Contextual bean = storage.getBean(entry.getKey());\n\n            ContextualInstanceInfo<?> contextualInstanceInfo = entry.getValue();\n            destroyBean(bean, contextualInstanceInfo);\n        }\n        return contextMap;\n    }\n\n    public static void destroyBean(Contextual bean, ContextualInstanceInfo<?> contextualInstanceInfo)\n    {\n        bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());\n    }\n\n    /**\n     * Make sure that the Context is really active.\n     * @throws ContextNotActiveException if there is no active\n     *         Context for the current Thread.\n     */\n    protected void checkActive()\n    {\n        if (!isActive())\n        {\n            throw new ContextNotActiveException(\"CDI context with scope annotation @\"\n                + getScope().getName() + \" is not active with respect to the current thread\");\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/ContextualInstanceInfo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.context;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport java.io.Serializable;\n\n/**\n * This data holder contains all necessary data you need to\n * store a Contextual Instance in a CDI Context.\n */\npublic class ContextualInstanceInfo<T> implements Serializable\n{\n    private static final long serialVersionUID = 6384932199958645324L;\n\n    /**\n     * The actual Contextual Instance in the context\n     */\n    private T contextualInstance;\n\n    /**\n     * We need to store the CreationalContext as we need it for\n     * properly destroying the contextual instance via\n     * {@link jakarta.enterprise.context.spi.Contextual#destroy(Object, jakarta.enterprise.context.spi.CreationalContext)}\n     */\n    private CreationalContext<T> creationalContext;\n\n    /**\n     * @return the CreationalContext of the bean\n     */\n    public CreationalContext<T> getCreationalContext()\n    {\n        return creationalContext;\n    }\n\n    /**\n     * @param creationalContext the CreationalContext of the bean\n     */\n    public void setCreationalContext(CreationalContext<T> creationalContext)\n    {\n        this.creationalContext = creationalContext;\n    }\n\n    /**\n     * @return the contextual instance itself\n     */\n    public T getContextualInstance()\n    {\n        return contextualInstance;\n    }\n\n    /**\n     * @param contextualInstance the contextual instance itself\n     */\n    public void setContextualInstance(T contextualInstance)\n    {\n        this.contextualInstance = contextualInstance;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/ContextualStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.context;\n\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport java.io.Serializable;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\n\n/**\n * This Storage holds all information needed for storing\n * Contextual Instances in a Context.\n *\n * It also addresses Serialisation in case of passivating scopes.\n */\npublic class ContextualStorage implements Serializable\n{\n    private static final long serialVersionUID = 1L;\n\n    private final Map<Object, ContextualInstanceInfo<?>> contextualInstances;\n\n    private final BeanManager beanManager;\n\n    private final boolean concurrent;\n\n    private final boolean passivationCapable;\n\n    /**\n     * @param beanManager is needed for serialisation\n     * @param concurrent whether the ContextualStorage might get accessed concurrently by different threads\n     * @param passivationCapable whether the storage is for passivation capable Scopes\n     */\n    public ContextualStorage(BeanManager beanManager, boolean concurrent, boolean passivationCapable)\n    {\n        this.beanManager = beanManager;\n        this.concurrent = concurrent;\n        this.passivationCapable = passivationCapable;\n        if (concurrent)\n        {\n            contextualInstances = new ConcurrentHashMap<Object, ContextualInstanceInfo<?>>();\n        }\n        else\n        {\n            contextualInstances = new HashMap<Object, ContextualInstanceInfo<?>>();\n        }\n    }\n\n    /**\n     * @return the underlying storage map.\n     */\n    public Map<Object, ContextualInstanceInfo<?>> getStorage()\n    {\n        return contextualInstances;\n    }\n\n    /**\n     * @return whether the ContextualStorage might get accessed concurrently by different threads.\n     */\n    public boolean isConcurrent()\n    {\n        return concurrent;\n    }\n\n    /**\n     *\n     * @param bean\n     * @param creationalContext\n     * @param <T>\n     * @return\n     */\n    public <T> T createContextualInstance(Contextual<T> bean, CreationalContext<T> creationalContext)\n    {\n        Object beanKey = getBeanKey(bean);\n        if (isConcurrent())\n        {\n            // locked approach\n            ContextualInstanceInfo<T> instanceInfo = new ContextualInstanceInfo<T>();\n\n            ConcurrentMap<Object, ContextualInstanceInfo<?>> concurrentMap\n                = (ConcurrentHashMap<Object, ContextualInstanceInfo<?>>) contextualInstances;\n\n            ContextualInstanceInfo<T> oldInstanceInfo\n                = (ContextualInstanceInfo<T>) concurrentMap.putIfAbsent(beanKey, instanceInfo);\n\n            if (oldInstanceInfo != null)\n            {\n                instanceInfo = oldInstanceInfo;\n            }\n            synchronized (instanceInfo)\n            {\n                T instance = instanceInfo.getContextualInstance();\n                if (instance == null)\n                {\n                    instance = bean.create(creationalContext);\n                    instanceInfo.setContextualInstance(instance);\n                    instanceInfo.setCreationalContext(creationalContext);\n                }\n\n                return instance;\n            }\n\n        }\n        else\n        {\n            // simply create the contextual instance\n            ContextualInstanceInfo<T> instanceInfo = new ContextualInstanceInfo<T>();\n            instanceInfo.setCreationalContext(creationalContext);\n            instanceInfo.setContextualInstance(bean.create(creationalContext));\n\n            contextualInstances.put(beanKey, instanceInfo);\n\n            return instanceInfo.getContextualInstance();\n        }\n    }\n\n    /**\n     * If the context is a passivating scope then we return\n     * the passivationId of the Bean. Otherwise we use\n     * the Bean directly.\n     * @return the key to use in the context map\n     */\n    public <T> Object getBeanKey(Contextual<T> bean)\n    {\n        if (passivationCapable)\n        {\n            // if the\n            return ((PassivationCapable) bean).getId();\n        }\n\n        return bean;\n    }\n\n    /**\n     * Restores the Bean from its beanKey.\n     * @see #getBeanKey(jakarta.enterprise.context.spi.Contextual)\n     */\n    public Contextual<?> getBean(Object beanKey)\n    {\n        if (passivationCapable)\n        {\n            return beanManager.getPassivationCapableBean((String) beanKey);\n        }\n        else\n        {\n            return (Contextual<?>) beanKey;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/interceptor/AbstractInvocationContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.interceptor;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Method;\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Vetoed\npublic abstract class AbstractInvocationContext<T> implements InvocationContext\n{\n    protected final T target;\n    protected final Method method;\n    protected final Object timer;\n\n    protected Object[] parameters;\n    protected Map<String, Object> contextData;\n\n    protected AbstractInvocationContext(T target, Method method, Object[] parameters, Object timer)\n    {\n        this.target = target;\n        this.method = method;\n        this.parameters = parameters;\n        this.timer = timer;\n    }\n\n\n    @Override\n    public Object getTarget()\n    {\n        return target;\n    }\n\n    @Override\n    public Method getMethod()\n    {\n        return method;\n    }\n\n    @Override\n    public Object getTimer()\n    {\n        return timer;\n    }\n\n    @Override\n    public Object[] getParameters()\n    {\n        return parameters;\n    }\n\n    @Override\n    public void setParameters(Object[] parameters)\n    {\n        this.parameters = parameters;\n    }\n\n    @Override\n    public Map<String, Object> getContextData()\n    {\n        if (contextData == null)\n        {\n            contextData = new HashMap<String, Object>();\n        }\n        return contextData;\n    }\n\n    // @Override - forward compatibility to interceptors API 1.2\n    public Constructor<?> getConstructor()\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/AnnotationInstanceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util.metadata;\n\n\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Proxy;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Map;\n\n/**\n * <p>A small helper class to create an Annotation instance of the given annotation class\n * via {@link java.lang.reflect.Proxy}. The annotation literal gets filled with the default values.</p>\n * <p/>\n * <p>This class can be used to dynamically create Annotations which can be usd in AnnotatedTyp.\n * This is e.g. the case if you configure an annotation via properties or XML file. In those cases you\n * cannot use {@link jakarta.enterprise.util.AnnotationLiteral} because the type is not known at compile time.</p>\n * <p>usage:</p>\n * <pre>\n * String annotationClassName = ...;\n * Class<? extends annotation> annotationClass =\n *     (Class<? extends Annotation>) ClassUtils.getClassLoader(null).loadClass(annotationClassName);\n * Annotation a = AnnotationInstanceProvider.of(annotationClass)\n * </pre>\n */\npublic class AnnotationInstanceProvider implements Annotation, InvocationHandler, Serializable\n{\n    private static final long serialVersionUID = -2345068201195886173L;\n    private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];\n    private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];\n\n    private final Class<? extends Annotation> annotationClass;\n    private final Map<String, ?> memberValues;\n\n    /**\n     * Required to use the result of the factory instead of a default implementation\n     * of {@link jakarta.enterprise.util.AnnotationLiteral}.\n     *\n     * @param annotationClass class of the target annotation\n     */\n    private AnnotationInstanceProvider(Class<? extends Annotation> annotationClass, Map<String, ?> memberValues)\n    {\n        this.annotationClass = annotationClass;\n        this.memberValues = memberValues;\n    }\n\n    /**\n     * Creates an annotation instance for the given annotation class\n     *\n     * @param annotationClass type of the target annotation\n     * @param values          A non-null map of the member values, keys being the name of the members\n     * @param <T>             current type\n     * @return annotation instance for the given type\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <T extends Annotation> T of(Class<T> annotationClass, Map<String, ?> values)\n    {\n        if (values == null)\n        {\n            throw new IllegalArgumentException(\"Map of values must not be null\");\n        }\n\n        String key = annotationClass.getName() + \"_\" + values.hashCode();\n\n        return (T) initAnnotation(key, annotationClass, values);\n    }\n\n    /**\n     * Creates an annotation instance for the given annotation class\n     *\n     * @param annotationClass type of the target annotation\n     * @param <T>             current type\n     * @return annotation instance for the given type\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <T extends Annotation> T of(Class<T> annotationClass)\n    {\n        return (T) of(annotationClass, Collections.EMPTY_MAP);\n    }\n\n    private static synchronized <T extends Annotation> Annotation initAnnotation(String key,\n                                                                                 Class<T> annotationClass,\n                                                                                 Map<String, ?> values)\n    {\n        return (Annotation) Proxy.newProxyInstance(annotationClass.getClassLoader(),\n            new Class[]{annotationClass},\n            new AnnotationInstanceProvider(annotationClass, values));\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Object invoke(Object proxy, Method method, Object[] args) throws Exception\n    {\n        if (\"hashCode\".equals(method.getName()))\n        {\n            return hashCode();\n        }\n        else if (\"equals\".equals(method.getName()))\n        {\n            if (Proxy.isProxyClass(args[0].getClass()))\n            {\n                if (Proxy.getInvocationHandler(args[0]) instanceof AnnotationInstanceProvider)\n                {\n                    return equals(Proxy.getInvocationHandler(args[0]));\n                }\n            }\n            return equals(args[0]);\n        }\n        else if (\"annotationType\".equals(method.getName()))\n        {\n            return annotationType();\n        }\n        else if (\"toString\".equals(method.getName()))\n        {\n            return toString();\n        }\n        else\n        {\n            if (memberValues.containsKey(method.getName()))\n            {\n                return memberValues.get(method.getName());\n            }\n            else // Default cause, probably won't ever happen, unless annotations get actual methods\n            {\n                return method.getDefaultValue();\n            }\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Class<? extends Annotation> annotationType()\n    {\n        return annotationClass;\n    }\n\n    /**\n     * Copied from Apache OWB (jakarta.enterprise.util.AnnotationLiteral#toString())\n     * with minor changes.\n     *\n     * @return the current state of the annotation as string\n     */\n    @Override\n    public String toString()\n    {\n        Method[] methods = annotationClass.getDeclaredMethods();\n\n        StringBuilder sb = new StringBuilder(\"@\" + annotationType().getName() + \"(\");\n        int length = methods.length;\n\n        for (int i = 0; i < length; i++)\n        {\n            // Member name\n            sb.append(methods[i].getName()).append(\"=\");\n\n            // Member value\n            Object memberValue;\n            try\n            {\n                memberValue = invoke(this, methods[i], EMPTY_OBJECT_ARRAY);\n            }\n            catch (Exception e)\n            {\n                memberValue = \"\";\n            }\n            sb.append(memberValue);\n\n            if (i < length - 1)\n            {\n                sb.append(\",\");\n            }\n        }\n\n        sb.append(\")\");\n\n        return sb.toString();\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (!(o instanceof AnnotationInstanceProvider))\n        {\n            if (annotationClass.isInstance(o))\n            {\n                for (Map.Entry<String, ?> entry : memberValues.entrySet())\n                {\n                    try\n                    {\n                        Object oValue = annotationClass.getMethod(entry.getKey(), EMPTY_CLASS_ARRAY)\n                                .invoke(o, EMPTY_OBJECT_ARRAY);\n                        if (oValue != null && entry.getValue() != null)\n                        {\n                            if (!oValue.equals(entry.getValue()))\n                            {\n                                return false;\n                            }\n                        }\n                        else // This may not actually ever happen, unless null is a default for a member\n                        {\n                            return false;\n                        }\n                    }\n                    catch (IllegalAccessException e)\n                    {\n                        throw new RuntimeException(e);\n                    }\n                    catch (InvocationTargetException e)\n                    {\n                        throw new RuntimeException(e);\n                    }\n                    catch (NoSuchMethodException e)\n                    {\n                        throw new RuntimeException(e);\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n\n        AnnotationInstanceProvider that = (AnnotationInstanceProvider) o;\n\n        if (!annotationClass.equals(that.annotationClass))\n        {\n            return false;\n        }\n\n        return memberValues.equals(that.memberValues);\n    }\n\n    @Override\n    public int hashCode()\n    {\n        int result = 0;\n        Class<? extends Annotation> type = annotationClass;\n        for (Method m : type.getDeclaredMethods())\n        {\n            try\n            {\n                Object value = invoke(this, m, EMPTY_OBJECT_ARRAY);\n                if (value == null)\n                {\n                    throw new IllegalStateException(String.format(\"Annotation method %s returned null\", m));\n                }\n                result += hashMember(m.getName(), value);\n            }\n            catch (RuntimeException ex)\n            {\n                throw ex;\n            }\n            catch (Exception ex)\n            {\n                throw new RuntimeException(ex);\n            }\n        }\n        return result;\n    }\n\n    //besides modularity, this has the advantage of autoboxing primitives:\n\n    /**\n     * Helper method for generating a hash code for a member of an annotation.\n     *\n     * @param name  the name of the member\n     * @param value the value of the member\n     * @return a hash code for this member\n     */\n    private int hashMember(String name, Object value)\n    {\n        int part1 = name.hashCode() * 127;\n        if (value.getClass().isArray())\n        {\n            return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);\n        }\n        if (value instanceof Annotation)\n        {\n            return part1 ^ hashCode((Annotation) value);\n        }\n        return part1 ^ value.hashCode();\n    }\n\n    /**\n     * Helper method for generating a hash code for an array.\n     *\n     * @param componentType the component type of the array\n     * @param o             the array\n     * @return a hash code for the specified array\n     */\n    private static int arrayMemberHash(Class<?> componentType, Object o)\n    {\n        if (componentType.equals(Byte.TYPE))\n        {\n            return Arrays.hashCode((byte[]) o);\n        }\n        if (componentType.equals(Short.TYPE))\n        {\n            return Arrays.hashCode((short[]) o);\n        }\n        if (componentType.equals(Integer.TYPE))\n        {\n            return Arrays.hashCode((int[]) o);\n        }\n        if (componentType.equals(Character.TYPE))\n        {\n            return Arrays.hashCode((char[]) o);\n        }\n        if (componentType.equals(Long.TYPE))\n        {\n            return Arrays.hashCode((long[]) o);\n        }\n        if (componentType.equals(Float.TYPE))\n        {\n            return Arrays.hashCode((float[]) o);\n        }\n        if (componentType.equals(Double.TYPE))\n        {\n            return Arrays.hashCode((double[]) o);\n        }\n        if (componentType.equals(Boolean.TYPE))\n        {\n            return Arrays.hashCode((boolean[]) o);\n        }\n        return Arrays.hashCode((Object[]) o);\n    }\n\n    /**\n     * <p>Generate a hash code for the given annotation using the algorithm\n     * presented in the {@link Annotation#hashCode()} API docs.</p>\n     *\n     * @param a the Annotation for a hash code calculation is desired, not\n     *          {@code null}\n     * @return the calculated hash code\n     * @throws RuntimeException      if an {@code Exception} is encountered during\n     *                               annotation member access\n     * @throws IllegalStateException if an annotation method invocation returns\n     *                               {@code null}\n     */\n    private int hashCode(Annotation a)\n    {\n        int result = 0;\n        Class<? extends Annotation> type = a.annotationType();\n        for (Method m : type.getDeclaredMethods())\n        {\n            try\n            {\n                Object value = m.invoke(a);\n                if (value == null)\n                {\n                    throw new IllegalStateException(String.format(\"Annotation method %s returned null\", m));\n                }\n                result += hashMember(m.getName(), value);\n            }\n            catch (RuntimeException ex)\n            {\n                throw ex;\n            }\n            catch (Exception ex)\n            {\n                throw new RuntimeException(ex);\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/ImmutableInjectionPoint.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport org.apache.deltaspike.core.util.BeanUtils;\n\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Type;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport static java.util.Collections.unmodifiableSet;\n\n/**\n * <p>\n * A base class for implementing {@link InjectionPoint}. The attributes are\n * immutable, and collections are defensively copied on instantiation.\n * </p>\n */\npublic class ImmutableInjectionPoint implements InjectionPoint\n{\n\n    private final Annotated annotated;\n    private final Member member;\n    private final Bean<?> declaringBean;\n    private final Set<Annotation> qualifiers;\n    private final Type type;\n    private final boolean isTransient;\n    private final boolean delegate;\n\n    /**\n     * Instantiate a new {@link InjectionPoint} based upon an\n     * {@link AnnotatedField}.\n     *\n     * @param field         the field for which to create the injection point\n     * @param qualifiers    the qualifiers on the injection point\n     * @param declaringBean the declaringBean declaring the injection point\n     * @param isTransient   <code>true</code> if the injection point is transient\n     * @param delegate      <code>true</code> if the injection point is a delegate\n     *                      injection point on a decorator\n     */\n    public ImmutableInjectionPoint(AnnotatedField<?> field, Set<Annotation> qualifiers, Bean<?> declaringBean,\n                                   boolean isTransient, boolean delegate)\n    {\n        annotated = field;\n        member = field.getJavaMember();\n        this.qualifiers = new HashSet<Annotation>(qualifiers);\n        type = field.getJavaMember().getGenericType();\n        this.isTransient = isTransient;\n        this.delegate = delegate;\n        this.declaringBean = declaringBean;\n    }\n\n    /**\n     * Instantiate a new {@link InjectionPoint} based upon an\n     * {@link AnnotatedField}, reading the qualifiers from the annotations\n     * declared on the field.\n     *\n     * @param field         the field for which to create the injection point\n     * @param declaringBean the declaringBean declaring the injection point\n     * @param isTransient   <code>true</code> if the injection point is transient\n     * @param delegate      <code>true</code> if the injection point is a delegate\n     *                      injection point on a decorator\n     */\n    public ImmutableInjectionPoint(AnnotatedField<?> field, BeanManager beanManager, Bean<?> declaringBean,\n                                   boolean isTransient, boolean delegate)\n    {\n        annotated = field;\n        member = field.getJavaMember();\n        qualifiers = BeanUtils.getQualifiers(beanManager, field.getAnnotations());\n        type = field.getJavaMember().getGenericType();\n        this.isTransient = isTransient;\n        this.delegate = delegate;\n        this.declaringBean = declaringBean;\n    }\n\n    /**\n     * Instantiate a new {@link InjectionPoint} based upon an\n     * {@link AnnotatedParameter}.\n     *\n     * @param parameter     the parameter for which to create the injection point\n     * @param qualifiers    the qualifiers on the injection point\n     * @param declaringBean the declaringBean declaring the injection point\n     * @param isTransient   <code>true</code> if the injection point is transient\n     * @param delegate      <code>true</code> if the injection point is a delegate\n     *                      injection point on a decorator\n     */\n    public ImmutableInjectionPoint(AnnotatedParameter<?> parameter, Set<Annotation> qualifiers, Bean<?> declaringBean,\n                                   boolean isTransient, boolean delegate)\n    {\n        annotated = parameter;\n        member = parameter.getDeclaringCallable().getJavaMember();\n        this.qualifiers = new HashSet<Annotation>(qualifiers);\n        this.isTransient = isTransient;\n        this.delegate = delegate;\n        this.declaringBean = declaringBean;\n        type = parameter.getBaseType();\n    }\n\n    /**\n     * Instantiate a new {@link InjectionPoint} based upon an\n     * {@link AnnotatedParameter}, reading the qualifiers from the annotations\n     * declared on the parameter.\n     *\n     * @param parameter     the parameter for which to create the injection point\n     * @param declaringBean the declaringBean declaring the injection point\n     * @param isTransient   <code>true</code> if the injection point is transient\n     * @param delegate      <code>true</code> if the injection point is a delegate\n     *                      injection point on a decorator\n     */\n    public ImmutableInjectionPoint(AnnotatedParameter<?> parameter, BeanManager beanManager, Bean<?> declaringBean,\n                                   boolean isTransient, boolean delegate)\n    {\n        annotated = parameter;\n        member = parameter.getDeclaringCallable().getJavaMember();\n        qualifiers = BeanUtils.getQualifiers(beanManager, parameter.getAnnotations());\n        this.isTransient = isTransient;\n        this.delegate = delegate;\n        this.declaringBean = declaringBean;\n        type = parameter.getBaseType();\n    }\n\n    public Annotated getAnnotated()\n    {\n        return annotated;\n    }\n\n    public Bean<?> getBean()\n    {\n        return declaringBean;\n    }\n\n    public Member getMember()\n    {\n        return member;\n    }\n\n    public Set<Annotation> getQualifiers()\n    {\n        return unmodifiableSet(qualifiers);\n    }\n\n    public Type getType()\n    {\n        return type;\n    }\n\n    public boolean isDelegate()\n    {\n        return delegate;\n    }\n\n    public boolean isTransient()\n    {\n        return isTransient;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/InjectableMethod.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport org.apache.deltaspike.core.util.metadata.builder.ParameterValueRedefiner.ParameterValue;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport static org.apache.deltaspike.core.util.BeanUtils.createInjectionPoints;\nimport static org.apache.deltaspike.core.util.ReflectionUtils.invokeMethod;\n\n/**\n * <p>\n * Allows an {@link AnnotatedMethod} to be injected using the CDI type safe\n * resolution rules.\n * </p>\n * <p/>\n * <p>\n * {@link ParameterValueRedefiner} allows the default value to be overridden by\n * the caller of\n * {@link #invoke(Object, CreationalContext, ParameterValueRedefiner)}.\n * </p>\n *\n * @param <X> the declaring type\n */\npublic class InjectableMethod<X>\n{\n    private final AnnotatedMethod<X> method;\n    private final List<InjectionPoint> parameters;\n    private final BeanManager beanManager;\n\n    /**\n     * Instantiate a new {@link InjectableMethod}.\n     *\n     * @param method        the method which will be injected upon a call to\n     *                      {@link #invoke(Object, CreationalContext)}\n     * @param declaringBean the bean which defines the injectable method\n     * @param beanManager   the {@link BeanManager} to use to obtain the parameter values\n     */\n    public InjectableMethod(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager)\n    {\n        this(method, createInjectionPoints(method, declaringBean, beanManager), beanManager);\n    }\n\n    /**\n     * Instantiate a new {@link InjectableMethod}.\n     *\n     * @param method      the method which will be injected upon a call to\n     *                    {@link #invoke(Object, CreationalContext)}\n     * @param parameters  a collection of injection points representing the\n     *                    parameters of the method\n     * @param beanManager the {@link BeanManager} to use to obtain the parameter\n     *                    values\n     */\n    public InjectableMethod(AnnotatedMethod<X> method, Collection<InjectionPoint> parameters, BeanManager beanManager)\n    {\n        this.method = method;\n        this.parameters = new ArrayList<InjectionPoint>(parameters);\n        this.beanManager = beanManager;\n    }\n\n    /**\n     * Get the bean manager used by this injectable method.\n     *\n     * @return the bean manager in use\n     */\n    protected BeanManager getBeanManager()\n    {\n        return beanManager;\n    }\n\n    /**\n     * Get the injectable parameters of this method.\n     *\n     * @return a collection of injection points representing the parameters of\n     *         this method\n     */\n    protected List<InjectionPoint> getParameters()\n    {\n        return parameters;\n    }\n\n    /**\n     * Invoke the method, causing all parameters to be injected according to the\n     * CDI type safe resolution rules.public class ParameterValueRedefiner {\n     * <p/>\n     * }\n     *\n     * @param <T>               the return type of the method\n     * @param receiver          the instance upon which to call the method\n     * @param creationalContext the creational context to use to obtain\n     *                          injectable references for each parameter\n     * @return the result of invoking the method or null if the method's return\n     *         type is void\n     * @throws RuntimeException            if this <code>Method</code> object enforces Java\n     *                                     language access control and the underlying method is\n     *                                     inaccessible or if the underlying method throws an exception or\n     *                                     if the initialization provoked by this method fails.\n     * @throws IllegalArgumentException    if the method is an instance method and\n     *                                     the specified <code>receiver</code> argument is not an instance\n     *                                     of the class or interface declaring the underlying method (or\n     *                                     of a subclass or implementor thereof); if an unwrapping\n     *                                     conversion for primitive arguments fails; or if, after possible\n     *                                     unwrapping, a parameter value cannot be converted to the\n     *                                     corresponding formal parameter type by a method invocation\n     *                                     conversion.\n     * @throws NullPointerException        if the specified <code>receiver</code> is\n     *                                     null and the method is an instance method.\n     * @throws ExceptionInInitializerError if the initialization provoked by this\n     *                                     method fails.\n     */\n    public <T> T invoke(Object receiver, CreationalContext<T> creationalContext)\n        throws IllegalAccessException, IllegalArgumentException\n    {\n        return invoke(receiver, creationalContext, null);\n    }\n\n    /**\n     * Invoke the method, calling the parameter redefiner for each parameter,\n     * allowing the caller to override the default value obtained via the CDI\n     * type safe resolver.\n     *\n     * @param <T>               the return type of the method\n     * @param receiver          the instance upon which to call the method\n     * @param creationalContext the creational context to use to obtain\n     *                          injectable references for each parameter\n     * @return the result of invoking the method or null if the method's return\n     *         type is void\n     * @throws RuntimeException            if this <code>Method</code> object enforces Java\n     *                                     language access control and the underlying method is\n     *                                     inaccessible or if the underlying method throws an exception or\n     *                                     if the initialization provoked by this method fails.\n     * @throws IllegalArgumentException    if the method is an instance method and\n     *                                     the specified <code>receiver</code> argument is not an instance\n     *                                     of the class or interface declaring the underlying method (or\n     *                                     of a subclass or implementor thereof); if an unwrapping\n     *                                     conversion for primitive arguments fails; or if, after possible\n     *                                     unwrapping, a parameter value cannot be converted to the\n     *                                     corresponding formal parameter type by a method invocation\n     *                                     conversion.\n     * @throws NullPointerException        if the specified <code>receiver</code> is\n     *                                     null and the method is an instance method.\n     * @throws ExceptionInInitializerError if the initialization provoked by this\n     *                                     method fails.\n     */\n    public <T> T invoke(Object receiver, CreationalContext<T> creationalContext, ParameterValueRedefiner redefinition)\n        throws IllegalAccessException, IllegalArgumentException\n    {\n        List<Object> parameterValues = new ArrayList<Object>();\n        for (int i = 0; i < getParameters().size(); i++)\n        {\n            if (redefinition != null)\n            {\n                ParameterValue value = new ParameterValue(i, getParameters().get(i), getBeanManager());\n                parameterValues.add(redefinition.redefineParameterValue(value));\n            }\n            else\n            {\n                parameterValues.add(getBeanManager().getInjectableReference(getParameters().get(i), creationalContext));\n            }\n        }\n\n        try\n        {\n            @SuppressWarnings({ \"unchecked\", \"UnnecessaryLocalVariable\" })\n            T result =\n                    (T) invokeMethod(receiver, method.getJavaMember(), Object.class, true, parameterValues.toArray());\n            return result;\n        }\n        catch (RuntimeException e)\n        {\n            //X TODO check if it is compatible with Weld\n            //workaround for OWB which wraps InvocationTargetException the original exception\n            //see ReflectionUtils#invokeMethod\n            if (RuntimeException.class.getName().equals(e.getClass().getName()) &&\n                    e.getCause() instanceof RuntimeException)\n            {\n                throw (RuntimeException) e.getCause();\n            }\n            throw e;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/ParameterValueRedefiner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util.metadata.builder;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\n/**\n * Provides the ability to redefine the value of a parameter on an\n * {@link InjectableMethod} via the\n * {@link #redefineParameterValue(ParameterValue)} callback.\n *\n * @see InjectableMethod\n */\npublic interface ParameterValueRedefiner\n{\n    /**\n     * Callback allowing the default parameter value (that which would be\n     * injected according to the CDI type safe resolution rules) to be\n     * overridden.\n     *\n     * @param value the default value\n     * @return the overridden value\n     */\n    Object redefineParameterValue(ParameterValue value);\n\n    /**\n     * Provides the default parameter's value, along with metadata about the\n     * parameter to a parameter redefinition.\n     *\n     * @see ParameterValueRedefiner\n     * @see InjectableMethod\n     */\n    class ParameterValue\n    {\n\n        private final int position;\n        private final InjectionPoint injectionPoint;\n        private final BeanManager beanManager;\n\n        ParameterValue(int position, InjectionPoint injectionPoint, BeanManager beanManager)\n        {\n            this.position = position;\n            this.injectionPoint = injectionPoint;\n            this.beanManager = beanManager;\n        }\n\n        /**\n         * Get the position of the parameter in the member's parameter list.\n         *\n         * @return the position of the parameter\n         */\n        public int getPosition()\n        {\n            return position;\n        }\n\n        /**\n         * Get the {@link InjectionPoint} for the parameter.\n         *\n         * @return the injection point\n         */\n        public InjectionPoint getInjectionPoint()\n        {\n            return injectionPoint;\n        }\n\n        /**\n         * Get the default value of the parameter. The default value is that which\n         * would be injected according to the CDI type safe resolution rules.\n         *\n         * @param creationalContext the creationalContext to use to obtain the\n         *                          injectable reference.\n         * @return the default value\n         */\n        public Object getDefaultValue(CreationalContext<?> creationalContext)\n        {\n            return beanManager.getInjectableReference(injectionPoint, creationalContext);\n        }\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/core/api/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# DeltaSpike BeanManager provider\norg.apache.deltaspike.core.api.provider.BeanManagerProvider\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/ClassUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport junit.framework.Assert;\nimport org.junit.Test;\n\nimport java.lang.reflect.Method;\nimport java.util.Collection;\nimport java.util.List;\n\npublic class ClassUtilsTest\n{\n    @Test\n    public void shouldNotRetrieveMethodBasedOnSameReturnType() throws Exception\n    {\n        Method m = InnerTwo.class.getMethod(\"getCollection\");\n        Method method = ClassUtils.extractPossiblyGenericMethod(InnerOne.class, m);\n        Assert.assertEquals(InnerOne.class.getMethod(\"getCollection\"), method);\n    }\n\n    @Test\n    public void shouldRetrieveMethodBasedOnCastableType() throws Exception\n    {\n        Method m = InnerThree.class.getMethod(\"getCollection\");\n        Method method = ClassUtils.extractPossiblyGenericMethod(InnerOne.class, m);\n        Assert.assertEquals(InnerOne.class.getMethod(\"getCollection\"), method);\n    }\n\n    private static class InnerOne {\n        public List<Integer> getCollection() {\n            return null;\n        }\n    }\n\n    private static class InnerTwo {\n        public Collection<Integer> getCollection() {\n            return null;\n        }\n    }\n\n    private static class InnerThree {\n        public Object getCollection() {\n            return null;\n        }\n    }\n}"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/ParameterUtilTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.util;\n\nimport org.junit.Assert;\nimport org.junit.Assume;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.reflect.Method;\n\npublic class ParameterUtilTest\n{\n    @Before\n    public void isEnabled()\n    {\n        Assume.assumeTrue(ParameterUtil.isParameterSupported());\n    }\n\n    @Test\n    public void shouldReturnNameOrNull() throws Exception\n    {\n        Method method = getClass().getDeclaredMethod(\"someMethod\", String.class);\n        String parameterName = ParameterUtil.getName(method, 0);\n        Assert.assertTrue(parameterName.equals(\"arg0\") || parameterName.equals(\"firstParameter\"));\n    }\n\n    public void someMethod(String firstParameter) {}\n}"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/PropertyFileUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.util;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.MalformedURLException;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.util.Arrays;\nimport java.util.Enumeration;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Parameterized.class)\npublic class PropertyFileUtilsTest\n{\n    @Parameterized.Parameters\n    public static Iterable<Object[]> cases() throws MalformedURLException\n    {\n        return Arrays.<Object[]>asList(\n                new Object[] // classpath\n                        {\n                            new Case(\"test.properties\")\n                            {\n                                @Override\n                                public void run()\n                                {\n                                    assertTrue(result.hasMoreElements());\n                                    result.nextElement();\n                                    assertFalse(result.hasMoreElements());\n                                }\n                            }\n                        },\n                new Object[] // file path\n                        {\n                                new Case(\"src/test\")\n                                {\n                                    @Override\n                                    public void run()\n                                    {\n                                        assertTrue(result.hasMoreElements());\n                                        result.nextElement();\n                                        assertFalse(result.hasMoreElements());\n                                    }\n                                }\n                        },\n                new Object[] // url\n                        {\n                                new Case(new File(\"src/test/resources/test.properties\").toURI().toURL().toExternalForm())\n                                {\n                                    @Override\n                                    public void run()\n                                    {\n                                        assertTrue(result.hasMoreElements());\n                                        result.nextElement();\n                                        assertFalse(result.hasMoreElements());\n                                    }\n                                }\n                        },\n                new Object[] // url not existent\n                        {\n                                new Case(new File(\"src/test/resources/test_not_existent.properties\").toURI().toURL().toExternalForm())\n                                {\n                                    @Override\n                                    public void run()\n                                    {\n                                        assertFalse(result.hasMoreElements());\n                                    }\n                                }\n                        });\n    }\n\n    private final Case test;\n\n    public PropertyFileUtilsTest(Case test)\n    {\n        this.test = test;\n    }\n\n    @Test\n    public void run() throws IOException, URISyntaxException\n    {\n        test.result = PropertyFileUtils.resolvePropertyFiles(test.file);\n        test.run();\n    }\n\n    private static abstract class Case implements Runnable\n    {\n        private String file;\n        protected Enumeration<URL> result;\n\n        private Case(final String file)\n        {\n            this.file = file;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/PropertyLoaderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.api.config;\n\nimport org.apache.deltaspike.core.api.config.PropertyLoader;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.util.Properties;\n\npublic class PropertyLoaderTest\n{\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n\n    @Test\n    public void testNotExistingPropertyLoading() throws Exception\n    {\n        Assert.assertNull(PropertyLoader.getProperties(\"notexistingProperty\"));\n        Assert.assertNull(PropertyLoader.getProperties(\"notexistingProperty.properties\"));\n    }\n\n    @Test\n    public void testStandardPropertyLoading() throws Exception\n    {\n        checkProperties(\"test\", \"1\");\n        checkProperties(\"test.properties\", \"1\");\n    }\n\n    @Test\n    public void testProjectStagedPropertyLoading() throws Exception\n    {\n        checkProperties(\"test2\", \"2\");\n        checkProperties(\"test2.properties\", \"2\");\n    }\n\n\n    private void checkProperties(String propertyFile, String expectedValue)\n    {\n        Properties p = PropertyLoader.getProperties(propertyFile);\n        Assert.assertNotNull(p);\n        Assert.assertEquals(1, p.size());\n        Assert.assertEquals(expectedValue, p.get(\"test.value\"));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/CustomException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.api.util;\n\nclass CustomException extends Exception\n{\n    private static final long serialVersionUID = 6197126259870336328L;\n\n    CustomException(String message)\n    {\n        super(message);\n    }\n\n    CustomException(String message, Throwable cause)\n    {\n        super(message, cause);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/ExceptionUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.api.util;\n\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class ExceptionUtilsTest\n{\n    private static final String FIELD_DOES_NOT_EXIST = \"field does not exist - custom message\";\n\n    @Test\n    public void changeMessageOfCustomException()\n    {\n        try\n        {\n            ExceptionUtils.changeAndThrowException(\n                    new CustomException(\"old\", new Exception(\"original\")), \"new\");\n        }\n        catch (RuntimeException e)\n        {\n            Assert.fail();\n        }\n        catch (Exception e)\n        {\n            Assert.assertEquals(\"original\", e.getCause().getMessage());\n            Assert.assertEquals(\"new\", e.getMessage());\n            Assert.assertEquals(CustomException.class, e.getClass());\n            return;\n        }\n        Assert.fail();\n    }\n\n    @Test\n    public void changeMessageOfInvalidCustomException()\n    {\n        try\n        {\n            ExceptionUtils.changeAndThrowException(\n                    new IncompatibleCustomException(\"old\", new Exception(\"original\"), 1), \"new\");\n        }\n        catch (RuntimeException e)\n        {\n            Assert.fail();\n        }\n        catch (Exception e)\n        {\n            Assert.assertEquals(\"original\", e.getCause().getMessage());\n            Assert.assertEquals(\"old\", e.getMessage());\n            Assert.assertEquals(IncompatibleCustomException.class, e.getClass());\n            Assert.assertEquals(1, ((IncompatibleCustomException) e).getCustomParameter());\n            return;\n        }\n        Assert.fail();\n    }\n\n    @Test\n    public void rethrowCheckedException()\n    {\n        try\n        {\n            invalidOperation();\n        }\n        catch (NoSuchFieldException e)\n        {\n            Assert.assertEquals(FIELD_DOES_NOT_EXIST, e.getMessage());\n            Assert.assertEquals(null, e.getCause());\n            return;\n        }\n        Assert.fail();\n    }\n\n    @Test\n    public void rethrowUncheckedException()\n    {\n        try\n        {\n            ExceptionUtils.changeAndThrowException(new ClassCastException(), \"custom\");\n        }\n        catch (ClassCastException e)\n        {\n            Assert.assertEquals(\"custom\", e.getMessage());\n            Assert.assertEquals(null, e.getCause());\n            return;\n        }\n        Assert.fail();\n    }\n\n    private void invalidOperation() throws NoSuchFieldException\n    {\n        try\n        {\n            getClass().getDeclaredField(\"virtualField\");\n        }\n        catch (NoSuchFieldException e)\n        {\n            ExceptionUtils.changeAndThrowException(e, FIELD_DOES_NOT_EXIST);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/IncompatibleCustomException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.api.util;\n\nimport java.io.Serializable;\n\nclass IncompatibleCustomException extends Exception\n{\n    private static final long serialVersionUID = 6197126259870336328L;\n    private Serializable customParameter;\n\n    IncompatibleCustomException(String message, Throwable cause, Serializable customParameter)\n    {\n        super(message, cause);\n        this.customParameter = customParameter;\n    }\n\n    Object getCustomParameter()\n    {\n        return customParameter;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/StringUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.api.util;\n\nimport org.apache.deltaspike.core.util.StringUtils;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class StringUtilsTest\n{\n    @Test\n    public void emptyStringDetection()\n    {\n        Assert.assertTrue(StringUtils.isEmpty(null));\n        Assert.assertTrue(StringUtils.isEmpty(\"\"));\n        Assert.assertTrue(StringUtils.isEmpty(\" \"));\n        Assert.assertFalse(StringUtils.isEmpty(\" a \"));\n    }\n\n    @Test\n    public void testRemoveSpecialChars() {\n        Assert.assertNull(StringUtils.removeSpecialChars(null));\n        Assert.assertEquals(\"abc_def\", StringUtils.removeSpecialChars(\"abc def\"));\n        Assert.assertEquals(\"a_c_def\", StringUtils.removeSpecialChars(\"a_c def\")); // not replace _\n        Assert.assertEquals(\"a-c_dex\", StringUtils.removeSpecialChars(\"a-c dex\")); // not replace -\n        Assert.assertEquals(\"a_c_def\", StringUtils.removeSpecialChars(\"a\\'c def\"));\n        Assert.assertEquals(\"A_c_deX\", StringUtils.removeSpecialChars(\"A#c deX\"));\n    }\n}"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/metadata/AnnotationInstanceProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.util.metadata;\n\nimport jakarta.enterprise.inject.literal.NamedLiteral;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.junit.Test;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Named;\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.CoreMatchers.not;\nimport static org.hamcrest.CoreMatchers.notNullValue;\nimport static org.hamcrest.CoreMatchers.sameInstance;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertThat;\nimport static org.junit.Assert.assertTrue;\n\n/**\n *\n */\npublic class AnnotationInstanceProviderTest\n{\n    @Test\n    public void assertBasicCreation()\n    {\n        Annotation a = AnnotationInstanceProvider.of(RequestScoped.class);\n        assertThat(a, is(notNullValue()));\n    }\n\n    @Test\n    public void assertCreationWithMemberValue()\n    {\n        Map<String, String> memberValues = new HashMap<String, String>();\n        memberValues.put(\"value\", \"test\");\n\n        Annotation a = AnnotationInstanceProvider.of(Named.class, memberValues);\n        assertThat(a, is(notNullValue()));\n    }\n\n    @Test\n    public void assertCorrectAnnotationType()\n    {\n        assertThat(AnnotationInstanceProvider.of(RequestScoped.class).annotationType(), is(RequestScoped.class));\n    }\n\n    @Test\n    public void assertAnnotationTypeWorks()\n    {\n        assertEquals(AnnotationInstanceProvider.of(RequestScoped.class).annotationType(), RequestScoped.class);\n    }\n\n    @Test\n    public void assertDifferentInstanceWithDifferentMembers()\n    {\n        Map<String, String> memberValues = new HashMap<String, String>();\n        memberValues.put(\"value\", \"test\");\n\n        Map<String, String> memberValues2 = new HashMap<String, String>();\n        memberValues2.put(\"value\", \"test2\");\n\n        Annotation a1 = AnnotationInstanceProvider.of(Named.class, memberValues);\n        Annotation a2 = AnnotationInstanceProvider.of(Named.class, memberValues2);\n\n        assertFalse(a2 == a1);\n    }\n\n    @Test\n    public void assertSameUsingEquals()\n    {\n        Annotation a1 = AnnotationInstanceProvider.of(RequestScoped.class);\n        Annotation a2 = AnnotationInstanceProvider.of(RequestScoped.class);\n\n        assertTrue(a2.equals(a1));\n    }\n\n    @Test\n    public void assertDifferentInstanceWithMembersUsingEquals()\n    {\n        Map<String, String> memberValues = new HashMap<String, String>();\n        memberValues.put(\"value\", \"test\");\n\n        Annotation a1 = AnnotationInstanceProvider.of(Named.class, memberValues);\n        Annotation a2 = AnnotationInstanceProvider.of(Named.class);\n\n        assertThat(a2, not(sameInstance(a1)));\n        assertFalse(a2.equals(a1));\n    }\n\n    @Test\n    public void assertMemberAccessIsCorrect()\n    {\n        Map<String, String> memberValues = new HashMap<String, String>();\n        memberValues.put(\"value\", \"test\");\n\n        Named a1 = AnnotationInstanceProvider.of(Named.class, memberValues);\n\n        assertThat(a1.value(), is(\"test\"));\n    }\n\n    @Test\n    public void assertBasicHashCode()\n    {\n        assertThat(AnnotationInstanceProvider.of(RequestScoped.class).hashCode(), is(0));\n    }\n\n    @Test\n    public void assertSimpleMemberHashCode()\n    {\n        Map<String, String> memberValues = new HashMap<String, String>();\n        memberValues.put(\"value\", \"test\");\n        assertThat(AnnotationInstanceProvider.of(Named.class, memberValues).hashCode(), is(not(0)));\n    }\n\n    @Test\n    public void assertBasicToString()\n    {\n        assertThat(AnnotationInstanceProvider.of(RequestScoped.class).toString(), is(\"@jakarta.enterprise.context.RequestScoped()\"));\n    }\n\n    @Test\n    public void assertComplexCreation()\n    {\n        Map<String, Object> memberValues = new HashMap<String, Object>();\n        memberValues.put(\"booleanValue\", false);\n        memberValues.put(\"booleanValues\", new boolean[]{false});\n        memberValues.put(\"byteValue\", (byte) 0);\n        memberValues.put(\"byteValues\", new byte[]{(byte) 0});\n        memberValues.put(\"charValue\", (char) 0);\n        memberValues.put(\"charValues\", new char[]{(char) 0});\n        memberValues.put(\"doubleValue\", 0.0);\n        memberValues.put(\"doubleValues\", new double[]{0.0});\n        memberValues.put(\"floatValue\", (float) 0);\n        memberValues.put(\"floatValues\", new float[]{(float) 0});\n        memberValues.put(\"intValue\", 0);\n        memberValues.put(\"intValues\", new int[]{0});\n        memberValues.put(\"longValue\", 0L);\n        memberValues.put(\"longValues\", new long[]{0L});\n        memberValues.put(\"shortValue\", 0);\n        memberValues.put(\"shortValues\", new int[]{0});\n        memberValues.put(\"stooge\", Stooge.SHEMP);\n        memberValues.put(\"stooges\", new Stooge[]{Stooge.MOE, Stooge.LARRY, Stooge.CURLY});\n        memberValues.put(\"string\", \"\");\n        memberValues.put(\"strings\", new String[]{\"\"});\n        memberValues.put(\"type\", Object.class);\n        memberValues.put(\"types\", new Class[]{Object.class});\n        memberValues.put(\"nest\", AnnotationInstanceProvider.of(NestAnnotation.class, Collections.unmodifiableMap(memberValues)));\n\n        assertThat(AnnotationInstanceProvider.of(TestAnnotation.class, memberValues), is(notNullValue()));\n    }\n\n    @Test\n    public void assertComplexHashCode()\n    {\n        Map<String, Object> memberValues = new HashMap<String, Object>();\n        memberValues.put(\"booleanValue\", false);\n        memberValues.put(\"booleanValues\", new boolean[]{false});\n        memberValues.put(\"byteValue\", (byte) 0);\n        memberValues.put(\"byteValues\", new byte[]{(byte) 0});\n        memberValues.put(\"charValue\", (char) 0);\n        memberValues.put(\"charValues\", new char[]{(char) 0});\n        memberValues.put(\"doubleValue\", 0.0);\n        memberValues.put(\"doubleValues\", new double[]{0.0});\n        memberValues.put(\"floatValue\", (float) 0);\n        memberValues.put(\"floatValues\", new float[]{(float) 0});\n        memberValues.put(\"intValue\", 0);\n        memberValues.put(\"intValues\", new int[]{0});\n        memberValues.put(\"longValue\", 0L);\n        memberValues.put(\"longValues\", new long[]{0L});\n        memberValues.put(\"shortValue\", (short) 0);\n        memberValues.put(\"shortValues\", new short[]{(short) 0});\n        memberValues.put(\"stooge\", Stooge.SHEMP);\n        memberValues.put(\"stooges\", new Stooge[]{Stooge.MOE, Stooge.LARRY, Stooge.CURLY});\n        memberValues.put(\"string\", \"\");\n        memberValues.put(\"strings\", new String[]{\"\"});\n        memberValues.put(\"type\", Object.class);\n        memberValues.put(\"types\", new Class[]{Object.class});\n\n        Map<String, Object> nestMemberValues = new HashMap<String, Object>(memberValues);\n        memberValues.put(\"nest\", AnnotationInstanceProvider.of(NestAnnotation.class, nestMemberValues));\n        memberValues.put(\"nests\", new NestAnnotation[]{AnnotationInstanceProvider.of(NestAnnotation.class, nestMemberValues)});\n\n        assertThat(AnnotationInstanceProvider.of(TestAnnotation.class, memberValues).hashCode(), is(not(0)));\n    }\n\n    @Test\n    public void assertComplexToString()\n    {\n        Map<String, Object> memberValues = new HashMap<String, Object>();\n        memberValues.put(\"booleanValue\", false);\n        memberValues.put(\"booleanValues\", new boolean[]{false});\n        memberValues.put(\"byteValue\", (byte) 0);\n        memberValues.put(\"byteValues\", new byte[]{(byte) 0});\n        memberValues.put(\"charValue\", (char) 0);\n        memberValues.put(\"charValues\", new char[]{(char) 0});\n        memberValues.put(\"doubleValue\", 0.0);\n        memberValues.put(\"doubleValues\", new double[]{0.0});\n        memberValues.put(\"floatValue\", (float) 0);\n        memberValues.put(\"floatValues\", new float[]{(float) 0});\n        memberValues.put(\"intValue\", 0);\n        memberValues.put(\"intValues\", new int[] { 0 } );\n        memberValues.put(\"longValue\", 0L);\n        memberValues.put(\"longValues\", new long[] { 0L } ) ;\n        memberValues.put(\"shortValue\", (short) 0);\n        memberValues.put(\"shortValues\", new short[] { (short) 0 } );\n        memberValues.put(\"stooge\", Stooge.SHEMP);\n        memberValues.put(\"stooges\", new Stooge[] { Stooge.MOE, Stooge.LARRY, Stooge.CURLY } );\n        memberValues.put(\"string\", \"\");\n        memberValues.put(\"strings\", new String[] { \"\" } );\n        memberValues.put(\"type\", Object.class);\n        memberValues.put(\"types\", new Class[]{Object.class});\n\n        Map<String, Object> nestMemberValues = new HashMap<String, Object>(memberValues);\n        memberValues.put(\"nest\", AnnotationInstanceProvider.of(NestAnnotation.class, nestMemberValues));\n        memberValues.put(\"nests\", new NestAnnotation[] { AnnotationInstanceProvider.of(NestAnnotation.class,\n                nestMemberValues) } );\n\n        TestAnnotation testAnnotation = AnnotationInstanceProvider.of(TestAnnotation.class, memberValues);\n        String testAnnotationToString = testAnnotation.toString();\n\n        assertTrue(testAnnotationToString.startsWith(\"@org.apache.deltaspike.test.api.util.metadata.TestAnnotation(\"));\n        //assertTrue(testAnnotationToString.contains(\"type=class java.lang.Object,booleanValue=false,byteValue=0\"));\n        // Order depends on the JVM (Sun, Oracle JRockit, ...)\n        for (String key : memberValues.keySet()) {\n            assertTrue(testAnnotationToString.contains(key+\"=\"));\n        }\n\n        assertTrue(testAnnotationToString.contains(\"type=class java.lang.Object\"));\n        assertTrue(testAnnotationToString.contains(\"booleanValue=false\"));\n        assertTrue(testAnnotationToString.contains(\"byteValue=0\"));\n        // End changed test\n        assertTrue(testAnnotationToString.contains(\"nest=@org.apache.deltaspike.test.api.util.metadata.NestAnnotation\"));\n        assertTrue(testAnnotationToString.endsWith(\")\"));\n    }\n\n    @Test\n    public void assertDifferentAnnotationsNotEqual()\n    {\n        RequestScoped annotation1 = AnnotationInstanceProvider.of(RequestScoped.class);\n        Named annotation2 = AnnotationInstanceProvider.of(Named.class);\n\n        assertFalse(annotation1.equals(annotation2));\n        assertFalse(annotation2.equals(annotation1));\n    }\n\n    @Test\n    public void assertCreatedAnnotationEqualToLiteral()\n    {\n        Map<String, String> memberValue = new HashMap<String, String>();\n        memberValue.put(\"value\", \"test\");\n\n        Named named1 = AnnotationInstanceProvider.of(Named.class, memberValue);\n        Named named2 = NamedLiteral.of(\"test\");\n\n        assertTrue(named2.equals(named1));\n        assertTrue(named1.equals(named2));\n    }\n\n    @Test\n    public void assertCreatedAnnotationNotEqualToLiteralWithDifferentMemberValues()\n    {\n        Map<String, String> memberValue = new HashMap<String, String>();\n        memberValue.put(\"value\", \"test1\");\n\n        Named named1 = AnnotationInstanceProvider.of(Named.class, memberValue);\n        Named named2 = NamedLiteral.of(\"test\");\n\n        assertFalse(named1.equals(named2));\n    }\n\n    @Test\n    public void assertNotEqualToOtherObjects()\n    {\n        assertFalse(AnnotationInstanceProvider.of(Named.class).equals(\"\"));\n    }\n\n    @Test\n    public void assertHashCodeSameAsLiteral()\n    {\n        Named a1 = AnnotationInstanceProvider.of(Named.class);\n        Named a2 = NamedLiteral.INSTANCE;\n\n        assertThat(a2.hashCode(), is(a1.hashCode()));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/metadata/NestAnnotation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.util.metadata;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n/**\n * Pulled from Apache Commons Lang 3.\n */\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface NestAnnotation\n{\n    String string();\n\n    String[] strings();\n\n    Class<?> type();\n\n    Class<?>[] types();\n\n    byte byteValue();\n\n    byte[] byteValues();\n\n    short shortValue();\n\n    short[] shortValues();\n\n    int intValue();\n\n    int[] intValues();\n\n    char charValue();\n\n    char[] charValues();\n\n    long longValue();\n\n    long[] longValues();\n\n    float floatValue();\n\n    float[] floatValues();\n\n    double doubleValue();\n\n    double[] doubleValues();\n\n    boolean booleanValue();\n\n    boolean[] booleanValues();\n\n    Stooge stooge();\n\n    Stooge[] stooges();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/metadata/Stooge.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.util.metadata;\n\n/**\n * Pulled from Apache Commons Lang 3.\n */\npublic enum Stooge\n{\n    MOE, LARRY, CURLY, JOE, SHEMP\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/util/metadata/TestAnnotation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.api.util.metadata;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Pulled from Apache Commons Lang 3.\n */\n@Target(ElementType.FIELD)\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface TestAnnotation\n{\n    String string();\n\n    String[] strings();\n\n    Class<?> type();\n\n    Class<?>[] types();\n\n    byte byteValue();\n\n    byte[] byteValues();\n\n    short shortValue();\n\n    short[] shortValues();\n\n    int intValue();\n\n    int[] intValues();\n\n    char charValue();\n\n    char[] charValues();\n\n    long longValue();\n\n    long[] longValues();\n\n    float floatValue();\n\n    float[] floatValues();\n\n    double doubleValue();\n\n    double[] doubleValues();\n\n    boolean booleanValue();\n\n    boolean[] booleanValues();\n\n    Stooge stooge();\n\n    Stooge[] stooges();\n\n    NestAnnotation nest();\n\n    NestAnnotation[] nests();\n}\n"
  },
  {
    "path": "deltaspike/core/api/src/test/resources/test.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\ntest.value=1"
  },
  {
    "path": "deltaspike/core/api/src/test/resources/test2-UnitTest.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\ndeltaspike_ordinal=120\n\ntest.value=2"
  },
  {
    "path": "deltaspike/core/api/src/test/resources/test2.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\ntest.value=1"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/DefaultExceptionEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandlingFlow;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionStackEvent;\nimport org.apache.deltaspike.core.spi.exception.control.event.IntrospectiveExceptionEvent;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n/**\n * Payload for an exception to be handled.  This object is not immutable as small pieces of the state may be set by the\n * handler.\n *\n * @param <T> Exception type this event represents\n */\n@Vetoed\npublic class DefaultExceptionEvent<T extends Throwable> implements IntrospectiveExceptionEvent<T>\n{\n    private final T exception;\n    private boolean unmute;\n    private ExceptionHandlingFlow flow;\n    private Throwable throwNewException;\n    private final boolean beforeTraversal;\n    private final boolean markedHandled;\n\n\n    /**\n     * Initial state constructor.\n     *\n     * @param stackEvent           Information about the current exception and cause chain.\n     * @param beforeTraversal flag indicating the direction of the cause chain traversal\n     * @param handled         flag indicating the exception has already been handled by a previous handler\n     * @throws IllegalArgumentException if stackEvent is null\n     */\n    public DefaultExceptionEvent(final ExceptionStackEvent stackEvent, final boolean beforeTraversal,\n                                 final boolean handled)\n    {\n        if (stackEvent == null)\n        {\n            throw new IllegalArgumentException(\"null is not valid for stackEvent\");\n        }\n\n        exception = (T) stackEvent.getCurrent();\n        this.beforeTraversal = beforeTraversal;\n        markedHandled = handled;\n        flow = ExceptionHandlingFlow.HANDLED_AND_CONTINUE;\n    }\n\n    @Override\n    public T getException()\n    {\n        return exception;\n    }\n\n    @Override\n    public void abort()\n    {\n        flow = ExceptionHandlingFlow.ABORT;\n    }\n\n    @Override\n    public void throwOriginal()\n    {\n        flow = ExceptionHandlingFlow.THROW_ORIGINAL;\n    }\n\n    @Override\n    public void handled()\n    {\n        flow = ExceptionHandlingFlow.HANDLED;\n    }\n\n    @Override\n    public void handledAndContinue()\n    {\n        flow = ExceptionHandlingFlow.HANDLED_AND_CONTINUE;\n    }\n\n    @Override\n    public void skipCause()\n    {\n        flow = ExceptionHandlingFlow.SKIP_CAUSE;\n    }\n\n    @Override\n    public void unmute()\n    {\n        unmute = true;\n    }\n\n    @Override\n    public boolean isUnmute()\n    {\n        return unmute;\n    }\n\n    /* Later\n    public ExceptionStackEvent getExceptionStack() {\n    }\n    */\n\n    @Override\n    public ExceptionHandlingFlow getCurrentExceptionHandlingFlow()\n    {\n        return flow;\n    }\n\n    @Override\n    public boolean isMarkedHandled()\n    {\n        return markedHandled;\n    }\n\n    @Override\n    public boolean isBeforeTraversal()\n    {\n        return beforeTraversal;\n    }\n\n    @Override\n    public void rethrow(Throwable t)\n    {\n        throwNewException = t;\n        flow = ExceptionHandlingFlow.THROW;\n    }\n\n    @Override\n    public Throwable getThrowNewException()\n    {\n        return throwNewException;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/ExceptionHandlerBroadcaster.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionStackEvent;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\n\n/**\n * Observer of {@link org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent} events and handler\n * dispatcher. All handlers are invoked from this class. This class is immutable.\n */\n@ApplicationScoped\npublic class ExceptionHandlerBroadcaster\n{\n    private static final Logger LOG = Logger.getLogger(ExceptionHandlerBroadcaster.class.getName());\n\n    /**\n     * Observes the event, finds the correct exception handler(s) and invokes them.\n     * \n     * @param exceptionEventEvent\n     *            exception to be invoked\n     * @param beanManager\n     *            active bean manager\n     * @throws Throwable\n     *             If a handler requests the exception to be re-thrown.\n     */\n    public void executeHandlers(@Observes @Any ExceptionToCatchEvent exceptionEventEvent,\n            final BeanManager beanManager) throws Throwable\n    {\n        LOG.entering(\n                ExceptionHandlerBroadcaster.class.getName(), \"executeHandlers\", exceptionEventEvent.getException());\n\n        CreationalContext<Object> creationalContext = null;\n\n        Throwable throwException = null;\n\n        final HandlerMethodStorage handlerMethodStorage =\n                BeanProvider.getContextualReference(HandlerMethodStorage.class);\n\n        try\n        {\n            creationalContext = beanManager.createCreationalContext(null);\n\n            final Set<HandlerMethod<?>> processedHandlers = new HashSet<HandlerMethod<?>>();\n\n            final ExceptionStackEvent stack = new ExceptionStackEvent(exceptionEventEvent.getException());\n\n            beanManager.fireEvent(stack); // Allow for modifying the exception stack\n\n        // indentation with 8 for label needed by the current checkstyle rules\n        inbound_cause:\n            while (stack.getCurrent() != null)\n            {\n                final List<HandlerMethod<?>> callbackExceptionEvent = new ArrayList<HandlerMethod<?>>(\n                        handlerMethodStorage.getHandlersForException(stack.getCurrent().getClass(),\n                                beanManager, exceptionEventEvent.getQualifiers(), true));\n\n                for (HandlerMethod<?> handler : callbackExceptionEvent)\n                {\n                    if (!processedHandlers.contains(handler))\n                    {\n                        LOG.fine(String.format(\"Notifying handler %s\", handler));\n\n                        @SuppressWarnings(\"rawtypes\")\n                        final DefaultExceptionEvent callbackEvent = new DefaultExceptionEvent(stack, true,\n                                exceptionEventEvent.isHandled());\n\n                        handler.notify(callbackEvent, beanManager);\n\n                        LOG.fine(String.format(\"Handler %s returned status %s\", handler,\n                                callbackEvent.getCurrentExceptionHandlingFlow().name()));\n\n                        if (!callbackEvent.isUnmute())\n                        {\n                            processedHandlers.add(handler);\n                        }\n\n                        switch (callbackEvent.getCurrentExceptionHandlingFlow())\n                        {\n                            case HANDLED:\n                                exceptionEventEvent.setHandled(true);\n                                return;\n                            case HANDLED_AND_CONTINUE:\n                                exceptionEventEvent.setHandled(true);\n                                break;\n                            case ABORT:\n                                return;\n                            case SKIP_CAUSE:\n                                exceptionEventEvent.setHandled(true);\n                                stack.skipCause();\n                                continue inbound_cause;\n                            case THROW_ORIGINAL:\n                                throw exceptionEventEvent.getException();\n                            case THROW:\n                                throw callbackEvent.getThrowNewException();\n                            default:\n                                throw new IllegalStateException(\n                                        \"Unexpected enum type \" + callbackEvent.getCurrentExceptionHandlingFlow());\n                        }\n                    }\n                }\n\n                final Collection<HandlerMethod<? extends Throwable>> handlersForException =\n                        handlerMethodStorage.getHandlersForException(stack.getCurrent().getClass(),\n                                beanManager, exceptionEventEvent.getQualifiers(), false);\n\n                final List<HandlerMethod<? extends Throwable>> handlerMethods =\n                        new ArrayList<HandlerMethod<? extends Throwable>>(handlersForException);\n\n                // Reverse these so category handlers are last\n                Collections.reverse(handlerMethods);\n\n                for (HandlerMethod<?> handler : handlerMethods)\n                {\n                    if (!processedHandlers.contains(handler))\n                    {\n                        LOG.fine(String.format(\"Notifying handler %s\", handler));\n\n                        @SuppressWarnings(\"rawtypes\")\n                        final DefaultExceptionEvent depthFirstEvent = new DefaultExceptionEvent(stack, false,\n                                exceptionEventEvent.isHandled());\n                        handler.notify(depthFirstEvent, beanManager);\n\n                        LOG.fine(String.format(\"Handler %s returned status %s\", handler,\n                                depthFirstEvent.getCurrentExceptionHandlingFlow().name()));\n\n                        if (!depthFirstEvent.isUnmute())\n                        {\n                            processedHandlers.add(handler);\n                        }\n\n                        switch (depthFirstEvent.getCurrentExceptionHandlingFlow())\n                        {\n                            case HANDLED:\n                                exceptionEventEvent.setHandled(true);\n                                return;\n                            case HANDLED_AND_CONTINUE:\n                                exceptionEventEvent.setHandled(true);\n                                break;\n                            case ABORT:\n                                return;\n                            case SKIP_CAUSE:\n                                exceptionEventEvent.setHandled(true);\n                                stack.skipCause();\n                                continue inbound_cause;\n                            case THROW_ORIGINAL:\n                                throwException = exceptionEventEvent.getException();\n                                break;\n                            case THROW:\n                                throwException = depthFirstEvent.getThrowNewException();\n                                break;\n                            default:\n                                throw new IllegalStateException(\n                                        \"Unexpected enum type \" + depthFirstEvent.getCurrentExceptionHandlingFlow());\n                        }\n                    }\n                }\n                stack.skipCause();\n            }\n\n            if (!exceptionEventEvent.isHandled() && throwException == null && !exceptionEventEvent.isOptional())\n            {\n                LOG.warning(String.format(\"No handlers found for exception %s\", exceptionEventEvent.getException()));\n                throw exceptionEventEvent.getException();\n            }\n\n            if (throwException != null)\n            {\n                throw throwException;\n            }\n        }\n        finally\n        {\n            if (creationalContext != null)\n            {\n                creationalContext.release();\n            }\n            LOG.exiting(ExceptionHandlerBroadcaster.class.getName(), \"executeHandlers\",\n                    exceptionEventEvent.getException());\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/ExceptionHandlerComparator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\nimport org.apache.deltaspike.core.api.literal.AnyLiteral;\nimport org.apache.deltaspike.core.util.HierarchyDiscovery;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.Set;\n\n/**\n * Comparator to sort exception handlers according qualifier\n * ({@link org.apache.deltaspike.core.api.exception.control.BeforeHandles} first), ordinal\n * (highest to lowest) and finally hierarchy (least to most specific).\n */\n@SuppressWarnings({ \"MethodWithMoreThanThreeNegations\" })\n@Vetoed\npublic final class ExceptionHandlerComparator implements Comparator<HandlerMethod<?>>\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public int compare(HandlerMethod<?> lhs, HandlerMethod<?> rhs)\n    {\n        if (lhs.equals(rhs))\n        {\n            return 0;\n        }\n\n        // Really this is so all handlers are returned in the TreeSet (even if they're of the same type, but one is\n        // before, the other is not\n\n        // Make sure both handlers are handling the same type, and also have the same qualifiers, if both of those are\n        // true, then precedence comes into play\n        if (lhs.getExceptionType().equals(rhs.getExceptionType()) && lhs.getQualifiers().equals(rhs.getQualifiers()))\n        {\n            final int precedenceReturnValue = comparePrecedence(lhs.getOrdinal(), rhs.getOrdinal(),\n                    lhs.isBeforeHandler());\n\n            // We really shouldn't be running into this case where everything is the same up until now,\n            // but just in case, return both so both handlers are run.\n            if (precedenceReturnValue == 0)\n            {\n                return -1;\n            }\n\n            // Precedence is different\n            return precedenceReturnValue;\n        }\n        else\n        {\n            // Different qualifiers\n            if (lhs.getExceptionType().equals(rhs.getExceptionType())\n                    && !lhs.getQualifiers().equals(rhs.getQualifiers()))\n            {\n                if (lhs.getQualifiers().contains(new AnyLiteral()))\n                {\n                    return -1; // Make sure @Any is first, as it's less specific\n                }\n                return 1;\n            }\n            return compareHierarchies(lhs.getExceptionType(), rhs.getExceptionType());\n        }\n\n        // Currently we're only looking at one type of traversal mode, if this changes, we'll need\n        // to re-add lines to check for this.\n    }\n\n    private int compareHierarchies(Type lhsExceptionType, Type rhsExceptionType)\n    {\n        HierarchyDiscovery lhsHierarchy = new HierarchyDiscovery(lhsExceptionType);\n        Set<Type> lhsTypeclosure = lhsHierarchy.getTypeClosure();\n\n        if (lhsTypeclosure.contains(rhsExceptionType))\n        {\n            final int indexOfLhsType = new ArrayList<Type>(lhsTypeclosure).indexOf(lhsExceptionType);\n            final int indexOfRhsType = new ArrayList<Type>(lhsTypeclosure).indexOf(rhsExceptionType);\n\n            if (indexOfLhsType > indexOfRhsType)\n            {\n                return 1;\n            }\n        }\n        return -1;\n    }\n\n    private int comparePrecedence(final int lhs, final int rhs, final boolean isLhsBefore)\n    {\n        if (!isLhsBefore)\n        {\n            return (lhs - rhs);\n        }\n        else\n        {\n            return (lhs - rhs) * -1;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/HandlerMethodImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\nimport org.apache.deltaspike.core.api.literal.AnyLiteral;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.BeanUtils;\nimport org.apache.deltaspike.core.util.metadata.builder.ImmutableInjectionPoint;\nimport org.apache.deltaspike.core.util.metadata.builder.InjectableMethod;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Implementation of {@link HandlerMethod}.\n *\n * @param <T> Type of the exception this handler handles.\n */\n@Vetoed\npublic class HandlerMethodImpl<T extends Throwable> implements HandlerMethod<T>\n{\n    private final Class declaringBeanClass;\n    private final Bean<?> declaringBean;\n    private final Set<Annotation> qualifiers;\n    private final Type exceptionType;\n    private final AnnotatedMethod<?> handler;\n    private final boolean before;\n    private final int ordinal;\n    private final Method javaMethod;\n    private final AnnotatedParameter<?> handlerParameter;\n    private Set<InjectionPoint> injectionPoints;\n\n    /**\n     * Sole Constructor.\n     *\n     * @param method found handler\n     * @param bm     active BeanManager\n     * @throws IllegalArgumentException if method is null, has no params or first param is not annotated with\n     *                                  {@link Handles} or {@link BeforeHandles}\n     */\n    public HandlerMethodImpl(final Bean<?> handlerDeclaringBean, final AnnotatedMethod<?> method, final BeanManager bm)\n    {\n        //validation is done by the extension\n\n        final Set<Annotation> tmpQualifiers = new HashSet<Annotation>();\n\n        declaringBean = handlerDeclaringBean;\n        handler = method;\n        javaMethod = method.getJavaMember();\n\n        handlerParameter = findHandlerParameter(method);\n\n        if (!handlerParameter.isAnnotationPresent(Handles.class)\n                && !handlerParameter.isAnnotationPresent(BeforeHandles.class))\n        {\n            throw new IllegalArgumentException(\"Method is not annotated with @Handles or @BeforeHandles\");\n        }\n\n        before = handlerParameter.getAnnotation(BeforeHandles.class) != null;\n\n        if (before)\n        {\n            ordinal = handlerParameter.getAnnotation(BeforeHandles.class).ordinal();\n        }\n        else\n        {\n            ordinal = handlerParameter.getAnnotation(Handles.class).ordinal();\n        }\n\n        tmpQualifiers.addAll(BeanUtils.getQualifiers(bm, handlerParameter.getAnnotations()));\n\n        if (tmpQualifiers.isEmpty())\n        {\n            tmpQualifiers.add(new AnyLiteral());\n        }\n\n        qualifiers = tmpQualifiers;\n        declaringBeanClass = method.getJavaMember().getDeclaringClass();\n        exceptionType = ((ParameterizedType) handlerParameter.getBaseType()).getActualTypeArguments()[0];\n    }\n\n    /**\n     * Determines if the given method is a handler by looking for the {@link Handles} annotation on a parameter.\n     *\n     * @param method method to search\n     * @return true if {@link Handles} is found, false otherwise\n     */\n    public static boolean isHandler(final AnnotatedMethod<?> method)\n    {\n        if (method == null)\n        {\n            throw new IllegalArgumentException(\"Method must not be null\");\n        }\n\n        for (AnnotatedParameter<?> param : method.getParameters())\n        {\n            if (param.isAnnotationPresent(Handles.class) || param.isAnnotationPresent(BeforeHandles.class))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    public static AnnotatedParameter<?> findHandlerParameter(final AnnotatedMethod<?> method)\n    {\n        if (!isHandler(method))\n        {\n            throw new IllegalArgumentException(\"Method is not a valid handler\");\n        }\n\n        AnnotatedParameter<?> returnParam = null;\n\n        for (AnnotatedParameter<?> param : method.getParameters())\n        {\n            if (param.isAnnotationPresent(Handles.class) || param.isAnnotationPresent(BeforeHandles.class))\n            {\n                returnParam = param;\n                break;\n            }\n        }\n\n        return returnParam;\n    }\n\n    public Bean<?> getDeclaringBean()\n    {\n        return declaringBean;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Set<Annotation> getQualifiers()\n    {\n        return Collections.unmodifiableSet(qualifiers);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Type getExceptionType()\n    {\n        return exceptionType;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public void notify(final ExceptionEvent<T> event, BeanManager beanManager) throws Exception\n    {\n        CreationalContext<?> ctx = null;\n        try\n        {\n            ctx = beanManager.createCreationalContext(null);\n            @SuppressWarnings(\"unchecked\")\n            Object handlerInstance = BeanProvider.getContextualReference(declaringBeanClass);\n            InjectableMethod<?> im = createInjectableMethod(handler, getDeclaringBean(), beanManager);\n            im.invoke(handlerInstance, ctx, new OutboundParameterValueRedefiner(event, this));\n        }\n        finally\n        {\n            if (ctx != null)\n            {\n                ctx.release();\n            }\n        }\n    }\n\n    private <X> InjectableMethod<X> createInjectableMethod(AnnotatedMethod<X> handlerMethod, Bean<?> bean,\n                                                           BeanManager bm)\n    {\n        return new InjectableMethod<X>(handlerMethod, bean, bm);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public boolean isBeforeHandler()\n    {\n        return before;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public int getOrdinal()\n    {\n        return ordinal;\n    }\n\n    public AnnotatedParameter<?> getHandlerParameter()\n    {\n        return handlerParameter;\n    }\n\n    public Method getJavaMethod()\n    {\n        return handler.getJavaMember();\n    }\n\n    /**\n     * Obtain all the injection points for the handler\n     *\n     * @param bm a BeanManager to use to obtain the beans\n     */\n    public Set<InjectionPoint> getInjectionPoints(final BeanManager bm)\n    {\n        if (injectionPoints == null)\n        {\n            injectionPoints = new HashSet<InjectionPoint>(handler.getParameters().size() - 1);\n\n            for (AnnotatedParameter<?> param : handler.getParameters())\n            {\n                if (!param.equals(handlerParameter))\n                {\n                    injectionPoints.add(\n                            new ImmutableInjectionPoint(param, bm, getDeclaringBean(), false, false));\n                }\n            }\n\n        }\n        return new HashSet<InjectionPoint>(injectionPoints);\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || !HandlerMethod.class.isAssignableFrom(o.getClass()))\n        {\n            return false;\n        }\n\n        HandlerMethod<?> that = (HandlerMethod<?>) o;\n\n        if (!qualifiers.equals(that.getQualifiers()))\n        {\n            return false;\n        }\n\n        if (isBeforeHandler() != that.isBeforeHandler())\n        {\n            return false;\n        }\n        //noinspection SimplifiableIfStatement\n        if (!exceptionType.equals(that.getExceptionType()))\n        {\n            return false;\n        }\n        return ordinal == that.getOrdinal();\n\n    }\n\n    @Override\n    public int hashCode()\n    {\n        int result = declaringBeanClass.hashCode();\n        result = 5 * result + qualifiers.hashCode();\n        result = 5 * result + exceptionType.hashCode();\n        result = 5 * result + ordinal;\n        result = 5 * result + javaMethod.hashCode();\n        result = 5 * result + handlerParameter.hashCode();\n        return result;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"{Qualifiers: \" + qualifiers + \", \" + \"Handles Type: \" + exceptionType + \", \" + \"Before: \" +\n                before + \", \" + \"Precedence: \" + ordinal + \", Method: \" + handler.getJavaMember().getName() + \"}\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/HandlerMethodStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Collection;\nimport java.util.Set;\n\n/**\n * Injectable storage to support programmatic registration and lookup of\n * {@link org.apache.deltaspike.core.api.exception.control.HandlerMethod} instances.\n */\n//X TODO move it to the spi package - otherwise there is no need for an interface\npublic interface HandlerMethodStorage\n{\n    /**\n     * Registers the given handlerMethod to the storage.\n     *\n     * @param handlerMethod HandlerMethod implementation to register with the storage\n     */\n    <T extends Throwable> void registerHandlerMethod(HandlerMethod<T> handlerMethod);\n\n    /**\n     * Obtains the applicable handlers for the given type or super type of the given type to order the handlers.\n     *\n     * @param exceptionClass    Type of exception to narrow handler list\n     * @param bm                active BeanManager\n     * @param handlerQualifiers additional handlerQualifiers to limit handlers\n     * @param isBefore          traversal limiter\n     * @return An order collection of handlers for the given type.\n     */\n    Collection<HandlerMethod<? extends Throwable>> getHandlersForException(Type exceptionClass, BeanManager bm,\n                                                                           Set<Annotation> handlerQualifiers,\n                                                                           boolean isBefore);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/HandlerMethodStorageImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\nimport org.apache.deltaspike.core.api.literal.AnyLiteral;\nimport org.apache.deltaspike.core.util.HierarchyDiscovery;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.TreeSet;\nimport java.util.logging.Logger;\n\n/**\n * Basic implementation for {@link HandlerMethodStorage}.\n */\n@SuppressWarnings(\"CdiManagedBeanInconsistencyInspection\")\n@Vetoed\nclass HandlerMethodStorageImpl implements HandlerMethodStorage\n{\n    private final Map<Type, Collection<HandlerMethod<? extends Throwable>>> allHandlers;\n\n    private Logger log = Logger.getLogger(HandlerMethodStorageImpl.class.getName());\n\n    HandlerMethodStorageImpl(Map<Type, Collection<HandlerMethod<? extends Throwable>>> allHandlers)\n    {\n        this.allHandlers = allHandlers;\n    }\n\n    @Override\n    public <T extends Throwable> void registerHandlerMethod(HandlerMethod<T> handlerMethod)\n    {\n        log.fine(String.format(\"Adding handler %s to known handlers\", handlerMethod));\n        if (allHandlers.containsKey(handlerMethod.getExceptionType()))\n        {\n            allHandlers.get(handlerMethod.getExceptionType()).add(handlerMethod);\n        }\n        else\n        {\n            allHandlers.put(handlerMethod.getExceptionType(),\n                    new HashSet<HandlerMethod<? extends Throwable>>(Collections.singleton(handlerMethod)));\n        }\n    }\n\n    @Override\n    public Collection<HandlerMethod<? extends Throwable>> getHandlersForException(Type exceptionClass,\n                                                                                  BeanManager bm,\n                                                                                  Set<Annotation> handlerQualifiers,\n                                                                                  boolean isBefore)\n    {\n        final Collection<HandlerMethod<? extends Throwable>> returningHandlers =\n                new TreeSet<HandlerMethod<? extends Throwable>>(new ExceptionHandlerComparator());\n        final HierarchyDiscovery h = new HierarchyDiscovery(exceptionClass);\n        final Set<Type> closure = h.getTypeClosure();\n\n        for (Type hierarchyType : closure)\n        {\n            if (allHandlers.get(hierarchyType) != null)\n            {\n                for (HandlerMethod<?> handler : allHandlers.get(hierarchyType))\n                {\n                    if (handler.isBeforeHandler() && isBefore)\n                    {\n                        if (handler.getQualifiers().contains(new AnyLiteral()))\n                        {\n                            returningHandlers.add(handler);\n                        }\n                        else\n                        {\n                            if (!handlerQualifiers.isEmpty() && handlerQualifiers.equals(handler.getQualifiers()))\n                            {\n                                returningHandlers.add(handler);\n                            }\n                        }\n                    }\n                    else if (!handler.isBeforeHandler() && !isBefore)\n                    {\n                        if (handler.getQualifiers().contains(new AnyLiteral()))\n                        {\n                            returningHandlers.add(handler);\n                        }\n                        else\n                        {\n                            if (!handlerQualifiers.isEmpty() && handlerQualifiers.equals(handler.getQualifiers()))\n                            {\n                                returningHandlers.add(handler);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        log.fine(String.format(\"Found handlers %s for exception type %s, qualifiers %s\", returningHandlers,\n                exceptionClass, handlerQualifiers));\n        return Collections.unmodifiableCollection(returningHandlers);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/HandlerMethodStorageProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class HandlerMethodStorageProducer\n{\n    @Inject\n    private ExceptionControlExtension exceptionControlExtension;\n\n    @Produces\n    @ApplicationScoped\n    protected HandlerMethodStorage createHandlerMethodStorage()\n    {\n        return new HandlerMethodStorageImpl(exceptionControlExtension.getAllExceptionHandlers());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/OutboundParameterValueRedefiner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.core.util.metadata.builder.ParameterValueRedefiner;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\n\n/**\n * Redefiner allowing to inject a non contextual instance of {@link DefaultExceptionEvent} into the first parameter.\n * This class is immutable.\n */\nclass OutboundParameterValueRedefiner implements ParameterValueRedefiner\n{\n    private final ExceptionEvent<?> event;\n    private final Bean<?> declaringBean;\n    private final HandlerMethodImpl<?> handlerMethod;\n\n    /**\n     * Sole constructor.\n     *\n     * @param event         instance of DefaultExceptionEvent to inject.\n     * @param handlerMethod Handler method this redefiner is for\n     */\n    OutboundParameterValueRedefiner(final ExceptionEvent<?> event, final HandlerMethodImpl<?> handlerMethod)\n    {\n        this.event = event;\n        declaringBean = handlerMethod.getDeclaringBean();\n        this.handlerMethod = handlerMethod;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Object redefineParameterValue(ParameterValue value)\n    {\n        CreationalContext<?> ctx = BeanManagerProvider.getInstance().getBeanManager()\n                .createCreationalContext(declaringBean);\n\n        try\n        {\n            if (value.getPosition() == handlerMethod.getHandlerParameter().getPosition())\n            {\n                return event;\n            }\n            return value.getDefaultValue(ctx);\n        }\n        finally\n        {\n            if (ctx != null)\n            {\n                ctx.release();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/control/extension/ExceptionControlExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.exception.control.extension;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.impl.exception.control.HandlerMethodImpl;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.InjectionException;\nimport jakarta.enterprise.inject.spi.AfterDeploymentValidation;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Decorator;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.Interceptor;\nimport jakarta.enterprise.inject.spi.ProcessBean;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\n/**\n * CDI extension to find handlers at startup.\n */\n@SuppressWarnings({ \"unchecked\", \"CdiManagedBeanInconsistencyInspection\" })\npublic class ExceptionControlExtension implements Extension, Deactivatable\n{\n    private static final Logger LOG = Logger.getLogger(ExceptionControlExtension.class.getName());\n\n    //this map is application scoped by the def. of the cdi spec.\n    //if it needs to be static a classloader key is needed + a cleanup in a BeforeShutdown observer\n    private Map<Type, Collection<HandlerMethod<? extends Throwable>>> allHandlers\n        = new HashMap<Type, Collection<HandlerMethod<? extends Throwable>>>();\n\n    private Boolean isActivated = true;\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    /**\n     * Listener to ProcessBean event to locate handlers.\n     *\n     * @param processBean current {@link AnnotatedType}\n     * @param beanManager  Activated Bean Manager\n     * @throws TypeNotPresentException if any of the actual type arguments refers to a non-existent type declaration\n     *                                 when trying to obtain the actual type arguments from a\n     *                                 {@link java.lang.reflect.ParameterizedType}\n     * @throws java.lang.reflect.MalformedParameterizedTypeException\n     *                                 if any of the actual type parameters refer to a parameterized type that cannot\n     *                                 be instantiated for any reason when trying to obtain the actual type arguments\n     *                                 from a {@link java.lang.reflect.ParameterizedType}\n     */\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public <T> void findHandlers(@Observes final ProcessBean<?> processBean, final BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        if (processBean.getBean() instanceof Interceptor || processBean.getBean() instanceof Decorator ||\n                !(processBean.getAnnotated() instanceof AnnotatedType))\n        {\n            return;\n        }\n\n        AnnotatedType annotatedType = (AnnotatedType)processBean.getAnnotated();\n\n        if (annotatedType.getJavaClass().isAnnotationPresent(ExceptionHandler.class))\n        {\n            final Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();\n\n            for (AnnotatedMethod<? super T> method : methods)\n            {\n                if (HandlerMethodImpl.isHandler(method))\n                {\n                    if (method.getJavaMember().getExceptionTypes().length != 0)\n                    {\n                        processBean.addDefinitionError(new IllegalArgumentException(\n                            String.format(\"Handler method %s must not throw exceptions\", method.getJavaMember())));\n                    }\n\n                    //beanManager won't be stored in the instance -> no issue with wls12c\n                    registerHandlerMethod(new HandlerMethodImpl(processBean.getBean(), method, beanManager));\n                }\n            }\n        }\n    }\n\n    /**\n     * Verifies all injection points for every handler are valid.\n     *\n     * @param afterDeploymentValidation Lifecycle event\n     * @param bm  BeanManager instance\n     */\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public void verifyInjectionPoints(@Observes final AfterDeploymentValidation afterDeploymentValidation,\n                                      final BeanManager bm)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        for (Map.Entry<Type, Collection<HandlerMethod<? extends Throwable>>> entry : allHandlers.entrySet())\n        {\n            for (HandlerMethod<? extends Throwable> handler : entry.getValue())\n            {\n                for (InjectionPoint ip : ((HandlerMethodImpl<? extends Throwable>) handler).getInjectionPoints(bm))\n                {\n                    try\n                    {\n                        bm.validate(ip);\n                    }\n                    catch (InjectionException e)\n                    {\n                        afterDeploymentValidation.addDeploymentProblem(e);\n                    }\n                }\n            }\n        }\n    }\n\n    public Map<Type, Collection<HandlerMethod<? extends Throwable>>> getAllExceptionHandlers()\n    {\n        return Collections.unmodifiableMap(allHandlers);\n    }\n\n    private <T extends Throwable> void registerHandlerMethod(HandlerMethod<T> handlerMethod)\n    {\n        LOG.fine(String.format(\"Adding handler %s to known handlers\", handlerMethod));\n\n        if (allHandlers.containsKey(handlerMethod.getExceptionType()))\n        {\n            allHandlers.get(handlerMethod.getExceptionType()).add(handlerMethod);\n        }\n        else\n        {\n            allHandlers.put(handlerMethod.getExceptionType(),\n                new HashSet<HandlerMethod<? extends Throwable>>(Arrays.asList(handlerMethod)));\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/interceptor/GlobalInterceptorExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.interceptor;\n\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\nimport jakarta.interceptor.Interceptor;\nimport java.lang.annotation.Annotation;\nimport java.util.logging.Logger;\n\n// promotes deltaspike interceptors to global interceptors in case of cdi 1.1+\npublic class GlobalInterceptorExtension implements Deactivatable, Extension\n{\n    private static final Logger LOG = Logger.getLogger(GlobalInterceptorExtension.class.getName());\n    private static final String DS_PACKAGE_NAME = \"org.apache.deltaspike.\";\n    private Annotation priorityAnnotationInstance;\n    private BeanManager beanManager;\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager)\n    {\n        if (!ClassDeactivationUtils.isActivated(getClass()))\n        {\n            return;\n        }\n\n        this.beanManager = beanManager;\n        int priorityValue = CoreBaseConfig.InterceptorCustomization.PRIORITY;\n        priorityAnnotationInstance = AnnotationInstanceUtils.getPriorityAnnotationInstance(priorityValue);\n    }\n\n    protected void promoteInterceptors(@Observes ProcessAnnotatedType pat)\n    {\n        if (priorityAnnotationInstance == null) //not CDI 1.1 or the extension is deactivated\n        {\n            return;\n        }\n\n        String beanClassName = pat.getAnnotatedType().getJavaClass().getName();\n        if (beanClassName.startsWith(DS_PACKAGE_NAME))\n        {\n            if (pat.getAnnotatedType().isAnnotationPresent(Interceptor.class))\n            {\n                //noinspection unchecked\n                pat.setAnnotatedType(new GlobalInterceptorWrapper(pat.getAnnotatedType(), priorityAnnotationInstance));\n            }\n            //currently not needed, because we don't use our interceptors internally -> check for the future\n            else if (!beanClassName.contains(\".test.\"))\n            {\n                for (Annotation annotation : pat.getAnnotatedType().getAnnotations())\n                {\n                    if (beanManager.isInterceptorBinding(annotation.annotationType()))\n                    {\n                        //once we see this warning we need to introduce double-call prevention logic due to WELD-1780\n                        LOG.warning(beanClassName + \" is an bean from DeltaSpike which is intercepted.\");\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/resourceloader/InjectableResourceProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.resourceloader;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResource;\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResourceProvider;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Instance;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.inject.Inject;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.lang.annotation.Annotation;\nimport java.util.List;\nimport java.util.Properties;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * Handles the creation/loading of external resources.\n *\n */\n@ApplicationScoped\npublic class InjectableResourceProducer\n{\n    private static final Logger logger = Logger.getLogger(InjectableResourceProducer.class.getName());\n\n    @Inject\n    @Any\n    private Instance<InjectableResourceProvider> resourceProviders;\n\n    @Produces\n    @InjectableResource(resourceProvider = InjectableResourceProvider.class,location = \"\")\n    public InputStream getInputStream(final InjectionPoint injectionPoint)\n    {\n        InjectableResource injectableResource = getAnnotation(injectionPoint);\n        InjectableResourceProvider provider =\n                BeanProvider.getContextualReference(injectableResource.resourceProvider());\n        final InputStream is = provider.readStream(injectableResource);\n        return is;\n    }\n\n    @Produces\n    @InjectableResource(resourceProvider = InjectableResourceProvider.class,location = \"\")\n    public List<InputStream> getInputStreams(final InjectionPoint injectionPoint)\n    {\n        InjectableResource injectableResource = getAnnotation(injectionPoint);\n        InjectableResourceProvider provider =\n                BeanProvider.getContextualReference(injectableResource.resourceProvider());\n        return provider.readStreams(injectableResource);\n    }\n\n    @Produces\n    @InjectableResource(resourceProvider = InjectableResourceProvider.class,location = \"\")\n    public Properties getProperties(final InjectionPoint injectionPoint) throws IOException\n    {\n        InjectableResource injectableResource = getAnnotation(injectionPoint);\n        InjectableResourceProvider provider =\n                BeanProvider.getContextualReference(injectableResource.resourceProvider());\n        final Properties properties = provider.readProperties(injectableResource);\n        return properties;\n    }\n\n    public void closeInputStream(@Disposes\n                                 @InjectableResource(resourceProvider = InjectableResourceProvider.class, location = \"\")\n                                 InputStream inputStream)\n    {\n        if (inputStream != null)\n        {\n            try\n            {\n                inputStream.close();\n            }\n            catch (IOException e)\n            {\n                if (logger.isLoggable(Level.FINE))\n                {\n                    logger.log(Level.FINE,\"Unable to close input stream \",e);\n                }\n            }\n        }\n    }\n\n    private InjectableResource getAnnotation(final InjectionPoint injectionPoint)\n    {\n        for (Annotation annotation : injectionPoint.getQualifiers())\n        {\n            if (annotation instanceof InjectableResource)\n            {\n                return (InjectableResource)annotation;\n            }\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ResourceLoaderExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.resourceloader;\n\nimport org.apache.deltaspike.core.api.resourceloader.ClasspathResourceProvider;\nimport org.apache.deltaspike.core.api.resourceloader.FileResourceProvider;\n\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\n\n/**\n * This is needed for certain class loading cases (EARs, external modules).\n * Simply registers additional resource loader classes to the context.\n */\n//TODO re-visit it based on DELTASPIKE-472\npublic class ResourceLoaderExtension implements Extension\n{\n    public void addResourceLoaders(final BeforeBeanDiscovery beforeBeanDiscovery, final BeanManager beanManager)\n    {\n        beforeBeanDiscovery.addAnnotatedType(this.createAnnotatedType(ClasspathResourceProvider.class,beanManager));\n        beforeBeanDiscovery.addAnnotatedType(this.createAnnotatedType(InjectableResourceProducer.class,beanManager));\n        beforeBeanDiscovery.addAnnotatedType(this.createAnnotatedType(FileResourceProvider.class,beanManager));\n    }\n\n    private AnnotatedType<?> createAnnotatedType(final Class<?> clazz, final BeanManager beanManager)\n    {\n        return beanManager.createAnnotatedType(clazz);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/BaseBean1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n * Simple base bean which gets overruled by an global alternative\n */\n@Dependent\npublic class BaseBean1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/BaseInterface1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global;\n\n/**\n * Simple interface - at runtime the global alternative gets activated\n */\npublic interface BaseInterface1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/BaseInterface1AlternativeImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\n\n/**\n * Global alternative\n */\n@Alternative\n@Dependent\npublic class BaseInterface1AlternativeImplementation implements BaseInterface1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/BaseInterface1DefaultImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n * Default implementation which gets overruled by the alternative\n */\n@Dependent\npublic class BaseInterface1DefaultImplementation implements BaseInterface1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/SubBaseBean1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@Dependent\npublic class SubBaseBean1 extends BaseBean1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/SubBaseBean2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@Dependent\npublic class SubBaseBean2 extends SubBaseBean1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/AlternativeBaseBeanB.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\n\n/**\n *\n */\n@Dependent\n@Alternative\n@QualifierB(value = QualifierValue1.class, hint = \"non-binding hint\")\npublic class AlternativeBaseBeanB implements BaseInterface\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/BaseBeanA.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n *\n */\n@Dependent\n@QualifierA(QualifierValue1.class)\npublic class BaseBeanA implements BaseInterface\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/BaseBeanB.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n *\n */\n@Dependent\n@QualifierB(QualifierValue1.class)\npublic class BaseBeanB implements BaseInterface\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/BaseBeanB2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n *\n */\n@Dependent\n@QualifierB(QualifierValue2.class)\npublic class BaseBeanB2 implements BaseInterface\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/BaseInterface.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\n/**\n */\npublic interface BaseInterface\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/QualifierA.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n *\n */\n@Qualifier\n\n@Target({FIELD, METHOD, TYPE})\n@Retention(RUNTIME)\n\npublic @interface QualifierA\n{\n    Class value();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/QualifierB.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n *\n */\n@Qualifier\n\n@Target({FIELD, METHOD, TYPE})\n@Retention(RUNTIME)\n\npublic @interface QualifierB\n{\n    Class value();\n\n    @Nonbinding\n    String hint() default \"default hint\";\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/QualifierValue1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\n/**\n */\npublic interface QualifierValue1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/qualifier/QualifierValue2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.global.qualifier;\n\n/**\n */\npublic interface QualifierValue2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BaseBean2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.local;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n * Simple base bean which doesn't get overruled by an global alternative\n */\n//Workaround until different config files for unit tests work correctly\n@Dependent\npublic class BaseBean2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BaseInterface2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.local;\n\n/**\n * Simple interface - at runtime the default implementation gets activated\n */\n//Workaround until different config files for unit tests work correctly\npublic interface BaseInterface2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BaseInterface2AlternativeImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.local;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\n\n/**\n * Alternative which isn't configured as global alternative.\n *\n * (A normal alternative usually it would be in a different BDA - here we have the same BDA but no config in\n * beans.xml which simulates the behaviour - compared to {@link org.apache.deltaspike.test.core.api.alternative.global.BaseInterface1AlternativeImplementation} which is also\n * not configured in the beans.xml, but as global alternative (via DeltaSpike). Since we don't test the CDI\n * implementation itself, it's ok to simulate it.\n * Otherwise it will break with CDI 1.1 or at least with the default behaviour of OWB.)\n */\n@Alternative\n@Dependent\n//Workaround until different config files for unit tests work correctly\npublic class BaseInterface2AlternativeImplementation implements BaseInterface2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BaseInterface2DefaultImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.local;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n * Default implementation which doesn't get overruled by the alternative\n */\n@Dependent\n//Workaround until different config files for unit tests work correctly\npublic class BaseInterface2DefaultImplementation implements BaseInterface2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.local;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport jakarta.inject.Inject;\nimport java.util.List;\n\n/**\n * Keep in sync with {@link org.apache.deltaspike.test.core.api.alternative.global.GlobalAlternativeTest} -\n * but without configuring the alternatives and check for the default implementations.\n *\n * Tests which checks the behaviour with deactivated global alternates.\n */\npublic abstract class BdaAlternativeTest\n{\n    @Inject\n    private BaseInterface2 bean;\n\n    /*\n     * The default implementation should be found\n     */\n    @Test\n    public void alternativeImplementationWithClassAsBaseType()\n    {\n        BaseBean2 baseBean2 = BeanProvider.getContextualReference(BaseBean2.class);\n        Assert.assertNotNull(baseBean2);\n    }\n\n    /*\n     * The default implementation should be found\n     */\n    @Test\n    public void alternativeImplementationWithInterfaceAsBaseType()\n    {\n        Assert.assertEquals(BaseInterface2DefaultImplementation.class.getName(), bean.getClass().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/SubBaseBean2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.alternative.local;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\n\n/**\n * Alternative which isn't configured as global alternative.\n *\n * (A normal alternative usually it would be in a different BDA - here we have the same BDA but no config in\n * beans.xml which simulates the behaviour - compared to {@link org.apache.deltaspike.test.core.api.alternative.global.SubBaseBean1} which is also not configured\n * in the beans.xml, but as global alternative (via DeltaSpike). Since we don't test the CDI implementation itself,\n * it's ok to simulate it. Otherwise it will break with CDI 1.1 or at least with the default behaviour of OWB.)\n */\n@Alternative\n@Dependent\n//Workaround until different config files for unit tests work correctly\npublic class SubBaseBean2 extends BaseBean2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport java.io.IOException;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.core.api.exclude.ExcludeWarFileTest.getConfigContent;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude}\n */\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class ExcludeEarFileTest extends ExcludeTest\n{\n\n    @Deployment\n    public static EnterpriseArchive deployEar() throws IOException\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = ExcludeWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n\n        // we needs to package the config into the EAR, as Weld3 based app servers boot the whole container\n        // with just the EAR classloader. No WAR file packaged config is reachable for BeforeBeanDiscovery\n        JavaArchive excludeConfigJar = ShrinkWrap.create(JavaArchive.class, \"excludeConfig.jar\")\n            .addAsManifestResource(new StringAsset(getConfigContent()), \"apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsLibrary(excludeConfigJar)\n                .addAsModule(ExcludeWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class BeanManagerProviderEarFileTest extends BeanManagerProviderTest\n{\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = BeanManagerProviderWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(BeanManagerProviderWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/util/bean/BeanBuilderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.util.bean;\n\nimport org.apache.deltaspike.core.util.bean.BeanBuilder;\nimport org.apache.deltaspike.core.util.metadata.builder.ImmutableInjectionPoint;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.inject.Inject;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n *\n */\n@RunWith(Arquillian.class)\npublic class BeanBuilderTest\n{\n    @Deployment\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"beanBuilderTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(SimpleClass.class, WithInjectionPoint.class);\n    }\n\n    @Inject\n    private BeanManager beanManager;\n\n    @Test\n    public void assertNonNullInjectionPointsFromBeanBuilder()\n    {\n        final BeanBuilder beanBuilder = new BeanBuilder(beanManager);\n        final AnnotatedType<?> at = beanManager.createAnnotatedType(WithInjectionPoint.class);\n        final Bean<?> newInjectionBean = beanBuilder.readFromType(at).create();\n\n        for (final InjectionPoint ip : newInjectionBean.getInjectionPoints())\n        {\n            Assert.assertNotNull(ip);\n        }\n    }\n\n    @Test\n    public void assertNonNullInjectionPointsWhenOverriding()\n    {\n        final BeanBuilder beanBuilder = new BeanBuilder(beanManager);\n        final AnnotatedType<?> at = beanManager.createAnnotatedType(WithInjectionPoint.class);\n        beanBuilder.readFromType(at);\n\n        // It's not easy to actually create these in the state we need, so we have to get the InjectionPonits,\n        // create new ones with the correct info, null out the bean, set them as the new injection points\n        // then move on.\n        final Set<InjectionPoint> origInjectionPoints = beanBuilder.getInjectionPoints();\n        beanBuilder.injectionPoints(beanBuilder.getInjectionPoints());\n\n        final Set<InjectionPoint> newInjectionPoints = new HashSet<InjectionPoint>();\n        for (InjectionPoint ip : origInjectionPoints)\n        {\n            newInjectionPoints.add(new ImmutableInjectionPoint((AnnotatedField) ip.getAnnotated(),\n                    ip.getQualifiers(), null, ip.isTransient(), ip.isDelegate()));\n        }\n        beanBuilder.injectionPoints(newInjectionPoints);\n\n        final Bean<?> newInjectionBean = beanBuilder.create();\n\n        for (final InjectionPoint ip : newInjectionBean.getInjectionPoints())\n        {\n            Assert.assertNotNull(ip);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/util/bean/SimpleClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.util.bean;\n\n/**\n *\n */\npublic class SimpleClass\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/api/util/bean/WithInjectionPoint.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.util.bean;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n/**\n *\n */\n@Named(\"ipoint\")\npublic class WithInjectionPoint\n{\n    @Inject\n    private BeanManager beanManager;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class ClassDeactivationEarFileTest extends ClassDeactivationTest\n{\n    // fixes Wildfly9 CNFE\n    private final static String CONFIG =\n            \"# InterDynTest\\n\" +\n            \"deltaspike_ordinal=110\\n\" +\n            \"deltaspike.interdyn.enabled=false\\n\";\n\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = ClassDeactivationWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(ClassDeactivationWarFileTest.deploy()\n                                .addAsManifestResource(new StringAsset(CONFIG), \"apache-deltaspike.properties\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/PartialBeanAsInterfaceEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.custom.spi;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class PartialBeanAsInterfaceEarFileTest extends ServiceUtilsTest\n{\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = ServiceUtilsWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(ServiceUtilsWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/event/EventQualifier.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.event;\n\nimport jakarta.inject.Qualifier;\n\n@Qualifier\npublic @interface EventQualifier\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/event/EventTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.event;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.core.spi.exception.control.event.IntrospectiveExceptionEvent;\nimport org.apache.deltaspike.test.core.impl.exception.control.event.literal.EventQualifierLiteral;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertThat;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\n@ExceptionHandler\npublic class EventTest\n{\n    @Deployment(name = \"EventTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"eventTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(EventTest.class, EventQualifier.class, EventQualifierLiteral.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    private int qualiferCalledCount = 0;\n\n    @Test\n    public void assertEventIsCreatedCorrectly()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));\n    }\n\n    @Test\n    public void assertEventWithQualifiersIsCreatedCorrectly()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException(), new EventQualifierLiteral()));\n    }\n\n    public void verifyDescEvent(@BeforeHandles IntrospectiveExceptionEvent<NullPointerException> event)\n    {\n        qualiferCalledCount++;\n        assertTrue(event.isBeforeTraversal());\n    }\n\n    public void verifyAscEvent(@Handles IntrospectiveExceptionEvent<NullPointerException> event)\n    {\n        qualiferCalledCount++;\n        assertFalse(event.isBeforeTraversal());\n    }\n\n    public void verifyQualifierEvent(@Handles @EventQualifier ExceptionEvent<NullPointerException> event)\n    {\n        qualiferCalledCount++;\n        assertThat(qualiferCalledCount, is(1));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/event/literal/EventQualifierLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.event.literal;\n\nimport org.apache.deltaspike.test.core.impl.exception.control.event.EventQualifier;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\npublic class EventQualifierLiteral extends AnnotationLiteral<EventQualifier> implements EventQualifier\n{\n    private static final long serialVersionUID = -7287578336564561662L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/extension/Account.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.extension;\n\n/**\n *\n */\npublic class Account\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/extension/Arquillian.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.extension;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Qualifier\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.PARAMETER)\npublic @interface Arquillian\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/extension/CatchQualifier.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.extension;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Qualifier\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.PARAMETER)\npublic @interface CatchQualifier\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/extension/literal/CatchQualifierLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.extension.literal;\n\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.CatchQualifier;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n *\n */\npublic class CatchQualifierLiteral extends AnnotationLiteral<CatchQualifier> implements CatchQualifier\n{\n    private static final long serialVersionUID = -5784558882329045733L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/AbortingBreadthFirstHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@SuppressWarnings({\"AssignmentToStaticFieldFromInstanceMethod\"})\n@ApplicationScoped\n@ExceptionHandler\npublic class AbortingBreadthFirstHandler\n{\n    private boolean abortCalled = false;\n    private boolean proceedCalled = false;\n\n    public void abortHandler(@BeforeHandles ExceptionEvent<Exception> event)\n    {\n        abortCalled = true;\n        event.abort();\n    }\n\n    public void proceedHandler(@Handles ExceptionEvent<NullPointerException> event)\n    {\n        proceedCalled = true;\n        event.handledAndContinue();\n    }\n\n    public boolean isAbortCalled()\n    {\n        return abortCalled;\n    }\n\n    public boolean isProceedCalled()\n    {\n        return proceedCalled;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/AbortingDepthHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@SuppressWarnings({\"AssignmentToStaticFieldFromInstanceMethod\"})\n@ApplicationScoped\n@ExceptionHandler\npublic class AbortingDepthHandler\n{\n    private boolean abortCalled = false;\n    private boolean proceedCalled = false;\n\n    protected AbortingDepthHandler()\n    {\n    }\n\n    public void abortHandler(@Handles ExceptionEvent<Exception> event)\n    {\n        abortCalled = true;\n        event.abort();\n    }\n\n    public void proceedHandler(@Handles ExceptionEvent<Throwable> event)\n    {\n        proceedCalled = true;\n        event.handledAndContinue();\n    }\n\n    public boolean isAbortCalled()\n    {\n        return abortCalled;\n    }\n\n    public boolean isProceedCalled()\n    {\n        return proceedCalled;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/BreadthFirstAbortControlTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\npublic class BreadthFirstAbortControlTest\n{\n    @Inject\n    private AbortingBreadthFirstHandler abortingBreadthFirstHandler;\n\n    @Deployment(name = \"BreadthFirstAbortControlTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"breadthFirstAbortControl.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(AbortingBreadthFirstHandler.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test\n    public void assertNoOtherHandlersCalledAfterAbort()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));\n        assertTrue(abortingBreadthFirstHandler.isAbortCalled());\n        assertFalse(abortingBreadthFirstHandler.isProceedCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/DepthAbortControlTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\npublic class DepthAbortControlTest\n{\n    @Inject\n    private BeanManager bm;\n\n    @Inject\n    private AbortingDepthHandler abortingDepthHandler;\n\n    @Deployment(name = \"DepthAbortControlTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"depthAbortControl.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClass(AbortingDepthHandler.class);\n    }\n\n    @Test\n    public void assertNoOtherHandlersCalledAfterAbort()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));\n        assertTrue(abortingDepthHandler.isAbortCalled());\n        assertFalse(abortingDepthHandler.isProceedCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/ExceptionHandledHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@ExceptionHandler\npublic class ExceptionHandledHandler\n{\n    private boolean exAscCalled = false;\n    private boolean iaeAscCalled = false;\n    private boolean npeDescCalled = false;\n\n    public void exHandler(@Handles ExceptionEvent<Exception> event)\n    {\n        exAscCalled = true;\n    }\n\n    public void npeHandler(@Handles ExceptionEvent<IllegalArgumentException> event)\n    {\n        iaeAscCalled = true;\n        event.handled();\n    }\n\n    public void npeDescHandler(@BeforeHandles ExceptionEvent<NullPointerException> event)\n    {\n        npeDescCalled = true;\n        event.handled();\n    }\n\n    public boolean isExAscCalled()\n    {\n        return exAscCalled;\n    }\n\n    public boolean isIaeAscCalled()\n    {\n        return iaeAscCalled;\n    }\n\n    public boolean isNpeDescCalled()\n    {\n        return npeDescCalled;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/HandledExceptionHandlerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\npublic class HandledExceptionHandlerTest\n{\n    @Inject\n    private ExceptionHandledHandler exceptionHandledHandler;\n\n    @Deployment(name = \"HandledExceptionHandlerTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"handledExceptionHandler.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(ExceptionHandledHandler.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test\n    public void assertNoHandlersAfterHandledAreCalled()\n    {\n        final ExceptionToCatchEvent entryEvent = new ExceptionToCatchEvent(new Exception(\n                new NullPointerException()));\n        bm.fireEvent(entryEvent);\n        assertTrue(exceptionHandledHandler.isNpeDescCalled());\n        assertFalse(exceptionHandledHandler.isExAscCalled());\n        assertTrue(entryEvent.isHandled());\n    }\n\n    @Test\n    public void assertNoHandlersAfterHandledAreCalledDesc()\n    {\n        final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new Exception(new IllegalArgumentException()));\n        bm.fireEvent(event);\n        assertTrue(exceptionHandledHandler.isIaeAscCalled());\n        assertFalse(exceptionHandledHandler.isExAscCalled());\n        assertTrue(event.isHandled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/ProceedCauseHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@ExceptionHandler\npublic class ProceedCauseHandler\n{\n    private int breadthFirstNpeCalled = 0;\n    private int breadthFirstNpeLowerPrecedenceCalled = 0;\n\n    private int depthFirstNpeCalled = 0;\n    private int depthFirstNpeHigherPrecedenceCalled = 0;\n\n    public void npeInboundHandler(@BeforeHandles ExceptionEvent<NullPointerException> event)\n    {\n        breadthFirstNpeCalled++;\n        event.skipCause();\n    }\n\n    public void npeLowerPrecedenceInboundHandler(\n            @BeforeHandles(ordinal = -50) ExceptionEvent<NullPointerException> event)\n    {\n        breadthFirstNpeLowerPrecedenceCalled++;\n        event.handledAndContinue();\n    }\n\n    public void npeOutboundHandler(@Handles ExceptionEvent<NullPointerException> event)\n    {\n        depthFirstNpeCalled++;\n        event.skipCause();\n    }\n\n    public void npeHigherPrecedenceOutboundHandler(@Handles(ordinal = -10) ExceptionEvent<NullPointerException> event)\n    {\n        depthFirstNpeHigherPrecedenceCalled++;\n        event.handledAndContinue();\n    }\n\n    public int getBreadthFirstNpeCalled()\n    {\n        return breadthFirstNpeCalled;\n    }\n\n    public int getBreadthFirstNpeLowerPrecedenceCalled()\n    {\n        return breadthFirstNpeLowerPrecedenceCalled;\n    }\n\n    public int getDepthFirstNpeCalled()\n    {\n        return depthFirstNpeCalled;\n    }\n\n    public int getDepthFirstNpeHigherPrecedenceCalled()\n    {\n        return depthFirstNpeHigherPrecedenceCalled;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/ProceedCauseHandlerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static junit.framework.Assert.assertEquals;\n\n@RunWith(Arquillian.class)\npublic class ProceedCauseHandlerTest\n{\n    @Inject\n    private ProceedCauseHandler proceedCauseHandler;\n\n    @Deployment(name = \"ProceedCauseHandlerTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"proceedCauseHandler.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(ProceedCauseHandler.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test\n    public void assertCorrectNumberOfHandlerCallsForProceedCause()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new Exception(new IllegalArgumentException(new NullPointerException()))));\n        assertEquals(0, proceedCauseHandler.getBreadthFirstNpeLowerPrecedenceCalled());\n        assertEquals(1, proceedCauseHandler.getBreadthFirstNpeCalled());\n\n        assertEquals(0, proceedCauseHandler.getDepthFirstNpeHigherPrecedenceCalled());\n        assertEquals(0, proceedCauseHandler.getDepthFirstNpeCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\n@ExceptionHandler\npublic class RethrowHandler\n{\n\n    static boolean iaeHandlerCalled = false;\n\n    public void rethrow(@Handles ExceptionEvent<NullPointerException> event)\n    {\n        event.throwOriginal();\n    }\n\n    public void rethrowInbound(\n            @BeforeHandles ExceptionEvent<IllegalArgumentException> event)\n    {\n        event.throwOriginal();\n    }\n\n    public void handleInbound(@Handles ExceptionEvent<IllegalArgumentException> event)\n    {\n        iaeHandlerCalled = true;\n    }\n\n    public static boolean isIaeHandlerCalled()\n    {\n        return iaeHandlerCalled;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static org.junit.Assert.assertFalse;\n\n@RunWith(Arquillian.class)\npublic class RethrowTest\n{\n    @Deployment(name = \"RethrowTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"rethrow.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(RethrowHandler.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test(expected = NullPointerException.class)\n    public void assertOutboundRethrow()\n    {\n        final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new NullPointerException());\n        try\n        {\n            bm.fireEvent(event);\n        }\n        catch (NullPointerException e)\n        {\n            assertFalse(event.isHandled());\n            throw e;\n        }\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void assertInboundRethrow()\n    {\n        final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new IllegalArgumentException());\n        try\n        {\n            bm.fireEvent(event);\n        }\n        catch (IllegalArgumentException e)\n        {\n            assertFalse(event.isHandled());\n            assertFalse(RethrowHandler.isIaeHandlerCalled());\n            throw e;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/ThrowingNewExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\npublic class ThrowingNewExceptionTest\n{\n    @Deployment(name = \"ThrowingNewExceptionTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"throwingNew.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(ThrowingNewHandler.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void assertOutboundRethrow()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void assertInboundRethrow()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/ThrowingNewHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.flow;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\n@ExceptionHandler\npublic class ThrowingNewHandler\n{\n    public void rethrow(@Handles ExceptionEvent<NullPointerException> event)\n    {\n        event.rethrow(new UnsupportedOperationException());\n    }\n\n    public void rethrowInbound(\n            @BeforeHandles ExceptionEvent<IllegalArgumentException> event)\n    {\n        event.rethrow(new UnsupportedOperationException());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/BadInjectionPointHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\n/**\n * This handler is not valid as the injection point firstParam is not valid.\n */\n@ExceptionHandler\npublic class BadInjectionPointHandler\n{\n    void handleException(int firstParam, @Handles ExceptionEvent<Exception> event)\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/CalledExceptionHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.sql.SQLException;\n\n@ApplicationScoped\n@ExceptionHandler\npublic class CalledExceptionHandler\n{\n    private boolean outboundHandlerCalled = false;\n    private int outboundHandlerTimesCalled = 0;\n    private boolean protectedHandlerCalled = false;\n    private int inboundHandlerTimesCalled = 0;\n    private boolean beanmanagerInjected = false;\n    private boolean locationDifferBeanmanagerInjected = false;\n\n    public void basicHandler(@Handles ExceptionEvent<Exception> event)\n    {\n        outboundHandlerCalled = true;\n        outboundHandlerTimesCalled++;\n    }\n\n    public void basicInboundHandler(@BeforeHandles ExceptionEvent<Exception> event)\n    {\n        inboundHandlerTimesCalled++;\n        event.handledAndContinue();\n    }\n\n    public void extraInjections(@Handles ExceptionEvent<IllegalArgumentException> event, BeanManager bm)\n    {\n        if (bm != null)\n        {\n            beanmanagerInjected = true;\n        }\n    }\n\n    void protectedHandler(@Handles ExceptionEvent<IllegalStateException> event)\n    {\n        protectedHandlerCalled = true;\n\n        if (!event.isMarkedHandled())\n        {\n            event.handledAndContinue();\n        }\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void handlerLocationInjections(BeanManager bm, @Handles ExceptionEvent<SQLException> event)\n    {\n        if (bm != null)\n        {\n            locationDifferBeanmanagerInjected = true;\n        }\n    }\n\n    public boolean isOutboundHandlerCalled()\n    {\n        return outboundHandlerCalled;\n    }\n\n    public int getOutboundHandlerTimesCalled()\n    {\n        return outboundHandlerTimesCalled;\n    }\n\n    public boolean isProtectedHandlerCalled()\n    {\n        return protectedHandlerCalled;\n    }\n\n    public void setOutboundHandlerTimesCalled(int outboundHandlerTimesCalled)\n    {\n        this.outboundHandlerTimesCalled = outboundHandlerTimesCalled;\n    }\n\n    public void setInboundHandlerTimesCalled(int inboundHandlerTimesCalled)\n    {\n        this.inboundHandlerTimesCalled = inboundHandlerTimesCalled;\n    }\n\n    public int getInboundHandlerTimesCalled()\n    {\n        return inboundHandlerTimesCalled;\n    }\n\n    public boolean isBeanmanagerInjected()\n    {\n        return beanmanagerInjected;\n    }\n\n    public boolean isLocationDifferBeanmanagerInjected()\n    {\n        return locationDifferBeanmanagerInjected;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/CallingHandlersTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport java.sql.SQLException;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\npublic class CallingHandlersTest\n{\n    @Inject\n    private CalledExceptionHandler calledExceptionHandler;\n\n    @Deployment(name = \"CallingHandlersTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"callingHandlers.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addClasses(CalledExceptionHandler.class)\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test\n    public void assertOutboundHanldersAreCalled()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));\n\n        assertTrue(calledExceptionHandler.isOutboundHandlerCalled());\n    }\n\n    @Test\n    public void assertOutboundHanldersAreCalledOnce()\n    {\n        calledExceptionHandler.setOutboundHandlerTimesCalled(0);\n        bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));\n        assertEquals(1, calledExceptionHandler.getOutboundHandlerTimesCalled());\n    }\n\n    @Test\n    public void assertInboundHanldersAreCalledOnce()\n    {\n        calledExceptionHandler.setInboundHandlerTimesCalled(0);\n        bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));\n        assertEquals(1, calledExceptionHandler.getInboundHandlerTimesCalled());\n    }\n\n    @Test\n    public void assertAdditionalParamsAreInjected()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new RuntimeException(new IllegalArgumentException())));\n        assertTrue(calledExceptionHandler.isBeanmanagerInjected());\n    }\n\n    //@Test //TODO discuss this test\n    public void assertAdditionalParamsAreInjectedWithDifferentHandlerLocation()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new SQLException()));\n        assertTrue(calledExceptionHandler.isLocationDifferBeanmanagerInjected());\n    }\n\n    @Test\n    public void assertProtectedHandlersAreCalled()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new IllegalStateException()));\n        assertTrue(calledExceptionHandler.isProtectedHandlerCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/ExtensionExceptionHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.Account;\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.Arquillian;\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.CatchQualifier;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.sql.SQLException;\n\n@ExceptionHandler\npublic class ExtensionExceptionHandler\n{\n    public void catchDescException(@BeforeHandles ExceptionEvent<Exception> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void catchFrameworkDescException(@BeforeHandles(ordinal = -50) ExceptionEvent<Exception> event)\n    {\n        // Nothing to do here\n    }\n\n    public void catchRuntime(@Handles ExceptionEvent<RuntimeException> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void catchThrowableBreadthFirst(\n            @BeforeHandles(ordinal = 10) ExceptionEvent<Throwable> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void catchThrowableP20BreadthFirst(\n            @BeforeHandles(ordinal = 20) ExceptionEvent<Throwable> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void catchThrowable(\n            @Handles(ordinal = 10) ExceptionEvent<Throwable> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void catchThrowableP20(\n            @Handles(ordinal = 20) ExceptionEvent<Throwable> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void catchIAE(@Handles ExceptionEvent<IllegalArgumentException> event)\n    {\n        // Nothing to do currently\n    }\n\n    public void qualifiedHandler(@Handles @CatchQualifier ExceptionEvent<Exception> event)\n    {\n        // Method to verify the qualifiers are working correctly for handlers\n    }\n\n    public void arqHandler(@Handles @Arquillian ExceptionEvent<Throwable> event)\n    {\n        // Method to verify the qualifiers are working correctly for handlers\n    }\n\n    public void arqTestingHandler(@Handles @Arquillian @CatchQualifier ExceptionEvent<Throwable> event)\n    {\n        // Method to verify the qualifiers are working correctly for handlers\n    }\n\n    public void differentParamHandlerLocationHandler(Account act, BeanManager bm,\n                                                     @Handles ExceptionEvent<SQLException> event)\n    {\n        // Nothing here, just need to make sure this handler is picked up\n    }\n\n    public void npeHandlerNoDefQualifier(@Handles ExceptionEvent<NullPointerException> event)\n    {\n\n    }\n\n    public void npeHandlerDefQualifier(@Handles @CatchQualifier ExceptionEvent<NullPointerException> event)\n    {\n\n    }\n\n    public void doNothingMethod()\n    {\n        // Method to make sure only @Handles methods are found\n    }\n\n    public void doNothingTwo(String p1, String p2, int p3)\n    {\n        // Same as above\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/HandlerComparatorTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.HandlerMethod;\nimport org.apache.deltaspike.core.impl.exception.control.HandlerMethodImpl;\nimport org.apache.deltaspike.core.impl.exception.control.HandlerMethodStorage;\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.literal.CatchQualifierLiteral;\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.Account;\nimport org.apache.deltaspike.test.core.impl.exception.control.extension.CatchQualifier;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.junit.Assert.assertThat;\n\n@RunWith(Arquillian.class)\npublic class HandlerComparatorTest\n{\n    @Deployment(name = \"HandlerComparatorTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"handlerComparator.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(ExtensionExceptionHandler.class, Account.class,\n                        org.apache.deltaspike.test.core.impl.exception.control.extension.Arquillian.class,\n                        CatchQualifier.class, CatchQualifierLiteral.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Inject\n    private HandlerMethodStorage storage;\n\n    @Test\n    public void assertOrderIsCorrectDepthFirst()\n    {\n        List<HandlerMethod<? extends Throwable>> handlers = new ArrayList<HandlerMethod<? extends Throwable>>(\n                storage.getHandlersForException(IllegalArgumentException.class, bm, Collections.<Annotation>emptySet(),\n                        false));\n\n//        System.out.println(handlers);\n\n        assertThat(((HandlerMethodImpl<?>) handlers.get(0)).getJavaMethod().getName(), is(\"catchThrowable\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(1)).getJavaMethod().getName(), is(\"catchThrowableP20\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(2)).getJavaMethod().getName(), is(\"catchRuntime\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(3)).getJavaMethod().getName(), is(\"catchIAE\"));\n    }\n\n    @Test\n    public void assertOrderIsCorrectWithQualifiers()\n    {\n        Set<Annotation> qualifiers = new HashSet<Annotation>();\n        qualifiers.add(new CatchQualifierLiteral());\n\n        List<HandlerMethod<? extends Throwable>> handlers = new ArrayList<HandlerMethod<? extends Throwable>>(\n                storage.getHandlersForException(NullPointerException.class, bm, qualifiers, false));\n\n        assertThat(handlers.size(), is(6));\n\n        assertThat(((HandlerMethodImpl<?>) handlers.get(0)).getJavaMethod().getName(), is(\"catchThrowable\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(1)).getJavaMethod().getName(), is(\"catchThrowableP20\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(2)).getJavaMethod().getName(), is(\"qualifiedHandler\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(3)).getJavaMethod().getName(), is(\"catchRuntime\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(4)).getJavaMethod().getName(), is(\"npeHandlerNoDefQualifier\"));\n        assertThat(((HandlerMethodImpl<?>) handlers.get(5)).getJavaMethod().getName(), is(\"npeHandlerDefQualifier\"));\n\n    }\n\n    @Test\n    public void assertOrderIsCorrectBreadthFirst()\n    {\n        List<HandlerMethod<? extends Throwable>> handlers = new ArrayList<HandlerMethod<? extends Throwable>>(\n                storage.getHandlersForException(Exception.class, bm, Collections.<Annotation>emptySet(), true));\n\n        assertThat(handlers.size(), is(4));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/HandlerWhichThrowsExceptions.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\n/**\n * ExceptionHandler which is not valid.\n */\n@ExceptionHandler\npublic class HandlerWhichThrowsExceptions\n{\n    public void throwsAnException(@Handles ExceptionEvent<Throwable> evt) throws Exception\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/UnMuteHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@ExceptionHandler\npublic class UnMuteHandler\n{\n    private int depthFirstNumberCalled = 0;\n    private int breadthFirstNumberCalled = 0;\n\n    public void unMuteHandlerAsc(@Handles ExceptionEvent<Exception> event)\n    {\n        depthFirstNumberCalled++;\n        event.unmute();\n    }\n\n    public void unMuteHandlerDesc(@BeforeHandles ExceptionEvent<Exception> event)\n    {\n        breadthFirstNumberCalled++;\n        event.unmute();\n    }\n\n    public int getDepthFirstNumberCalled()\n    {\n        return depthFirstNumberCalled;\n    }\n\n    public int getBreadthFirstNumberCalled()\n    {\n        return breadthFirstNumberCalled;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/handler/UnMuteHandlerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.handler;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static junit.framework.Assert.assertEquals;\n\n@RunWith(Arquillian.class)\npublic class UnMuteHandlerTest\n{\n    @Inject\n    private UnMuteHandler unMuteHandler;\n\n    @Deployment(name = \"UnMuteHandlerTest\")\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"unMuteHandler.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addClasses(UnMuteHandler.class);\n    }\n\n    @Inject\n    private BeanManager bm;\n\n    @Test\n    public void assertCorrectNumberOfCallsForUnMute()\n    {\n        bm.fireEvent(new ExceptionToCatchEvent(new Exception(new NullPointerException())));\n\n        assertEquals(2, unMuteHandler.getDepthFirstNumberCalled());\n        assertEquals(2, unMuteHandler.getBreadthFirstNumberCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/traversal/ExceptionHandlerMethods.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.traversal;\n\nimport org.apache.deltaspike.core.api.exception.control.BeforeHandles;\nimport org.apache.deltaspike.core.api.exception.control.ExceptionHandler;\nimport org.apache.deltaspike.core.api.exception.control.Handles;\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@ExceptionHandler\npublic class ExceptionHandlerMethods\n{\n    private static final List<Integer> executionOrder = new ArrayList<Integer>();\n\n    public void handleException1BF(@BeforeHandles ExceptionEvent<Exceptions.Exception1> event)\n    {\n        executionOrder.add(7);\n    }\n\n    public void handleException2BF(@BeforeHandles ExceptionEvent<Exceptions.Exception2> event)\n    {\n        executionOrder.add(5);\n    }\n\n    public void handleException3DF(@Handles ExceptionEvent<Exceptions.Exception3> event)\n    {\n        executionOrder.add(3);\n    }\n\n    public void handleException3BF(@BeforeHandles ExceptionEvent<Exceptions.Exception3> event)\n    {\n        executionOrder.add(2);\n    }\n\n    public void handleException3SuperclassBF(@BeforeHandles ExceptionEvent<Exceptions.Exception3Super> event)\n    {\n        executionOrder.add(1);\n    }\n\n    public void handleException3SuperclassDF(@Handles ExceptionEvent<Exceptions.Exception3Super> event)\n    {\n        executionOrder.add(4);\n    }\n\n    public void handleException2DF(@Handles ExceptionEvent<Exceptions.Exception2> event)\n    {\n        executionOrder.add(6);\n    }\n\n    public void handleException1DF(@Handles ExceptionEvent<Exceptions.Exception1> event)\n    {\n        executionOrder.add(8);\n    }\n\n    public static List<Integer> getExecutionorder()\n    {\n        return executionOrder;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/traversal/Exceptions.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.traversal;\n\npublic class Exceptions\n{\n    public static class Exception1 extends Exception\n    {\n        private static final long serialVersionUID = 3748419159086636984L;\n\n        public Exception1(Throwable cause)\n        {\n            super(cause);\n        }\n    }\n\n    public static class Exception2 extends Exception\n    {\n        private static final long serialVersionUID = 7151417049655860515L;\n\n        public Exception2(Throwable cause)\n        {\n            super(cause);\n        }\n    }\n\n    public static class Exception3Super extends Exception\n    {\n        private static final long serialVersionUID = 1886009541068471679L;\n    }\n\n    public static class Exception3 extends Exception3Super\n    {\n        private static final long serialVersionUID = -7924704072611802705L;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/traversal/TraversalPathTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.impl.exception.control.traversal;\n\nimport org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport static org.junit.Assert.assertArrayEquals;\n\n@RunWith(Arquillian.class)\npublic class TraversalPathTest\n{\n    @Inject\n    private BeanManager manager;\n\n    @Deployment\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"traversalPath.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addPackage(TraversalPathTest.class.getPackage());\n    }\n\n    /**\n     * Tests SEAMCATCH-32, see JIRA for more information about this test. https://issues.jboss.org/browse/SEAMCATCH-32\n     */\n    @Test\n    public void testTraversalPathOrder()\n    {\n        // create an exception stack E1 -> E2 -> E3\n        Exceptions.Exception1 exception = new Exceptions.Exception1(new\n                Exceptions.Exception2(new Exceptions.Exception3()));\n\n        manager.fireEvent(new ExceptionToCatchEvent(exception));\n\n        /*\n            handleException3SuperclassBF\n            handleException3BF\n            handleException3DF\n            handleException3SuperclassDF\n            handleException2BF\n            handleException2DF\n            handleException1BF\n            handleException1DF\n        */\n        Object[] expectedOrder = {1, 2, 3, 4, 5, 6, 7, 8};\n        assertArrayEquals(expectedOrder, ExceptionHandlerMethods.getExecutionorder().toArray());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class SimpleRegistrationEarFileTest extends SimpleRegistrationTest\n{\n    public static final String CONFIG = \"deltaspike.bean-manager.delegate_lookup=false\\n\"; // Weld3 bug :(\n\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = SimpleRegistrationWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive configJar = ShrinkWrap.create(JavaArchive.class, \"registrationConfig.jar\")\n            .addAsManifestResource(new StringAsset(CONFIG),\n                \"apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsLibrary(configJar)\n                .addAsModule(SimpleRegistrationWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathResourceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.resourceloader;\n\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResource;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.List;\nimport java.util.Properties;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ClasspathResourceTest\n{\n    @Deployment\n    public static Archive<?> createResourceLoaderArchive()\n    {\n        Archive<?> arch = ShrinkWrap.create(WebArchive.class, ClasspathResourceTest.class.getSimpleName() + \".war\")\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive());\n        return arch;\n    }\n\n    @Inject\n    @InjectableResource(location=\"myconfig.properties\")\n    private InputStream inputStream;\n\n    @Inject\n    @InjectableResource(location=\"myconfig.properties\")\n    private Properties properties;\n\n\n    @Test\n    public void testInputStream() throws IOException\n    {\n        Assert.assertNotNull(inputStream);\n        Properties p = new Properties();\n        p.load(inputStream);\n        Assert.assertEquals(\"somevalue\", p.getProperty(\"some.propertykey\", \"wrong answer\"));\n    }\n\n    @Test\n    public void testProperties()\n    {\n        Assert.assertEquals(\"somevalue\",\n            properties.getProperty(\"some.propertykey\", \"wrong answer\"));\n    }\n\n    @Test\n    public void testAmbiguousFileLookup(@InjectableResource(location=\"META-INF/beans.xml\") InputStream inputStream)\n    {\n        // for some reason, this works\n        Assert.assertNull(inputStream);\n    }\n\n    @Test\n    public void testSuccessfulAmbiguousLookup(@InjectableResource(location=\"META-INF/beans.xml\") List<InputStream> inputStreams)\n    {\n        Assert.assertTrue(inputStreams.size() > 1); //the count is different on as7 compared to the standalone setup\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathWebProfileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.resourceloader;\n\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResource;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.List;\nimport java.util.Properties;\n\n/**\n * web profile will run in a separate JVM, as a result need to manually add the properties to the archive.\n */\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ClasspathWebProfileTest\n{\n    @Deployment\n    public static Archive<?> createResourceLoaderArchive()\n    {\n        Archive<?> arch = ShrinkWrap.create(WebArchive.class, ClasspathWebProfileTest.class.getSimpleName() + \".war\")\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addAsResource(new StringAsset(\"some.propertykey = somevalue\"), \"myconfig.properties\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive());\n        return arch;\n    }\n\n    @Inject\n    @InjectableResource(location=\"myconfig.properties\")\n    private InputStream inputStream;\n\n    @Inject\n    @InjectableResource(location=\"myconfig.properties\")\n    private Properties properties;\n\n    @Test\n    public void testInputStream() throws IOException\n    {\n        Assert.assertNotNull(inputStream);\n        Properties p = new Properties();\n        p.load(inputStream);\n        Assert.assertEquals(\"somevalue\", p.getProperty(\"some.propertykey\", \"wrong answer\"));\n    }\n\n    @Test\n    public void testProperties()\n    {\n        Assert.assertEquals(\"somevalue\",\n                properties.getProperty(\"some.propertykey\", \"wrong answer\"));\n    }\n\n    @Test\n    public void testAmbiguousFileLookup(@InjectableResource(location=\"META-INF/beans.xml\") InputStream inputStream)\n    {\n        Assert.assertNull(inputStream); // for some reason, this works, exception no longer thrown.\n    }\n\n    @Test\n    public void testSuccessfulAmbiguousLookup(@InjectableResource(location=\"META-INF/beans.xml\") List<InputStream> inputStreams)\n    {\n        Assert.assertTrue(inputStreams.size() > 1); //the count is different on as7 compared to the standalone setup\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/FileResourceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.resourceloader;\n\nimport org.apache.deltaspike.core.api.resourceloader.InjectableResource;\nimport org.apache.deltaspike.core.api.resourceloader.FileResourceProvider;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Properties;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class FileResourceTest\n{\n    private boolean created = false;\n    @Before\n    public void createTempFile()\n    {\n        if (!created)\n        {\n            File tmpDir = new File(\"target\");\n            try\n            {\n                File dest = new File(tmpDir,\"/propsdsfileresource.properties\");\n                FileWriter fw = new FileWriter(dest);\n                fw.write(\"some.propertykey=somevalue\");\n                fw.close();\n                dest.deleteOnExit();\n            }\n            catch (IOException e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n            finally\n            {\n                created = true;\n            }\n        }\n    }\n\n    @Deployment\n    public static Archive<?> createResourceLoaderArchive()\n    {\n        Archive<?> arch = ShrinkWrap.create(WebArchive.class, FileResourceTest.class.getSimpleName() + \".war\")\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive());\n        return arch;\n    }\n\n    @Test\n    public void testInputStream(@InjectableResource(resourceProvider = FileResourceProvider.class,\n            location=\"target/propsdsfileresource.properties\")\n            InputStream inputStream) throws IOException\n    {\n        Assert.assertNotNull(inputStream);\n        Properties p = new Properties();\n        p.load(inputStream);\n        Assert.assertEquals(\"somevalue\", p.getProperty(\"some.propertykey\", \"wrong answer\"));\n    }\n\n    @Test\n    public void testProperties(@InjectableResource(resourceProvider = FileResourceProvider.class,\n            location=\"target/propsdsfileresource.properties\")\n            Properties properties)\n    {\n        Assert.assertEquals(\"somevalue\", properties.getProperty(\"some.propertykey\", \"wrong answer\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/obsolete/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.util;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class JndiUtilsEarFileTest extends JndiUtilsTest\n{\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = JndiUtilsWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(JndiUtilsWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.core</groupId>\n        <artifactId>core-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.core</groupId>\n    <artifactId>deltaspike-core-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Core-Implementation</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.core.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.core.impl.*,\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\",\n            org.ops4j.pax.cdi.extension; filter:=\"(extension=deltaspike-core-api)\"\n        </deltaspike.osgi.require.capability>\n        <deltaspike.osgi.provide.capability>\n            org.ops4j.pax.cdi.extension; extension=deltaspike-core-impl\n        </deltaspike.osgi.provide.capability>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>test-utils</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <!-- Allows to create beans.xml files with certain content -->        \n        <dependency>\n            <groupId>org.jboss.shrinkwrap.descriptors</groupId>\n            <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-jar-plugin</artifactId>\n                <configuration>\n                    <archive>\n                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>\n                    </archive>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/activation/DefaultClassDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.activation;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * This is a default implementation of ClassDeactivator which uses {@see ConfigSource} to resolve configuration options\n * for whether a class is active or not.\n *\n * By design, this is not a well performant implementation.  It is a useful utility to avoid implementing the interface\n * manually and may be an easy way to spin up test archives with some classes purposefully disabled.\n */\npublic class DefaultClassDeactivator implements ClassDeactivator\n{\n    public static final String KEY_PREFIX = \"deactivate.\";\n\n    private static final Logger LOG = Logger.getLogger(DefaultClassDeactivator.class.getName());\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        final String key = KEY_PREFIX + targetClass.getName();\n        final String value = ConfigResolver.getPropertyValue(key);\n        if (value == null)\n        {\n            return null;\n        }\n        else\n        {\n            if (LOG.isLoggable(Level.FINE))\n            {\n                LOG.log(Level.FINE, \"Deactivation setting for {0} found to be {1} based on configuration.\",\n                        new Object[]{key, value});\n            }\n            return !Boolean.valueOf(value);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/BaseConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\n\n/**\n * Base class for all our ConfigSources\n */\npublic abstract class BaseConfigSource implements ConfigSource\n{\n    protected Logger log = Logger.getLogger(getClass().getName());\n\n    private int ordinal = 1000; // default\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public int getOrdinal()\n    {\n        return ordinal;\n    }\n\n    /**\n     * Init method e.g. for initializing the ordinal.\n     * This method can be used from a subclass to determine\n     * the ordinal value\n     * @param defaultOrdinal the default value for the ordinal if not set via configuration\n     */\n    protected void initOrdinal(int defaultOrdinal)\n    {\n        ordinal = defaultOrdinal;\n\n        String configuredOrdinalString = getPropertyValue(ConfigSource.DELTASPIKE_ORDINAL);\n\n        try\n        {\n            if (configuredOrdinalString != null)\n            {\n                ordinal = Integer.parseInt(configuredOrdinalString.trim());\n            }\n        }\n        catch (NumberFormatException e)\n        {\n            log.log(Level.WARNING,\n                    \"The configured config-ordinal isn't a valid integer. Invalid value: \" + configuredOrdinalString);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigHelperImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\n\npublic class ConfigHelperImpl implements ConfigResolver.ConfigHelper\n{\n\n    @Override\n    public Set<String> diffConfig(Map<String, String> oldValues, Map<String, String> newValues)\n    {\n        if (oldValues == null)\n        {\n            oldValues = Collections.emptyMap();\n        }\n        if (newValues == null)\n        {\n            newValues = Collections.emptyMap();\n        }\n        Set<String> changedAttribs = new HashSet<>();\n        Set<String> oldKeys = new HashSet<>(oldValues.keySet());\n        for (Map.Entry<String, String> newPropEntry : newValues.entrySet())\n        {\n            String key = newPropEntry.getKey();\n            if (oldValues.containsKey(key))\n            {\n                if (compare(oldValues.get(key), newPropEntry.getValue()) != 0)\n                {\n                    changedAttribs.add(key);\n                }\n                oldKeys.remove(key);\n            }\n            else\n            {\n                changedAttribs.add(key);\n            }\n        }\n        changedAttribs.addAll(oldKeys);\n\n        return changedAttribs;\n    }\n\n    private int compare(String a, String b)\n    {\n        if (a == null && b == null)\n        {\n            return 0;\n        }\n        if (a != null)\n        {\n            return a.compareTo(b);\n        }\n        return 1;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.ConfigSnapshot;\nimport org.apache.deltaspike.core.impl.config.converter.BeanConverterFactory;\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.config.ConfigSourceProvider;\nimport org.apache.deltaspike.core.util.ServiceUtils;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.CopyOnWriteArrayList;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * The internal implementation of the Config interface\n */\npublic class ConfigImpl implements Config\n{\n    /**\n     * How many times should we at max retry to get multiple attributes in an atomic way.\n     */\n    public static final int MAX_CONFIG_RETRIES = 5;\n\n    private static final Logger LOG = Logger.getLogger(ConfigImpl.class.getName());\n\n\n    private final ClassLoader classLoader;\n\n    private ConfigSource[] configSources;\n    private List<ConfigFilter> configFilters;\n\n    // volatile to a.) make the read/write behave atomic and b.) guarantee multi-thread safety\n    private volatile long lastChanged = 0;\n\n    private BeanConverterFactory beanConverter;\n\n    public ConfigImpl(ClassLoader classLoader)\n    {\n        this.classLoader = classLoader;\n        this.beanConverter = new BeanConverterFactory();\n    }\n\n    /**\n     * Performs all the initialisation of the default\n     * ConfigSources, ConfigFilters, etc\n     */\n    void init()\n    {\n        List<ConfigSource> appConfigSources\n            = ServiceUtils.loadServiceImplementations(ConfigSource.class, false, classLoader);\n\n        List<ConfigSourceProvider> configSourceProviderServiceLoader\n            = ServiceUtils.loadServiceImplementations(ConfigSourceProvider.class, false, classLoader);\n\n        for (ConfigSourceProvider configSourceProvider : configSourceProviderServiceLoader)\n        {\n            appConfigSources.addAll(configSourceProvider.getConfigSources());\n        }\n        addConfigSources(appConfigSources);\n\n        if (LOG.isLoggable(Level.FINE))\n        {\n            for (ConfigSource cs : appConfigSources)\n            {\n                LOG.log(Level.FINE, \"Adding ordinal {0} ConfigSource {1}\",\n                        new Object[]{cs.getOrdinal(), cs.getConfigName()});\n            }\n        }\n\n        List<ConfigFilter> configFilters\n            = ServiceUtils.loadServiceImplementations(ConfigFilter.class, false, classLoader);\n        this.configFilters = new CopyOnWriteArrayList<>(configFilters);\n    }\n\n    /**\n     * Shuts down the Config.\n     * This will also close all ConfigSources and ConfigFilters which\n     * implment the {@link java.lang.AutoCloseable} interface.\n     */\n    void release()\n    {\n        for (ConfigSource configSource : configSources)\n        {\n            close(configSource);\n        }\n\n        for (ConfigFilter configFilter : configFilters)\n        {\n            close(configFilter);\n        }\n    }\n\n    private void close(Object o)\n    {\n        if (o instanceof AutoCloseable)\n        {\n            try\n            {\n                ((AutoCloseable) o).close();\n            }\n            catch (Exception e)\n            {\n                LOG.log(Level.INFO, \"Exception while closing \" + o.toString(), e);\n            }\n        }\n    }\n\n\n    @Override\n    public ConfigSource[] getConfigSources()\n    {\n        return configSources;\n    }\n\n    public BeanConverterFactory getBeanConverter()\n    {\n        return beanConverter;\n    }\n\n    @Override\n    public ConfigSnapshot snapshotFor(ConfigResolver.TypedResolver<?>... typedResolvers)\n    {\n        // we implement kind of optimistic Locking\n        // Means we try multiple time to resolve all the given values\n        // until the config didn't change inbetween.\n        for (int tries = 1; tries < MAX_CONFIG_RETRIES; tries++)\n        {\n            Map<ConfigResolver.TypedResolver<?>, Object> configValues = new HashMap<>();\n            long startReadLastChanged = lastChanged;\n            for (ConfigResolver.TypedResolver<?> typedResolver : typedResolvers)\n            {\n                configValues.put(typedResolver, typedResolver.getValue());\n            }\n\n            if (startReadLastChanged == lastChanged)\n            {\n                return new ConfigSnapshotImpl(configValues);\n            }\n        }\n\n        throw new IllegalStateException(\n                \"Could not resolve ConfigTransaction as underlying values are permanently changing!\");\n    }\n\n    @Override\n    public void addConfigSources(List<ConfigSource> configSourcesToAdd)\n    {\n        if (configSourcesToAdd == null || configSourcesToAdd.isEmpty())\n        {\n            return;\n        }\n\n        List<ConfigSource> allConfigSources = new ArrayList<>();\n        // start with all existing ConfigSources\n        if (this.configSources != null)\n        {\n            for (ConfigSource configSource : this.configSources)\n            {\n                allConfigSources.add(configSource);\n            }\n        }\n\n        for (ConfigSource configSourceToAdd : configSourcesToAdd)\n        {\n            configSourceToAdd.setOnAttributeChange(this::onAttributeChange);\n            allConfigSources.add(configSourceToAdd);\n        }\n\n        this.configSources = sortDescending(allConfigSources);\n    }\n\n    @Override\n    public List<ConfigFilter> getConfigFilters()\n    {\n        return Collections.unmodifiableList(configFilters);\n    }\n\n    @Override\n    public void addConfigFilter(ConfigFilter configFilter)\n    {\n        configFilters.add(configFilter);\n    }\n\n    @Override\n    public String filterConfigValue(String key, String value, boolean forLog)\n    {\n        String filteredValue = value;\n\n        for (ConfigFilter filter : configFilters)\n        {\n            filteredValue = forLog ?\n                    filter.filterValueForLog(key, filteredValue) :\n                    filter.filterValue(key, filteredValue);\n        }\n        return filteredValue;\n    }\n\n\n    @Override\n    public ConfigResolver.UntypedResolver<String> resolve(String name)\n    {\n        return new TypedResolverImpl(this, name);\n    }\n\n    private ConfigSource[] sortDescending(List<ConfigSource> configSources)\n    {\n        Collections.sort(configSources, new Comparator<ConfigSource>()\n        {\n            /**\n             * {@inheritDoc}\n             */\n            @Override\n            public int compare(ConfigSource configSource1, ConfigSource configSource2)\n            {\n                int o1 = configSource1.getOrdinal();\n                int o2 = configSource2.getOrdinal();\n                if (o1 == o2)\n                {\n                    return configSource1.getConfigName().compareTo(configSource2.getConfigName());\n                }\n                return (o1 > o2) ? -1 : 1;\n            }\n        });\n        return configSources.toArray(new ConfigSource[configSources.size()]);\n    }\n\n    public void onAttributeChange(Set<String> attributesChanged)\n    {\n        // this is to force an incremented lastChanged even on time glitches and fast updates\n        long newLastChanged = System.nanoTime();\n        lastChanged = lastChanged >= newLastChanged ? lastChanged++ : newLastChanged;\n    }\n\n    /**\n     * @return the nanoTime when the last change got reported by a ConfigSource\n     */\n    public long getLastChanged()\n    {\n        return lastChanged;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigProviderImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.util.ClassUtils;\n\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n/**\n */\npublic class ConfigProviderImpl implements ConfigResolver.ConfigProvider\n{\n    /**\n     * The content of this map will get lazily initiated and will hold the\n     * Configs for each WebApp/EAR, etc (thus the ClassLoader).\n     */\n    private static Map<ClassLoader, ConfigImpl> configs = new ConcurrentHashMap<>();\n\n    @Override\n    public Config getConfig()\n    {\n        ClassLoader cl = ClassUtils.getClassLoader(null);\n        return getConfig(cl);\n    }\n\n    @Override\n    public Config getConfig(ClassLoader cl)\n    {\n        ConfigImpl config = configs.get(cl);\n        if (config == null)\n        {\n            config = new ConfigImpl(cl);\n            config.init();\n            ConfigImpl oldConfig = configs.put(cl, config);\n            if (oldConfig != null)\n            {\n                config = oldConfig;\n            }\n        }\n        return config;\n    }\n\n    @Override\n    public void releaseConfig(ClassLoader cl)\n    {\n        ConfigImpl oldConfig = configs.remove(cl);\n        if (oldConfig != null)\n        {\n            oldConfig.release();\n        }\n\n        // And remove all the children as well.\n        // This will e.g happen in EAR scenarios\n        Iterator<Map.Entry<ClassLoader, ConfigImpl>> it = configs.entrySet().iterator();\n        while (it.hasNext())\n        {\n            Map.Entry<ClassLoader, ConfigImpl> cfgEntry = it.next();\n            if (isChildClassLoader(cl, cfgEntry.getKey()))\n            {\n                cfgEntry.getValue().release();\n                it.remove();\n            }\n        }\n    }\n\n    @Override\n    public ConfigResolver.ConfigHelper getHelper()\n    {\n        return new ConfigHelperImpl();\n    }\n\n    private boolean isChildClassLoader(ClassLoader configClassLoader, ClassLoader suspect)\n    {\n        ClassLoader suspectParentCl = suspect.getParent();\n        if (suspectParentCl == null)\n        {\n            return false;\n        }\n\n        if (suspectParentCl == configClassLoader)\n        {\n            return true;\n        }\n\n        return isChildClassLoader(configClassLoader, suspectParentCl);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigResolverContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nclass ConfigResolverContext\n{\n    static final ConfigResolverContext NONE = new ConfigResolverContext();\n\n    static final ConfigResolverContext EVAL_VARIABLES = new ConfigResolverContext().setEvaluateVariables(true);\n\n    static final ConfigResolverContext PROJECTSTAGE = new ConfigResolverContext().setProjectStageAware(true);\n\n    static final ConfigResolverContext PROJECTSTAGE_EVAL_VARIABLES = new ConfigResolverContext()\n                                                                            .setProjectStageAware(true)\n                                                                            .setEvaluateVariables(true);\n\n    private boolean projectStageAware;\n    private boolean evaluateVariables;\n    private boolean propertyAware;\n\n    ConfigResolverContext()\n    {\n    }\n    \n    ConfigResolverContext setEvaluateVariables(final boolean evaluateVariables)\n    {\n        this.evaluateVariables = evaluateVariables;\n        return this;\n    }   \n    \n    boolean isEvaluateVariables()\n    {\n        return evaluateVariables;\n    }\n\n    ConfigResolverContext setProjectStageAware(final boolean projectStageAware)\n    {\n        this.projectStageAware = projectStageAware;\n        return this;\n    }\n    \n    boolean isProjectStageAware()\n    {\n        return projectStageAware;\n    }\n\n    ConfigResolverContext setPropertyAware(final boolean propertyAware)\n    {\n        this.propertyAware = propertyAware;\n        return this;\n    }\n    \n    boolean isPropertyAware()\n    {\n        return propertyAware;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigSnapshotImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.ConfigSnapshot;\n\nimport java.util.Map;\n\npublic class ConfigSnapshotImpl implements ConfigSnapshot\n{\n    private final Map<ConfigResolver.TypedResolver<?>, Object> configValues;\n\n    public ConfigSnapshotImpl(Map<ConfigResolver.TypedResolver<?>, Object> configValues)\n    {\n        this.configValues = configValues;\n    }\n\n    public Map<ConfigResolver.TypedResolver<?>, Object> getConfigValues()\n    {\n        return configValues;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigurationExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Typed;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.AfterDeploymentValidation;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.BeforeShutdown;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\nimport jakarta.enterprise.inject.spi.ProcessBean;\nimport jakarta.enterprise.inject.spi.ProcessProducerMethod;\nimport javax.management.InstanceAlreadyExistsException;\nimport javax.management.InstanceNotFoundException;\nimport javax.management.MBeanServer;\nimport javax.management.ObjectName;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.management.ManagementFactory;\nimport java.lang.reflect.Proxy;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.Configuration;\nimport org.apache.deltaspike.core.api.config.Filter;\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\nimport org.apache.deltaspike.core.api.config.Source;\nimport org.apache.deltaspike.core.api.exclude.Exclude;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer;\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.config.ConfigValidator;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.apache.deltaspike.core.util.StringUtils;\n\n/**\n * This extension handles {@link org.apache.deltaspike.core.api.config.PropertyFileConfig}s\n * provided by users.\n */\npublic class ConfigurationExtension implements Extension, Deactivatable\n{\n    private static final Logger LOG = Logger.getLogger(ConfigurationExtension.class.getName());\n\n    private static final String CANNOT_CREATE_CONFIG_SOURCE_FOR_CUSTOM_PROPERTY_FILE_CONFIG =\n        \"Cannot create ConfigSource for custom property-file config \";\n\n    /**\n     * This is a trick for EAR scenarios in some containers.\n     * They e.g. boot up the shared EAR lib with the ear ClassLoader.\n     * Thus any {@link org.apache.deltaspike.core.api.config.PropertyFileConfig} configuration will just get\n     * activated for this very single EAR ClassLoader but <em>not</em> for all the webapps.\n     * But if I have a property file in a jar in the shared EAR lib then I most likely also like to get it\n     * if I call this from my webapp (TCCL).\n     * So we also automatically register all the PropertyFileConfigs we found in the 'parent BeanManager'\n     * as well.\n     */\n    private static Map<ClassLoader, List<Class<? extends PropertyFileConfig>>> detectedParentPropertyFileConfigs\n        = new ConcurrentHashMap<ClassLoader, List<Class<? extends PropertyFileConfig>>>();\n\n    private boolean isActivated = true;\n\n    private List<Class<? extends PropertyFileConfig>> propertyFileConfigClasses\n        = new ArrayList<Class<?  extends PropertyFileConfig>>();\n\n    private final Set<Type> dynamicConfigTypes = new HashSet<Type>();\n    private Bean<DynamicBeanProducer> dynamicProducer;\n\n    private final List<Bean<? extends ConfigSource>> cdiSources = new ArrayList<Bean<? extends ConfigSource>>();\n    private final List<Bean<? extends ConfigFilter>> cdiFilters = new ArrayList<Bean<? extends ConfigFilter>>();\n    private final List<Class<?>> dynamicConfigurationBeanClasses = new ArrayList<Class<?>>();\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    public static void registerConfigMBean()\n    {\n        String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);\n        if (appName != null && appName.length() > 0)\n        {\n            try\n            {\n                MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();\n\n                ClassLoader tccl = ClassUtils.getClassLoader(ConfigurationExtension.class);\n                DeltaSpikeConfigInfo cfgMBean = new DeltaSpikeConfigInfo(tccl);\n\n                ObjectName name = new ObjectName(\"deltaspike.config.\" + appName + \":type=DeltaSpikeConfig\");\n                mBeanServer.registerMBean(cfgMBean, name);\n            }\n            catch (InstanceAlreadyExistsException iae)\n            {\n                // all fine, the CfgBean got already registered.\n                // Most probably by the ServletConfigListener\n            }\n            catch (Exception e)\n            {\n                throw new RuntimeException(e);\n            }\n        }\n    }\n\n    public static void unRegisterConfigMBean(String appName)\n    {\n        if (appName != null && appName.length() > 0)\n        {\n            try\n            {\n                MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();\n\n                ObjectName name = new ObjectName(\"deltaspike.config.\" + appName + \":type=DeltaSpikeConfig\");\n\n                mBeanServer.unregisterMBean(name);\n            }\n            catch (InstanceNotFoundException infe)\n            {\n                // all ok, nothing to de-register it seems\n            }\n            catch (Exception e)\n            {\n                throw new RuntimeException(e);\n            }\n        }\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public void collectUserConfigSources(@Observes ProcessAnnotatedType<? extends PropertyFileConfig> pat)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        Class<? extends PropertyFileConfig> pcsClass = pat.getAnnotatedType().getJavaClass();\n        if (pcsClass.isAnnotation() ||\n            pcsClass.isInterface()  ||\n            pcsClass.isSynthetic()  ||\n            pcsClass.isArray()      ||\n            pcsClass.isEnum()         )\n        {\n            // we only like to add real classes\n            return;\n        }\n\n        if (pat.getAnnotatedType().isAnnotationPresent(Exclude.class))\n        {\n            // We only pick up PropertyFileConfigs if they are not excluded\n            // This can be the case for PropertyFileConfigs which are registered via java.util.ServiceLoader\n            return;\n        }\n\n        propertyFileConfigClasses.add(pcsClass);\n    }\n\n    public void findDynamicConfigurationBeans(@Observes ProcessAnnotatedType<?> pat)\n    {\n        if (!pat.getAnnotatedType().isAnnotationPresent(Configuration.class))\n        {\n            return;\n        }\n        final Class<?> javaClass = pat.getAnnotatedType().getJavaClass();\n        if (!javaClass.isInterface())\n        {\n            return;\n        }\n        dynamicConfigurationBeanClasses.add(javaClass);\n    }\n\n    public void findSources(@Observes ProcessBean<? extends ConfigSource> source)\n    {\n        if (!source.getAnnotated().isAnnotationPresent(Source.class))\n        {\n            return;\n        }\n        cdiSources.add(source.getBean());\n    }\n\n    public void findFilters(@Observes ProcessBean<? extends ConfigFilter> filter)\n    {\n        if (!filter.getAnnotated().isAnnotationPresent(Filter.class))\n        {\n            return;\n        }\n        cdiFilters.add(filter.getBean());\n    }\n\n    public void findDynamicProducer(@Observes ProcessProducerMethod<?, DynamicBeanProducer> processBean)\n    {\n        dynamicProducer = processBean.getBean();\n    }\n\n    public void collectDynamicTypes(@Observes ProcessBean<?> processBean)\n    {\n        for (final InjectionPoint ip : processBean.getBean().getInjectionPoints())\n        {\n            final ConfigProperty annotation = ip.getAnnotated().getAnnotation(ConfigProperty.class);\n            if (annotation == null || annotation.converter() == ConfigResolver.Converter.class)\n            {\n                continue;\n            }\n\n            dynamicConfigTypes.add(ip.getType());\n        }\n    }\n\n    public void addDynamicBeans(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager bm)\n    {\n        if (dynamicProducer != null && !dynamicConfigTypes.isEmpty())\n        {\n            afterBeanDiscovery.addBean(new DynamicBean(dynamicProducer, dynamicConfigTypes));\n        }\n        for (final Class<?> proxyType : dynamicConfigurationBeanClasses)\n        {\n            afterBeanDiscovery.addBean()\n                .types(proxyType, Object.class)\n                .qualifiers(Default.Literal.INSTANCE, Any.Literal.INSTANCE)\n                .scope(ApplicationScoped.class)\n                .id(\"DeltaSpikeConfiguration#\" + proxyType.getName())\n                .createWith(cc -> {\n                        // TODO: support partialbean binding? can make sense for virtual properties +\n                        //  would integrate with jcache\n                        // we'd need to add @PartialBeanBinding on a bean created from ConfigurationHandler\n                        // detection can just be a loadClass of this API\n                        // for now: waiting for user request for it\n                        final Class<?>[] api = new Class<?>[]{proxyType};\n                        final Configuration configuration = api[0].getAnnotation(Configuration.class);\n                        final long cacheFor = configuration.cacheFor();\n                        return Proxy.newProxyInstance(\n                            Thread.currentThread().getContextClassLoader(), api,\n                            new ProxyConfigurationLifecycle.ConfigurationHandler(\n                                cacheFor <= 0 ? -1 : configuration.cacheUnit().toMillis(cacheFor), configuration.prefix())\n                        );\n\n                    })\n                .beanClass(proxyType);\n        }\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public void registerUserConfigSources(@Observes AfterBeanDiscovery abd)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        // create a local copy with all the collected PropertyFileConfig\n        Set<Class<? extends PropertyFileConfig>> allPropertyFileConfigClasses\n            = new HashSet<Class<? extends PropertyFileConfig>>(this.propertyFileConfigClasses);\n\n        // now add any PropertyFileConfigs from a 'parent BeanManager'\n        // we start with the current TCCL\n        ClassLoader currentClassLoader = ClassUtils.getClassLoader(null);\n        addParentPropertyFileConfigs(currentClassLoader, allPropertyFileConfigClasses);\n\n        // now let's add our own PropertyFileConfigs to the detected ones.\n        // because maybe WE are a parent BeanManager ourselves!\n        if (!this.propertyFileConfigClasses.isEmpty())\n        {\n            detectedParentPropertyFileConfigs.put(currentClassLoader, this.propertyFileConfigClasses);\n        }\n\n        // collect all the ConfigSources from our PropertyFileConfigs\n        List<ConfigSource> configSources = new ArrayList<ConfigSource>();\n        for (Class<? extends PropertyFileConfig> propertyFileConfigClass : allPropertyFileConfigClasses)\n        {\n            configSources.addAll(createPropertyConfigSource(propertyFileConfigClass));\n        }\n        ConfigResolver.addConfigSources(configSources);\n\n        registerConfigMBean();\n\n        logConfiguration();\n    }\n\n    public void validateConfiguration(@Observes AfterDeploymentValidation adv)\n    {\n        List<ConfigSource> configSources = new ArrayList<ConfigSource>(cdiSources.size());\n        for (final Bean bean : cdiSources)\n        {\n            configSources.add(BeanProvider.getContextualReference(ConfigSource.class, bean));\n        }\n        ConfigResolver.addConfigSources(configSources);\n\n        for (final Bean bean : cdiFilters)\n        {\n            ConfigResolver.addConfigFilter(BeanProvider.getContextualReference(ConfigFilter.class, bean));\n        }\n\n        processConfigurationValidation(adv);\n    }\n\n    private void logConfiguration()\n    {\n        Boolean logConfig = ConfigResolver.resolve(ConfigResolver.DELTASPIKE_LOG_CONFIG).as(Boolean.class).getValue();\n        if (logConfig != null && logConfig && LOG.isLoggable(Level.INFO))\n        {\n            StringBuilder sb = new StringBuilder(1 << 16);\n\n            // first log out the config sources in descendent ordinal order\n            sb.append(\"ConfigSources: \");\n            ConfigSource[] configSources = ConfigResolver.getConfigSources();\n            for (int i = 0; i < configSources.length; i++)\n            {\n                ConfigSource configSource = configSources[i];\n                sb.append(\"\\n\\t\").append(configSource.getOrdinal()).append(\" - \").append(configSource.getConfigName())\n                    .append(\" (CS_\").append(i + 1).append(\")\");\n            }\n\n            // and all the entries in no guaranteed order\n            Map<String, String> allProperties = ConfigResolver.getAllProperties();\n            sb.append(\"\\n\\nConfigured Values:\");\n            for (Map.Entry<String, String> entry : allProperties.entrySet())\n            {\n                int fromConfigSource;\n\n                sb.append(\"\\n\\t\")\n                    .append(entry.getKey())\n                    .append(\" = \")\n                    .append(ConfigResolver.filterConfigValueForLog(entry.getKey(), entry.getValue()))\n                    .append(\" (\")\n                    .append(configuredIn(configSources, entry.getKey()))\n                    .append(\")\");\n            }\n\n            LOG.info(sb.toString());\n        }\n    }\n\n    private static String configuredIn(ConfigSource[] configSources, String key)\n    {\n        int foundInOrdinal = -1;\n        int foundInConfigSource = -1;\n\n        for (int i = 0; i < configSources.length; i++)\n        {\n            ConfigSource configSource = configSources[i];\n            if ((configSource.isScannable() && configSource.getProperties().containsKey(key) ||\n                 !configSource.isScannable() && StringUtils.isNotEmpty(configSource.getPropertyValue(key)))\n                && configSource.getOrdinal() > foundInOrdinal)\n            {\n                foundInConfigSource = i;\n                foundInOrdinal = configSource.getOrdinal();\n            }\n        }\n        return \"CS_\" + (foundInConfigSource + 1);\n    }\n\n    /**\n     * Add all registered PropertyFileConfigs which got picked up in a parent ClassLoader already\n     */\n    private void addParentPropertyFileConfigs(ClassLoader currentClassLoader,\n                                              Set<Class<? extends PropertyFileConfig>> propertyFileConfigClasses)\n    {\n        if (currentClassLoader.getParent() == null)\n        {\n            return;\n        }\n\n        for (Map.Entry<ClassLoader, List<Class<? extends PropertyFileConfig>>> classLoaderListEntry :\n                detectedParentPropertyFileConfigs.entrySet())\n        {\n            if (currentClassLoader.getParent().equals(classLoaderListEntry.getKey()))\n            {\n                // if this is the direct parent ClassLoader then lets add those PropertyFileConfigs.\n                propertyFileConfigClasses.addAll(classLoaderListEntry.getValue());\n\n                // even check further parents\n                addParentPropertyFileConfigs(classLoaderListEntry.getKey(), propertyFileConfigClasses);\n\n                // and be done. There can only be a single parent CL...\n                return;\n            }\n        }\n    }\n\n    /**\n     * This method triggers freeing of the ConfigSources.\n     */\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public void freeConfigSources(@Observes BeforeShutdown bs)\n    {\n        String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);\n        unRegisterConfigMBean(appName);\n\n        ConfigResolver.freeConfigSources();\n        detectedParentPropertyFileConfigs.remove(ClassUtils.getClassLoader(null));\n\n        // we also free the ClassDeactivationUtils cache\n        ClassDeactivationUtils.clearCache();\n    }\n\n    /**\n     * @return create an instance of the given {@link PropertyFileConfig} and return all it's ConfigSources.\n     */\n    private List<ConfigSource> createPropertyConfigSource(Class<? extends PropertyFileConfig> propertyFileConfigClass)\n    {\n        String fileName = \"\";\n        try\n        {\n            PropertyFileConfig propertyFileConfig = propertyFileConfigClass.newInstance();\n            fileName = propertyFileConfig.getPropertyFileName();\n            EnvironmentPropertyConfigSourceProvider environmentPropertyConfigSourceProvider\n                = new EnvironmentPropertyConfigSourceProvider(fileName, propertyFileConfig.isOptional());\n\n            return environmentPropertyConfigSourceProvider.getConfigSources();\n        }\n        catch (InstantiationException e)\n        {\n            throw new RuntimeException(CANNOT_CREATE_CONFIG_SOURCE_FOR_CUSTOM_PROPERTY_FILE_CONFIG +\n                propertyFileConfigClass.getName(), e);\n        }\n        catch (IllegalAccessException e)\n        {\n            throw new RuntimeException(CANNOT_CREATE_CONFIG_SOURCE_FOR_CUSTOM_PROPERTY_FILE_CONFIG +\n                    propertyFileConfigClass.getName(), e);\n        }\n        catch (IllegalStateException e)\n        {\n            throw new IllegalStateException(\n                propertyFileConfigClass.getName() + \" points to an invalid file: '\" + fileName + \"'\", e);\n        }\n    }\n\n    protected void processConfigurationValidation(AfterDeploymentValidation adv)\n    {\n        for (ConfigValidator configValidator : ServiceUtils.loadServiceImplementations(ConfigValidator.class))\n        {\n            Set<String> violations = configValidator.processValidation();\n\n            if (violations == null)\n            {\n                continue;\n            }\n\n            for (String violation : violations)\n            {\n                adv.addDeploymentProblem(new IllegalStateException(violation));\n            }\n        }\n    }\n\n    @ApplicationScoped\n    @Typed(DynamicBeanProducer.class) // used as an internal bean\n    static class DynamicBeanProducer extends BaseConfigPropertyProducer\n    {\n        @Produces\n        @ConfigProperty(name = \"ignored\")\n        public Object create(final InjectionPoint ip)\n        {\n            return super.getUntypedPropertyValue(ip, ip.getType());\n        }\n    }\n\n    @Vetoed\n    private static final class DynamicBean<T> implements Bean<T>\n    {\n        private final Bean<T> producer;\n        private final Set<Type> types;\n\n        private DynamicBean(final Bean<T> producer, final Set<Type> types)\n        {\n            this.producer = producer;\n            this.types = types;\n        }\n\n        @Override\n        public Set<Type> getTypes()\n        {\n            return types;\n        }\n\n        /**\n         * this method got dumped in EE10, but still exists in EE9\n         */\n        public boolean isNullable()\n        {\n            return true;\n        }\n\n        @Override\n        public Set<Annotation> getQualifiers()\n        {\n            return producer.getQualifiers();\n        }\n\n        @Override\n        public Class<? extends Annotation> getScope()\n        {\n            return producer.getScope();\n        }\n\n        @Override\n        public String getName()\n        {\n            return producer.getName();\n        }\n\n        @Override\n        public Set<InjectionPoint> getInjectionPoints()\n        {\n            return producer.getInjectionPoints();\n        }\n\n        @Override\n        public Class<?> getBeanClass()\n        {\n            return producer.getBeanClass();\n        }\n\n        @Override\n        public Set<Class<? extends Annotation>> getStereotypes()\n        {\n            return producer.getStereotypes();\n        }\n\n        @Override\n        public boolean isAlternative()\n        {\n            return producer.isAlternative();\n        }\n\n        @Override\n        public T create(final CreationalContext<T> creationalContext)\n        {\n            return producer.create(creationalContext);\n        }\n\n        @Override\n        public void destroy(final T t, final CreationalContext<T> creationalContext)\n        {\n            producer.destroy(t, creationalContext);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/DefaultConfigPropertyProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer;\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.function.Supplier;\n\n/**\n * This class contains producer methods for injecting\n * configuration provided with the {@link ConfigProperty}\n * annotation.\n */\n@ApplicationScoped\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class DefaultConfigPropertyProducer extends BaseConfigPropertyProducer\n{\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public String produceStringConfiguration(InjectionPoint injectionPoint)\n    {\n        return getStringPropertyValue(injectionPoint);\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public Class produceClassConfiguration(InjectionPoint injectionPoint)\n    {\n        return getPropertyWithException(injectionPoint, Class.class);\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public Boolean produceBooleanConfiguration(InjectionPoint injectionPoint)\n    {\n        return getPropertyWithException(injectionPoint, Boolean.class);\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public Integer produceIntegerConfiguration(InjectionPoint injectionPoint)\n    {\n        return getPropertyWithException(injectionPoint, Integer.class);\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public Long produceLongConfiguration(InjectionPoint injectionPoint)\n    {\n        return getPropertyWithException(injectionPoint, Long.class);\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public Float produceFloatConfiguration(InjectionPoint injectionPoint)\n    {\n        return getPropertyWithException(injectionPoint, Float.class);\n\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignored\") // we actually don't need the name\n    public Double produceDoubleConfiguration(InjectionPoint injectionPoint)\n    {\n        return getPropertyWithException(injectionPoint, Double.class);\n    }\n\n    @Produces\n    @Dependent\n    @ConfigProperty(name = \"ignore\")\n    public <C> Supplier<C> produceConfigSupplier(InjectionPoint injectionPoint)\n    {\n        ConfigProperty configProperty = getAnnotation(injectionPoint, ConfigProperty.class);\n\n        if (configProperty == null)\n        {\n            throw new IllegalStateException(\"producer method called without @ConfigProperty being present!\");\n        }\n        final Type injectionPointType = injectionPoint.getType();\n        Type ipClass = null;\n        if (injectionPointType instanceof ParameterizedType && ((ParameterizedType) injectionPointType).getActualTypeArguments().length == 1)\n        {\n            ipClass = ((ParameterizedType) injectionPointType).getActualTypeArguments()[0];\n        }\n        else\n        {\n            throw new IllegalStateException(\"Supplier for Configuration must be a Parameterized Type\");\n        }\n\n        ConfigResolver.TypedResolver<C> resolver = asResolver(configProperty.name(),\n            configProperty.defaultValue(),\n            ipClass,\n            configProperty.converter(),\n            configProperty.parameterizedBy(),\n            configProperty.projectStageAware(),\n            configProperty.evaluateVariables());\n\n        if (configProperty.cacheFor() > 0)\n        {\n            resolver.cacheFor(configProperty.cacheUnit(), configProperty.cacheFor());\n        }\n\n        return () -> resolver.getValue();\n    }\n\n    private <T> T getPropertyWithException(InjectionPoint ip, Type ipCls)\n    {\n        try\n        {\n            return getUntypedPropertyValue(ip, ipCls);\n        }\n        catch (RuntimeException rte)\n        {\n            ConfigProperty configProperty = getAnnotation(ip, ConfigProperty.class);\n            throw new RuntimeException(\"Error while converting property '\" + configProperty.name() +\n                    \"' happening in bean \" + ip.getBean(), rte);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/DefaultConfigSourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.config.ConfigSourceProvider;\nimport org.apache.deltaspike.core.util.ServiceUtils;\n\nimport java.io.File;\nimport java.net.MalformedURLException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * Default implementation which uses:\n * <ol>\n * <li>SystemPropertyConfigSource</li>\n * <li>EnvironmentPropertyConfigSource</li>\n * <li>LocalJndiConfigSource</li>\n * <li>PropertyFileConfigSource</li>\n * </ol>\n */\npublic class DefaultConfigSourceProvider implements ConfigSourceProvider\n{\n    private static final Logger LOG = Logger.getLogger(DefaultConfigSourceProvider.class.getName());\n\n    private static final String PROPERTY_FILE_NAME = \"apache-deltaspike.properties\";\n    private static final String PROPERTY_FILE_RESOURCE = \"META-INF/\" + PROPERTY_FILE_NAME;\n    private static final String PROPERTY_FILE_HOME_NAME = \"/.deltaspike/\" + PROPERTY_FILE_NAME;\n\n    private List<ConfigSource> configSources = new ArrayList<ConfigSource>();\n\n    /**\n     * Default constructor which adds the {@link ConfigSource} implementations which are supported by default\n     */\n    public DefaultConfigSourceProvider()\n    {\n        configSources.add(new SystemPropertyConfigSource());\n        configSources.add(new EnvironmentPropertyConfigSource());\n        configSources.add(new LocalJndiConfigSource());\n\n        addUserHomeConfigSource();\n\n        EnvironmentPropertyConfigSourceProvider epcsp =\n            new EnvironmentPropertyConfigSourceProvider(PROPERTY_FILE_RESOURCE, true);\n        configSources.addAll(epcsp.getConfigSources());\n\n        registerPropertyFileConfigs();\n    }\n\n\n    /**\n     * Add a ConfigSource for files in the user home folder IF it exists!\n     * The location is ~/.deltaspike/apache-deltaspike.properties\n     */\n    private void addUserHomeConfigSource()\n    {\n        String userHome = System.getProperty(\"user.home\");\n        if (userHome != null && !userHome.isEmpty())\n        {\n            File dsHome = new File(userHome, PROPERTY_FILE_HOME_NAME);\n            try\n            {\n                if (dsHome.exists())\n                {\n                    try\n                    {\n                        ConfigSource dsHomeConfigSource = new PropertyFileConfigSource(dsHome.toURI().toURL());\n                        configSources.add(dsHomeConfigSource);\n                        LOG.log(Level.INFO, \"Reading configuration from {0}\", dsHome.getAbsolutePath());\n                    }\n                    catch (MalformedURLException e)\n                    {\n                        LOG.log(Level.WARNING, \"Could not read configuration from \" + dsHome.getAbsolutePath(), e);\n                    }\n\n                }\n            }\n            catch (SecurityException se)\n            {\n                LOG.log(Level.INFO, \"Not allowed to check if directory {0} exists\", dsHome.getPath());\n            }\n        }\n    }\n\n\n    /**\n     * Load all {@link PropertyFileConfig}s which are registered via\n     * {@code java.util.ServiceLoader}.\n     */\n    private void registerPropertyFileConfigs()\n    {\n        List<? extends PropertyFileConfig> propertyFileConfigs =\n                ServiceUtils.loadServiceImplementations(PropertyFileConfig.class);\n        for (PropertyFileConfig propertyFileConfig : propertyFileConfigs)\n        {\n            EnvironmentPropertyConfigSourceProvider environmentPropertyConfigSourceProvider\n                = new EnvironmentPropertyConfigSourceProvider(propertyFileConfig.getPropertyFileName(),\n                    propertyFileConfig.isOptional());\n\n            configSources.addAll(environmentPropertyConfigSourceProvider.getConfigSources());\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public List<ConfigSource> getConfigSources()\n    {\n        return configSources;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/DeltaSpikeConfigInfo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport javax.management.openmbean.CompositeDataSupport;\nimport javax.management.openmbean.CompositeType;\nimport javax.management.openmbean.OpenDataException;\nimport javax.management.openmbean.OpenType;\nimport javax.management.openmbean.SimpleType;\nimport javax.management.openmbean.TabularData;\nimport javax.management.openmbean.TabularDataSupport;\nimport javax.management.openmbean.TabularType;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\n\n/**\n * JMX MBean for DeltaSpike\n */\npublic class DeltaSpikeConfigInfo implements DeltaSpikeConfigInfoMBean\n{\n    private final ClassLoader appConfigClassLoader;\n\n    public DeltaSpikeConfigInfo(ClassLoader appConfigClassLoader)\n    {\n        this.appConfigClassLoader = appConfigClassLoader;\n    }\n\n    @Override\n    public String[] getConfigSourcesAsString()\n    {\n        ClassLoader originalCl = Thread.currentThread().getContextClassLoader();\n        try\n        {\n            Thread.currentThread().setContextClassLoader(appConfigClassLoader);\n\n            ConfigSource[] configSources = ConfigResolver.getConfigSources();\n            List<String> configSourceInfo = new ArrayList<String>();\n            for (ConfigSource configSource : configSources)\n            {\n                configSourceInfo.add(Integer.toString(configSource.getOrdinal())\n                    + \" - \" + configSource.getConfigName());\n            }\n\n            return configSourceInfo.toArray(new String[configSourceInfo.size()]);\n        }\n        finally\n        {\n            // set back the original TCCL\n            Thread.currentThread().setContextClassLoader(originalCl);\n        }\n\n    }\n\n    @Override\n    public String[] getConfigEntriesAsString()\n    {\n        ClassLoader originalCl = Thread.currentThread().getContextClassLoader();\n        try\n        {\n            Thread.currentThread().setContextClassLoader(appConfigClassLoader);\n\n            List<ConfigEntry> configEntries = calculateConfigEntries();\n\n            String[] configArray = new String[configEntries.size()];\n\n            for (int i = 0 ; i < configEntries.size(); i++)\n            {\n                ConfigEntry configEntry = configEntries.get(i);\n                configArray[i] = configEntry.getKey() + \" = \" + configEntry.getValue()\n                    + \" - picked up from: \" + configEntry.getFromConfigSource();\n            }\n\n            return configArray;\n\n        }\n        finally\n        {\n            // set back the original TCCL\n            Thread.currentThread().setContextClassLoader(originalCl);\n        }\n    }\n\n    @Override\n    public TabularData getConfigEntries()\n    {\n        ClassLoader originalCl = Thread.currentThread().getContextClassLoader();\n        try\n        {\n            Thread.currentThread().setContextClassLoader(appConfigClassLoader);\n\n            List<ConfigEntry> configEntries = calculateConfigEntries();\n\n            String[] configArray = new String[configEntries.size()];\n\n            for (int i = 0 ; i < configEntries.size(); i++)\n            {\n                ConfigEntry configEntry = configEntries.get(i);\n                configArray[i] = configEntry.getKey() + \" = \" + configEntry.getValue()\n                    + \" - picked up from: \" + configEntry.getFromConfigSource();\n            }\n\n            String typeName = \"ConfigEntries\";\n            OpenType<?>[] types = new OpenType<?>[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING};\n            String[] keys = new String[]{\"Key\", \"Value\", \"fromConfigSource\"};\n\n            CompositeType ct = new CompositeType(typeName, typeName, keys, keys, types);\n            TabularType type = new TabularType(typeName, typeName, ct, keys);\n            TabularDataSupport configEntryInfo = new TabularDataSupport(type);\n\n            ConfigSource[] configSources = ConfigResolver.getConfigSources();\n            for (ConfigEntry configEntry : configEntries)\n            {\n                configEntryInfo.put(\n                    new CompositeDataSupport(ct, keys,\n                        new Object[]{configEntry.getKey(), configEntry.getValue(), configEntry.getFromConfigSource()}));\n            }\n\n            return configEntryInfo;\n        }\n        catch (OpenDataException e)\n        {\n            throw new RuntimeException(e);\n        }\n        finally\n        {\n            // set back the original TCCL\n            Thread.currentThread().setContextClassLoader(originalCl);\n        }\n    }\n\n    @Override\n    public TabularData getConfigSources()\n    {\n        ClassLoader originalCl = Thread.currentThread().getContextClassLoader();\n        try\n        {\n            Thread.currentThread().setContextClassLoader(appConfigClassLoader);\n\n            String typeName = \"ConfigSources\";\n            OpenType<?>[] types = new OpenType<?>[]{SimpleType.INTEGER, SimpleType.STRING};\n            String[] keys = new String[]{\"Ordinal\", \"ConfigSource\"};\n\n            CompositeType ct = new CompositeType(typeName, typeName, keys, keys, types);\n            TabularType type = new TabularType(typeName, typeName, ct, keys);\n            TabularDataSupport configSourceInfo = new TabularDataSupport(type);\n\n            ConfigSource[] configSources = ConfigResolver.getConfigSources();\n            for (ConfigSource configSource : configSources)\n            {\n                configSourceInfo.put(\n                    new CompositeDataSupport(ct, keys,\n                            new Object[]{configSource.getOrdinal(), configSource.getConfigName()}));\n            }\n\n            return configSourceInfo;\n        }\n        catch (OpenDataException e)\n        {\n            throw new RuntimeException(e);\n        }\n        finally\n        {\n            // set back the original TCCL\n            Thread.currentThread().setContextClassLoader(originalCl);\n        }\n    }\n\n    private List<ConfigEntry> calculateConfigEntries()\n    {\n        Map<String, String> allProperties = ConfigResolver.getAllProperties();\n        List<ConfigEntry> configEntries = new ArrayList<ConfigEntry>(allProperties.size());\n        ConfigSource[] configSources = ConfigResolver.getConfigSources();\n\n        for (Map.Entry<String, String> configEntry : allProperties.entrySet())\n        {\n            String key = configEntry.getKey();\n            String value = ConfigResolver.filterConfigValueForLog(key,\n                                    ConfigResolver.getProjectStageAwarePropertyValue(key));\n\n            String fromConfigSource = getFromConfigSource(configSources, key);\n            configEntries.add(new ConfigEntry(key, value, fromConfigSource));\n        }\n\n        return configEntries;\n    }\n\n    private String getFromConfigSource(ConfigSource[] configSources, String key)\n    {\n        for (ConfigSource configSource : configSources)\n        {\n            if (configSource.getPropertyValue(key) != null)\n            {\n                return configSource.getConfigName();\n            }\n        }\n\n        return null;\n    }\n\n\n\n    private class ConfigEntry\n    {\n        private final String key;\n        private final String value;\n        private final String fromConfigSource;\n\n        ConfigEntry(String key, String value, String fromConfigSource)\n        {\n            this.key = key;\n            this.value = value;\n            this.fromConfigSource = fromConfigSource;\n        }\n\n        String getKey()\n        {\n            return key;\n        }\n\n        String getValue()\n        {\n            return value;\n        }\n\n        String getFromConfigSource()\n        {\n            return fromConfigSource;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/DeltaSpikeConfigInfoMBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport javax.management.openmbean.TabularData;\n\npublic interface DeltaSpikeConfigInfoMBean\n{\n    String[] getConfigSourcesAsString();\n\n    TabularData getConfigSources();\n\n    String[] getConfigEntriesAsString();\n\n    TabularData getConfigEntries();\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/EnvironmentPropertyConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\n\n\n/**\n * {@link org.apache.deltaspike.core.spi.config.ConfigSource}\n * which uses {@link System#getenv()}\n *\n * We also allow to write underlines _ instead of dots _ in the\n * environment via export (unix) or SET (windows)\n */\nclass EnvironmentPropertyConfigSource extends MapConfigSource\n{\n\n    EnvironmentPropertyConfigSource()\n    {\n        super(System.getenv());\n        initOrdinal(300);\n    }\n\n    \n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String getConfigName()\n    {\n        return \"environment-properties\";\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        String val = super.getPropertyValue(key);\n        if (val == null || val.isEmpty())\n        {\n            val = super.getPropertyValue(key.replace('.', '_'));\n        }\n\n        return val;\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/EnvironmentPropertyConfigSourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport java.io.IOException;\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.Enumeration;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.config.ConfigSourceProvider;\nimport org.apache.deltaspike.core.util.PropertyFileUtils;\n\n/**\n * Register all property files with the given propertyFileName\n * as {@link ConfigSource}.\n */\nclass EnvironmentPropertyConfigSourceProvider implements ConfigSourceProvider\n{\n    private static final Logger LOG = Logger.getLogger(EnvironmentPropertyConfigSourceProvider.class.getName());\n\n    private List<ConfigSource> configSources = new ArrayList<ConfigSource>();\n\n    EnvironmentPropertyConfigSourceProvider(String propertyFileName, boolean optional)\n    {\n        try\n        {\n            Enumeration<URL> propertyFileUrls = PropertyFileUtils.resolvePropertyFiles(propertyFileName);\n\n            if (!optional && !propertyFileUrls.hasMoreElements())\n            {\n                throw new IllegalStateException(propertyFileName + \" wasn't found.\");\n            }\n\n            while (propertyFileUrls.hasMoreElements())\n            {\n                URL propertyFileUrl = propertyFileUrls.nextElement();\n\n                LOG.log(Level.INFO,\n                        \"Custom config found by DeltaSpike. Name: ''{0}'', URL: ''{1}''\",\n                        new Object[] {propertyFileName, propertyFileUrl});\n                configSources.add(new PropertyFileConfigSource(propertyFileUrl));\n            }\n        }\n        catch (IOException ioe)\n        {\n            throw new IllegalStateException(\"problem while loading DeltaSpike property files\", ioe);\n        }\n    }\n\n    @Override\n    public List<ConfigSource> getConfigSources()\n    {\n        return configSources;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/LocalJndiConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport jakarta.enterprise.inject.Vetoed;\n\nimport org.apache.deltaspike.core.impl.util.JndiUtils;\n\n/**\n * {@link org.apache.deltaspike.core.spi.config.ConfigSource}\n * which uses JNDI for the lookup\n */\n@Vetoed\nclass LocalJndiConfigSource extends BaseConfigSource\n{\n    private static final String BASE_NAME = \"java:comp/env/deltaspike/\";\n\n    LocalJndiConfigSource()\n    {\n        initOrdinal(200);\n    }\n\n    /**\n     * The given key gets used for a lookup via JNDI\n     *\n     * @param key for the property\n     * @return value for the given key or null if there is no configured value\n     */\n    @Override\n    public String getPropertyValue(String key)\n    {\n        try\n        {\n            return JndiUtils.lookup(getJndiKey(key), String.class);\n        }\n        catch (Exception e)\n        {\n            //do nothing it was just a try\n        }\n        return null;\n    }\n\n    private String getJndiKey(String key)\n    {\n        if (key.startsWith(\"java:comp/env\"))\n        {\n            return key;\n        }\n        return BASE_NAME + key;\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        Map<String, String> result = new HashMap<String, String>();\n        result.putAll(JndiUtils.list(BASE_NAME, String.class));\n        result.putAll(JndiUtils.list(\"java:comp/env\", String.class));\n        return result;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String getConfigName()\n    {\n        return BASE_NAME;\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/MapConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport java.util.Map;\n\n/**\n * Base class for configurations based on regular {@link Map}\n */\npublic abstract class MapConfigSource extends BaseConfigSource\n{\n\n    private final Map<String, String> map;\n\n    // only needed for some old Weld versions\n    public MapConfigSource()\n    {\n        map = null;\n    }\n\n    public MapConfigSource(Map<String, String> map)\n    {\n        this.map = map;\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        return map;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return map.get(key);\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/PropertiesConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Properties;\n\n/**\n * Base class for configuration sources based on a fixed {@link Properties} object.\n */\npublic abstract class PropertiesConfigSource extends BaseConfigSource\n{\n\n    private final Properties properties;\n\n    protected PropertiesConfigSource(Properties properties)\n    {\n        this.properties = properties;\n    }\n\n    /**\n     * The given key gets used for a lookup via a properties object\n     *\n     * @param key for the property\n     * @return value for the given key or null if there is no configured value\n     */\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return properties.getProperty(key);\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        Map<String,String> result = new HashMap<String, String>(properties.size());\n        for (String propertyName : properties.stringPropertyNames())\n        {\n            result.put(propertyName, properties.getProperty(propertyName));\n        }\n\n        return result;\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n}"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/PropertyFileConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.time.Instant;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.Set;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Consumer;\nimport java.util.logging.Level;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.util.PropertyFileUtils;\n\n/**\n * {@link org.apache.deltaspike.core.spi.config.ConfigSource} which uses\n * a fixed property file for the lookup.\n *\n * If the property file has a 'file://' protocol, we are able to pick up\n * changes during runtime when the underlying property file changes.\n * This does not make sense for property files in JARs, but makes perfect sense\n * whenever a property file URL is directly on the file system.\n */\npublic class PropertyFileConfigSource extends BaseConfigSource\n{\n    /**\n     * The name of a property which can be defined inside the property file\n     * to define the amount of seconds after which the property file should\n     * be tested for changes again.\n     * Note that the test is performed by storing the lastChanged attribute of the\n     * underlying file.\n     *\n     * By default the time after which we look for changes is {@link #RELOAD_PERIOD_DEFAULT}.\n     * This can be changed by explicitly adding a property with the name defined in {@link #RELOAD_PERIOD}\n     * which contains the number of seconds after which we try to reload again.\n     * A zero or negative value means no dynamic reloading.\n     * <pre>\n     * # look for changes after 60 seconds\n     * deltaspike_reload=60\n     * </pre>\n     * Whether the file got changed is determined by the lastModifiedDate of the underlying file.\n     * <p>\n     * You can disable the whole reloading with a negative reload time, e.g.\n     * <pre>\n     * deltaspike_reload=-1\n     * </pre>\n     */\n    public static final String RELOAD_PERIOD = \"deltaspike_reload\";\n    public static final int RELOAD_PERIOD_DEFAULT = 300;\n\n    private final ConfigResolver.ConfigHelper configHelper;\n\n    /**\n     * currently loaded config properties.\n     */\n    private Map<String, String> properties;\n\n    private final URL propertyFileUrl;\n    private String filePath;\n\n    private int reloadAllSeconds = RELOAD_PERIOD_DEFAULT;\n    private Instant fileLastModified = null;\n\n    /**\n     * Reload after that time in seconds.\n     */\n    private int reloadAfterSec;\n\n    private Consumer<Set<String>> reportAttributeChange;\n\n    public PropertyFileConfigSource(URL propertyFileUrl)\n    {\n        this.propertyFileUrl = propertyFileUrl;\n        filePath = propertyFileUrl.toExternalForm();\n\n        this.properties = toMap(PropertyFileUtils.loadProperties(propertyFileUrl));\n\n        if (isFile(propertyFileUrl))\n        {\n\n            calculateReloadTime();\n            if (reloadAllSeconds < 0 )\n            {\n                configHelper = null;\n            }\n            else\n            {\n                fileLastModified = getLastModified();\n                configHelper = ConfigResolver.getConfigProvider().getHelper();\n                reloadAfterSec = getNowSeconds() + reloadAllSeconds;\n            }\n        }\n        else\n        {\n            configHelper = null;\n        }\n\n        initOrdinal(100);\n    }\n\n    private void calculateReloadTime()\n    {\n        final String reloadPeriod = properties.get(RELOAD_PERIOD);\n        if (reloadPeriod != null)\n        {\n            try\n            {\n                int reload = Integer.parseInt(reloadPeriod);\n                if (reload < 0)\n                {\n                    fileLastModified = null;\n                    log.info(\"Disable dynamic reloading for ConfigSource \" + filePath);\n                }\n                else\n                {\n                    reloadAllSeconds = reload;\n                }\n            }\n            catch (NumberFormatException nfe)\n            {\n                log.warning(\"Wrong value for \" + RELOAD_PERIOD + \" property: \" + reloadPeriod +\n                    \". Must be numeric in seconds. Using default \" + RELOAD_PERIOD_DEFAULT);\n                reloadAllSeconds = RELOAD_PERIOD_DEFAULT;\n            }\n        }\n    }\n\n    protected Map<String, String> toMap(Properties properties)\n    {\n        Map<String,String> result = new HashMap<>(properties.size());\n        for (String propertyName : properties.stringPropertyNames())\n        {\n            result.put(propertyName, properties.getProperty(propertyName));\n        }\n\n        return Collections.unmodifiableMap(result);\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        if (needsReload())\n        {\n            reloadProperties();\n        }\n\n        return properties;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        if (needsReload())\n        {\n            reloadProperties();\n        }\n\n        return properties.get(key);\n    }\n\n    private boolean needsReload()\n    {\n        if (fileLastModified != null && getNowSeconds() > reloadAfterSec)\n        {\n            final Instant newLastModified = getLastModified();\n            if (newLastModified != null && newLastModified.isAfter(fileLastModified))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    private synchronized void reloadProperties()\n    {\n        // another thread might have already updated the properties.\n        if (needsReload())\n        {\n            final Map<String, String> newProps = toMap(PropertyFileUtils.loadProperties(propertyFileUrl));\n\n            final Set<String> modfiedAttributes = configHelper.diffConfig(properties, newProps);\n            if (!modfiedAttributes.isEmpty())\n            {\n                reportAttributeChange.accept(modfiedAttributes);\n            }\n\n            this.properties = newProps;\n\n            fileLastModified = getLastModified();\n\n            calculateReloadTime();\n            reloadAfterSec = getNowSeconds() + reloadAllSeconds;\n        }\n    }\n\n    private int getNowSeconds()\n    {\n        // this might overrun all 100 years or so.\n        // I think we can live with a faster reload all 100 years\n        // if we can spare needing to deal with atomic updates ;)\n        return (int) TimeUnit.NANOSECONDS.toSeconds(System.nanoTime());\n    }\n\n    private Instant getLastModified()\n    {\n        try\n        {\n            return Files.getLastModifiedTime(Paths.get(propertyFileUrl.toURI())).toInstant();\n        }\n        catch (Exception e)\n        {\n            log.log(Level.WARNING,\n                \"Cannot dynamically reload property file {0}. Not able to read last modified date\", filePath);\n            return null;\n        }\n    }\n\n    private boolean isFile(URL propertyFileUrl)\n    {\n        return \"file\".equalsIgnoreCase(propertyFileUrl.getProtocol());\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String getConfigName()\n    {\n        return filePath;\n    }\n\n    @Override\n    public void setOnAttributeChange(Consumer<Set<String>> reportAttributeChange)\n    {\n        this.reportAttributeChange = reportAttributeChange;\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ProxyConfigurationLifecycle.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\n\nimport static java.util.concurrent.TimeUnit.MILLISECONDS;\n\nclass ProxyConfigurationLifecycle\n{\n\n    static final class ConfigurationHandler implements InvocationHandler\n    {\n        private final BaseConfigPropertyProducer delegate = new BaseConfigPropertyProducer()\n        {\n        };\n\n        private final ConcurrentMap<Method, Supplier<?>> resolvers =\n                new ConcurrentHashMap<Method, Supplier<?>>();\n        private final long cacheMs;\n        private final String prefix;\n\n        ConfigurationHandler(final long cacheMs, final String prefix)\n        {\n            this.cacheMs = cacheMs;\n            this.prefix = prefix;\n        }\n\n        @Override\n        public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable\n        {\n            if (Object.class == method.getDeclaringClass())\n            {\n                try\n                {\n                    return method.invoke(this, args);\n                }\n                catch (final InvocationTargetException ite)\n                {\n                    throw ite.getCause();\n                }\n            }\n\n            Supplier<?> supplier = resolvers.get(method);\n            if (supplier == null)\n            {\n                final ConfigProperty annotation = method.getAnnotation(ConfigProperty.class);\n                if (annotation == null)\n                {\n                    throw new UnsupportedOperationException(\n                            method + \" doesn't have @ConfigProperty and therefore is illegal\");\n                }\n\n                // handle primitive bridge there (cdi doesnt support primitives but no reason our proxies don't)\n                final Class<? extends ConfigResolver.Converter> converter = annotation.converter();\n\n                final Type genericReturnType = method.getGenericReturnType();\n                Class<?> returnType = method.getReturnType();\n                final boolean list;\n                final boolean set;\n                if (converter == ConfigResolver.Converter.class &&\n                        ParameterizedType.class.isInstance(genericReturnType))\n                {\n                    ParameterizedType pt = ParameterizedType.class.cast(genericReturnType);\n                    if (List.class == pt.getRawType() && pt.getActualTypeArguments().length == 1)\n                    {\n                        list = true;\n                        set = false;\n                        final Type arg = pt.getActualTypeArguments()[0];\n                        if (Class.class.isInstance(arg))\n                        {\n                            returnType = Class.class.cast(arg);\n                        }\n                    }\n                    else if (Set.class == pt.getRawType() && pt.getActualTypeArguments().length == 1)\n                    {\n                        list = false;\n                        set = true;\n                        final Type arg = pt.getActualTypeArguments()[0];\n                        if (Class.class.isInstance(arg))\n                        {\n                            returnType = Class.class.cast(arg);\n                        }\n                    }\n                    else\n                    {\n                        list = false;\n                        set = false;\n                    }\n                }\n                else\n                {\n                    list = false;\n                    set = false;\n\n                    if (int.class == returnType)\n                    {\n                        returnType = Integer.class;\n                    }\n                    else if (long.class == returnType)\n                    {\n                        returnType = Long.class;\n                    }\n                    else if (boolean.class == returnType)\n                    {\n                        returnType = Boolean.class;\n                    }\n                    else if (short.class == returnType)\n                    {\n                        returnType = Short.class;\n                    }\n                    else if (byte.class == returnType)\n                    {\n                        returnType = Byte.class;\n                    }\n                    else if (float.class == returnType)\n                    {\n                        returnType = Float.class;\n                    }\n                    else if (double.class == returnType)\n                    {\n                        returnType = Double.class;\n                    }\n                }\n\n                final String defaultValue = annotation.defaultValue();\n                ConfigResolver.TypedResolver<?> typedResolver = delegate.asResolver(\n                        prefix + annotation.name(), list || set ? ConfigProperty.NULL : defaultValue,\n                        returnType, converter, annotation.parameterizedBy(),\n                        annotation.projectStageAware(), annotation.evaluateVariables());\n\n                if (cacheMs > 0)\n                {\n                    typedResolver.cacheFor(MILLISECONDS, cacheMs);\n                }\n\n                if (list || set)\n                {\n                    ConfigResolver.TypedResolver<? extends List<?>> listTypedResolver = typedResolver.asList();\n                    final ConfigResolver.TypedResolver<? extends List<?>> resolver;\n                    if (!ConfigProperty.NULL.equals(defaultValue))\n                    {\n                        resolver = listTypedResolver.withStringDefault(defaultValue);\n                    }\n                    else\n                    {\n                        resolver = listTypedResolver;\n                    }\n\n                    if (list)\n                    {\n                        supplier = new DefaultSupplier(resolver);\n                    }\n                    else\n                    {\n                        supplier = new Supplier<Set<?>>()\n                        {\n                            @Override\n                            public Set<?> get()\n                            {\n                                return new HashSet(resolver.getValue());\n                            }\n                        };\n                    }\n                }\n                else\n                {\n                    supplier = new DefaultSupplier(typedResolver);\n                }\n\n                final Supplier<?> existing = resolvers.putIfAbsent(method, supplier);\n                if (existing != null)\n                {\n                    supplier = existing;\n                }\n            }\n            return supplier.get();\n        }\n    }\n\n    private interface Supplier<T>\n    {\n        T get();\n    }\n\n    private static class DefaultSupplier<T> implements Supplier<T>\n    {\n        private final ConfigResolver.TypedResolver<T> delegate;\n\n        private DefaultSupplier(final ConfigResolver.TypedResolver<T> delegate)\n        {\n            this.delegate = delegate;\n        }\n\n        @Override\n        public T get()\n        {\n            return delegate.getValue();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/SystemPropertyConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\n/**\n * {@link org.apache.deltaspike.core.spi.config.ConfigSource}\n * which uses {@link System#getProperties()}\n */\nclass SystemPropertyConfigSource extends PropertiesConfigSource\n{\n    SystemPropertyConfigSource()\n    {\n        super(System.getProperties());\n        initOrdinal(400);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String getConfigName()\n    {\n        return \"system-properties\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/TypedResolverImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.ConfigSnapshot;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\n\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.BiFunction;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n\npublic class TypedResolverImpl<T> implements ConfigResolver.UntypedResolver<T>\n{\n    private static final Logger LOG = Logger.getLogger(TypedResolverImpl.class.getName());\n\n    private final ConfigImpl config;\n\n    private String keyOriginal;\n\n    private String keyResolved;\n\n    private Type configEntryType = String.class;\n\n    private boolean withDefault = false;\n    private T defaultValue;\n\n    private boolean projectStageAware = true;\n\n    private String propertyParameter;\n\n    private String parameterValue;\n\n    private boolean strictly = false;\n\n    private boolean isList = false;\n\n    private ConfigResolver.Converter<?> converter;\n\n    private boolean evaluateVariables = false;\n\n    private boolean logChanges = false;\n    private ConfigResolver.ConfigChanged<T> valueChangedCallback = null;\n\n    private long cacheTimeMs = -1;\n\n    private volatile long reloadAfter = -1;\n    private long lastReloadedAt = -1;\n\n    private T lastValue = null;\n    private BiFunction<Config, String, ?> beanConverter = null;\n\n\n    TypedResolverImpl(ConfigImpl config, String propertyName)\n    {\n        this.config = config;\n        this.keyOriginal = propertyName;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <N> ConfigResolver.TypedResolver<N> as(Class<N> clazz)\n    {\n        configEntryType = clazz;\n        return (ConfigResolver.TypedResolver<N>) this;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public ConfigResolver.TypedResolver<List<T>> asList()\n    {\n        isList = true;\n        ConfigResolver.TypedResolver<List<T>> listTypedResolver = (ConfigResolver.TypedResolver<List<T>>) this;\n\n        if (defaultValue == null)\n        {\n            // the default for lists is an empty list instead of null\n            return listTypedResolver.withDefault(Collections.<T>emptyList());\n        }\n\n        return listTypedResolver;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <N> ConfigResolver.TypedResolver<N> as(Class<N> clazz, ConfigResolver.Converter<N> converter)\n    {\n        configEntryType = clazz;\n        this.converter = converter;\n\n        return (ConfigResolver.TypedResolver<N>) this;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <N> ConfigResolver.TypedResolver<N> as(Type clazz, ConfigResolver.Converter<N> converter)\n    {\n        configEntryType = clazz;\n        this.converter = converter;\n\n        return (ConfigResolver.TypedResolver<N>) this;\n    }\n\n    @Override\n    public <N> ConfigResolver.TypedResolver<N> asBean(Class<N> clazz)\n    {\n        return asBean(clazz, config.getBeanConverter().detectConverter(clazz));\n    }\n\n    @Override\n    public <N> ConfigResolver.TypedResolver<N> asBean(Class<N> clazz, BiFunction<Config, String, N> beanConverter)\n    {\n        configEntryType = clazz;\n        this.beanConverter = beanConverter;\n        return (ConfigResolver.TypedResolver<N>) this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> withDefault(T value)\n    {\n        defaultValue = value;\n        withDefault = true;\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> withStringDefault(String value)\n    {\n        if (value == null || value.isEmpty())\n        {\n            throw new RuntimeException(\"Empty String or null supplied as string-default value for property \"\n                    + keyOriginal);\n        }\n\n        if (isList)\n        {\n            defaultValue = splitAndConvertListValue(value);\n        }\n        else\n        {\n            defaultValue = convert(value);\n        }\n        withDefault = true;\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> cacheFor(TimeUnit timeUnit, long value)\n    {\n        this.cacheTimeMs = timeUnit.toMillis(value);\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> parameterizedBy(String propertyName)\n    {\n        this.propertyParameter = propertyName;\n\n        if (propertyParameter != null && !propertyParameter.isEmpty())\n        {\n            String parameterValue = ConfigResolver\n                    .resolve(propertyParameter)\n                    .withCurrentProjectStage(projectStageAware)\n                    .getValue();\n\n            if (parameterValue != null && !parameterValue.isEmpty())\n            {\n                this.parameterValue = parameterValue;\n            }\n        }\n\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> withCurrentProjectStage(boolean with)\n    {\n        this.projectStageAware = with;\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> strictly(boolean strictly)\n    {\n        this.strictly = strictly;\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> evaluateVariables(boolean evaluateVariables)\n    {\n        this.evaluateVariables = evaluateVariables;\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> logChanges(boolean logChanges)\n    {\n        this.logChanges = logChanges;\n        return this;\n    }\n\n    @Override\n    public ConfigResolver.TypedResolver<T> onChange(ConfigResolver.ConfigChanged<T> valueChangedCallback)\n    {\n        this.valueChangedCallback = valueChangedCallback;\n        return this;\n    }\n\n\n    @Override\n    public T getValue(ConfigSnapshot snapshot)\n    {\n        ConfigSnapshotImpl snapshotImpl = (ConfigSnapshotImpl) snapshot;\n\n        if (!snapshotImpl.getConfigValues().containsKey(this))\n        {\n            throw new IllegalArgumentException(\"The TypedResolver for key \" + getKey() +\n                \" does not belong the given ConfigSnapshot!\");\n        }\n\n        return (T) snapshotImpl.getConfigValues().get(this);\n    }\n\n    @Override\n    public T getValue()\n    {\n        long now = -1;\n        if (cacheTimeMs > 0)\n        {\n            now = System.nanoTime();\n            if (now <= reloadAfter)\n            {\n                // now check if anything in the underlying Config got changed\n                long lastCfgChange = config.getLastChanged();\n                if (lastCfgChange < lastReloadedAt)\n                {\n                    return lastValue;\n                }\n            }\n        }\n\n        T value;\n        if (beanConverter != null)\n        {\n            value = getValueByBeanConverter(beanConverter);\n        }\n        else\n        {\n            String valueStr = resolveStringValue();\n            if (isList)\n            {\n                value = splitAndConvertListValue(valueStr);\n            }\n            else\n            {\n                value = convert(valueStr);\n            }\n\n            if (withDefault)\n            {\n                ConfigResolverContext configResolverContext = new ConfigResolverContext()\n                    .setEvaluateVariables(evaluateVariables)\n                    .setProjectStageAware(projectStageAware);\n\n                value = fallbackToDefaultIfEmpty(keyResolved, value, defaultValue, configResolverContext);\n                if (isList && String.class.isInstance(value))\n                {\n                    value = splitAndConvertListValue(String.class.cast(value));\n                }\n            }\n\n            if ((logChanges || valueChangedCallback != null)\n                && (value != null && !value.equals(lastValue) || (value == null && lastValue != null)))\n            {\n                if (logChanges)\n                {\n                    LOG.log(Level.INFO, \"New value {0} for key {1}.\",\n                        new Object[]{ConfigResolver.filterConfigValueForLog(keyOriginal, valueStr), keyOriginal});\n                }\n\n                if (valueChangedCallback != null)\n                {\n                    valueChangedCallback.onValueChange(keyOriginal, lastValue, value);\n                }\n            }\n        }\n\n        lastValue = value;\n\n        if (cacheTimeMs > 0)\n        {\n            reloadAfter = now + TimeUnit.MILLISECONDS.toNanos(cacheTimeMs);\n            lastReloadedAt = now;\n        }\n\n        return value;\n    }\n\n    private T getValueByBeanConverter(BiFunction<Config, String, ?> beanConverter)\n    {\n        T value;\n        for (int tries = 1; tries < ConfigImpl.MAX_CONFIG_RETRIES; tries++)\n        {\n            long startReadLastChanged = config.getLastChanged();\n            value = (T) beanConverter.apply(config, keyOriginal + \".\");\n            if (startReadLastChanged == config.getLastChanged())\n            {\n                return value;\n            }\n        }\n        throw new IllegalStateException(\n            \"Could not resolve ConfigTransaction as underlying values are permanently changing!\");\n    }\n\n    private T splitAndConvertListValue(String valueStr)\n    {\n        if (valueStr == null)\n        {\n            return null;\n        }\n\n        List list = new ArrayList();\n        StringBuilder currentValue = new StringBuilder();\n        int length = valueStr.length();\n        for (int i = 0; i < length; i++)\n        {\n            char c = valueStr.charAt(i);\n            if (c == '\\\\')\n            {\n                if (i < length - 1)\n                {\n                    char nextC = valueStr.charAt(i + 1);\n                    currentValue.append(nextC);\n                    i++;\n                }\n            }\n            else if (c == ',')\n            {\n                String trimedVal = currentValue.toString().trim();\n                if (trimedVal.length() > 0)\n                {\n                    list.add(convert(trimedVal));\n                }\n\n                currentValue.setLength(0);\n            }\n            else\n            {\n                currentValue.append(c);\n            }\n        }\n\n        String trimedVal = currentValue.toString().trim();\n        if (trimedVal.length() > 0)\n        {\n            list.add(convert(trimedVal));\n        }\n\n        return (T) list;\n    }\n\n    @Override\n    public String getKey()\n    {\n        return keyOriginal;\n    }\n\n    @Override\n    public String getResolvedKey()\n    {\n        return keyResolved;\n    }\n\n    @Override\n    public T getDefaultValue()\n    {\n        return defaultValue;\n    }\n\n    /**\n     * Performs the resolution cascade\n     */\n    private String resolveStringValue()\n    {\n        ProjectStage ps = null;\n        String value = null;\n        keyResolved = keyOriginal;\n        int keySuffices = 0;\n\n        // make the longest key\n        // first, try appending resolved parameter\n        if (propertyParameter != null && !propertyParameter.isEmpty())\n        {\n            if (parameterValue != null && !parameterValue.isEmpty())\n            {\n                keyResolved += \".\" + parameterValue;\n                keySuffices++;\n            }\n            // if parameter value can't be resolved and strictly\n            else if (strictly)\n            {\n                return null;\n            }\n        }\n\n        // try appending projectstage\n        if (projectStageAware)\n        {\n            ps = getProjectStage();\n            keyResolved += \".\" + ps;\n            keySuffices++;\n        }\n\n        // make initial resolution of longest key\n        value = getPropertyValue(keyResolved);\n\n        // try fallbacks if not strictly\n        if (value == null && !strictly)\n        {\n\n            // by the length of the longest resolved key already tried\n            // breaks are left out intentionally\n            switch (keySuffices)\n            {\n\n                case 2:\n                    // try base.param\n                    keyResolved = keyOriginal + \".\" + parameterValue;\n                    value = getPropertyValue(keyResolved);\n\n                    if (value != null)\n                    {\n                        return value;\n                    }\n\n                    // try base.ps\n                    ps = getProjectStage();\n                    keyResolved = keyOriginal + \".\" + ps;\n                    value = getPropertyValue(keyResolved);\n\n                    if (value != null)\n                    {\n                        return value;\n                    }\n\n                case 1:\n                    // try base\n                    keyResolved = keyOriginal;\n                    value = getPropertyValue(keyResolved);\n                    return value;\n\n                default:\n                    // the longest key was the base, no fallback\n                    return null;\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * If a converter was provided for this builder, it takes precedence over the built-in converters.\n     */\n    private T convert(String value)\n    {\n        if (value == null)\n        {\n            return null;\n        }\n\n        Object result = null;\n\n        if (this.converter != null)\n        {\n            try\n            {\n                result = converter.convert(value);\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n        else if (String.class.equals(configEntryType))\n        {\n            result = value;\n        }\n        else if (Class.class.equals(configEntryType))\n        {\n            result = ClassUtils.tryToLoadClassForName(value);\n        }\n        else if (Boolean.class.equals(configEntryType))\n        {\n            Boolean isTrue = \"TRUE\".equalsIgnoreCase(value);\n            isTrue |= \"1\".equalsIgnoreCase(value);\n            isTrue |= \"YES\".equalsIgnoreCase(value);\n            isTrue |= \"Y\".equalsIgnoreCase(value);\n            isTrue |= \"JA\".equalsIgnoreCase(value);\n            isTrue |= \"J\".equalsIgnoreCase(value);\n            isTrue |= \"OUI\".equalsIgnoreCase(value);\n\n            result = isTrue;\n        }\n        else if (Integer.class.equals(configEntryType))\n        {\n            result = Integer.parseInt(value);\n        }\n        else if (Long.class.equals(configEntryType))\n        {\n            result = Long.parseLong(value);\n        }\n        else if (Float.class.equals(configEntryType))\n        {\n            result = Float.parseFloat(value);\n        }\n        else if (Double.class.equals(configEntryType))\n        {\n            result = Double.parseDouble(value);\n        }\n\n        return (T) result;\n    }\n\n    private <T> T fallbackToDefaultIfEmpty(String key, T value, T defaultValue,\n                                           ConfigResolverContext configResolverContext)\n    {\n        if (value == null || (value instanceof String && ((String)value).isEmpty()))\n        {\n            if (configResolverContext != null && defaultValue instanceof String\n                    && configResolverContext.isEvaluateVariables())\n            {\n                defaultValue = (T) resolveVariables((String) defaultValue);\n            }\n\n            if (LOG.isLoggable(Level.FINE))\n            {\n                LOG.log(Level.FINE, \"no configured value found for key {0}, using default value {1}.\",\n                        new Object[]{key, defaultValue});\n            }\n\n            return defaultValue;\n        }\n\n        return value;\n    }\n\n    /**\n     * recursively resolve any ${varName} in the value\n     */\n    private String resolveVariables(String value)\n    {\n        int startVar = 0;\n        while ((startVar = value.indexOf(\"${\", startVar)) >= 0)\n        {\n            int endVar = value.indexOf(\"}\", startVar);\n            if (endVar <= 0)\n            {\n                break;\n            }\n            String varName = value.substring(startVar + 2, endVar);\n            if (varName.isEmpty())\n            {\n                break;\n            }\n\n            try\n            {\n                String variableValue = new TypedResolverImpl<String>(this.config, varName)\n                    .withCurrentProjectStage(this.projectStageAware)\n                    .evaluateVariables(true)\n                    .getValue();\n\n                if (variableValue != null)\n                {\n                    value = value.replace(\"${\" + varName + \"}\", variableValue);\n                }\n            }\n            catch (StackOverflowError soe)\n            {\n                // just log out\n                LOG.severe(\"Recursive variable resolution detected for \" + varName);\n                throw soe;\n            }\n            startVar++;\n        }\n        return value;\n    }\n\n    private ProjectStage getProjectStage()\n    {\n        return ProjectStageProducer.getInstance().getProjectStage();\n    }\n\n    private String getPropertyValue(String key)\n    {\n        String value;\n        for (ConfigSource configSource : config.getConfigSources())\n        {\n            value = configSource.getPropertyValue(key);\n\n            if (value != null)\n            {\n                if (LOG.isLoggable(Level.FINE))\n                {\n                    LOG.log(Level.FINE, \"found value {0} for key {1} in ConfigSource {2}.\",\n                            new Object[]{config.filterConfigValue(key, value, true),\n                                key, configSource.getConfigName()});\n                }\n\n                if (this.evaluateVariables)\n                {\n                    value = resolveVariables(value);\n                }\n\n                return config.filterConfigValue(key, value, false);\n            }\n\n            if (LOG.isLoggable(Level.FINE))\n            {\n                LOG.log(Level.FINER, \"NO value found for key {0} in ConfigSource {1}.\",\n                        new Object[]{key, configSource.getConfigName()});\n            }\n        }\n\n        return null;\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/converter/BeanConverterFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.config.converter;\n\nimport java.lang.reflect.Constructor;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.function.BiFunction;\nimport java.util.stream.Collectors;\n\nimport org.apache.deltaspike.core.api.config.Config;\n\n/**\n * A factory for bean converters.\n */\npublic final class BeanConverterFactory\n{\n    private final ConcurrentMap<Class<?>, BiFunction<Config, String, ?>> beanConverters = new ConcurrentHashMap<>();\n\n    /**\n     * Determine the bean converter function to be used according to the rules defined in\n     * {@link org.apache.deltaspike.core.api.config.ConfigResolver.UntypedResolver#asBean(Class)}\n     */\n    public <N> BiFunction<Config, String, N> detectConverter(Class<N> clazz)\n    {\n        BiFunction<Config, String, N> beanConverter = (BiFunction<Config, String, N>) beanConverters.get(clazz);\n        if (beanConverter == null)\n        {\n            // class with public param ct\n            final List<Constructor<?>> paramConstructors = Arrays.stream(clazz.getConstructors())\n                .filter(ct -> ct.getParameterTypes().length > 0)\n                .collect(Collectors.toList());\n            if (paramConstructors.size() > 1)\n            {\n                throw new IllegalStateException(\"Cannot handle beans with multiple non-default ct\");\n            }\n            if (paramConstructors.size() == 0)\n            {\n                // use field config injection\n                beanConverter = new FieldInjectionBeanConverter(clazz);\n            }\n            else\n            {\n                beanConverter = new CtInjectionBeanConverter(clazz, paramConstructors.get(0));\n            }\n\n            beanConverters.putIfAbsent(clazz, beanConverter);\n        }\n\n        return beanConverter;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/converter/CtInjectionBeanConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.config.converter;\n\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Parameter;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\n/**\n * @author <a href=\"mailto:struberg@apache.org\">Mark Struberg</a>\n */\npublic class CtInjectionBeanConverter<N> implements BiFunction<Config, String, N>\n{\n    private final Constructor<?> constructor;\n\n    public <N> CtInjectionBeanConverter(Class<N> clazz, Constructor<?> constructor)\n    {\n        this.constructor = constructor;\n    }\n\n    @Override\n    public N apply(Config config, String path)\n    {\n        List<Object> params = new ArrayList<>();\n        for (int i = 0; i < constructor.getParameters().length; i++)\n        {\n            Parameter p = constructor.getParameters()[i];\n            String paramName;\n            final ConfigProperty configProperty = p.getAnnotation(ConfigProperty.class);\n            if (configProperty != null)\n            {\n                paramName = configProperty.name();\n            }\n            else\n            {\n                paramName = p.getName();\n                if (paramName.equals(\"arg\" + i))\n                {\n                    throw new IllegalStateException(\"Config POJO constructor pareameters must be annotated with @ConfigProperty if the \" +\n                        \"class is not compiled with the javac -parameters option!\");\n                }\n            }\n\n            params.add(config.resolve(path + paramName)\n                .as(p.getType())\n                .getValue());\n        }\n\n        if (params.stream().allMatch(p -> p == null))\n        {\n            return null;\n        }\n\n        try\n        {\n            return (N) constructor.newInstance(params.toArray(new Object[params.size()]));\n        }\n        catch (InstantiationException | IllegalAccessException | InvocationTargetException  e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/converter/FieldInjectionBeanConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.config.converter;\n\nimport java.lang.reflect.Field;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\n/**\n * @author <a href=\"mailto:struberg@apache.org\">Mark Struberg</a>\n */\npublic class FieldInjectionBeanConverter<N> implements BiFunction<Config, String, N>\n{\n    private final Class<?> clazz;\n    private final List<Field> fields;\n\n    public <N> FieldInjectionBeanConverter(Class<N> clazz)\n    {\n        this.clazz = clazz;\n        this.fields = collectFields(clazz);\n    }\n\n    private <N> List<Field> collectFields(Class<N> clazz)\n    {\n        List<Field> fields = new ArrayList<>();\n        fields.addAll(Arrays.asList(clazz.getDeclaredFields()));\n        if (clazz.getSuperclass() != Object.class)\n        {\n            fields.addAll(collectFields(clazz.getSuperclass()));\n        }\n        return fields;\n    }\n\n    @Override\n    public N apply(Config config, String path)\n    {\n        try\n        {\n            final Object o = clazz.getDeclaredConstructor().newInstance();\n            for (Field field : fields)\n            {\n                final ConfigProperty configProperty = field.getAnnotation(ConfigProperty.class);\n                String name = configProperty != null ? configProperty.name() : field.getName();\n                final ConfigResolver.UntypedResolver<String> resolver = config.resolve(path + name);\n                if (field.getType() != String.class)\n                {\n                    resolver.as(field.getType());\n                }\n                resolver.evaluateVariables(configProperty != null ? configProperty.evaluateVariables() :  true);\n                resolver.withCurrentProjectStage(configProperty != null ? configProperty.projectStageAware() :  true);\n                if (!field.isAccessible())\n                {\n                    field.setAccessible(true);\n                }\n                field.set(o, resolver.getValue());\n            }\n            return (N) o;\n        }\n        catch (Exception e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/crypto/CdiCipherService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.core.impl.crypto;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport java.io.IOException;\n\nimport org.apache.deltaspike.core.api.crypto.CipherService;\n\n@ApplicationScoped\npublic class CdiCipherService implements CipherService\n{\n    private DefaultCipherService cipherService = new DefaultCipherService();\n\n\n    @Override\n    public void setMasterHash(String masterPassword, String masterSalt, boolean overwrite)\n        throws IOException\n    {\n        cipherService.setMasterHash(masterPassword, masterSalt, overwrite);\n    }\n\n    @Override\n    public String encrypt(String cleartext, String masterSalt)\n    {\n        return cipherService.encrypt(cleartext, masterSalt);\n    }\n\n    @Override\n    public String decrypt(String encryptedValue, String masterSalt)\n    {\n        return cipherService.decrypt(encryptedValue, masterSalt);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/crypto/CipherCli.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.crypto;\n\n/**\n * Command Line Interface for CipherService\n */\npublic class CipherCli\n{\n\n    private CipherCli()\n    {\n        // private ct.\n    }\n\n    public static void main(String[] args) throws Exception\n    {\n        // not using any other libs like commons-cli to save dependencies\n\n        if (args.length < 5)\n        {\n            printHelp();\n            System.exit(-1);\n        }\n\n        if (!\"encode\".equals(args[0]))\n        {\n            printHelp();\n            System.exit(-1);\n        }\n\n        String masterPwd = null;\n        String plaintext = null;\n        String masterSalt = null;\n        boolean overwrite = false;\n\n        for (int i = 1; i < args.length; i++)\n        {\n            String arg = args[i];\n\n            if (\"-masterPassword\".equals(arg) && i < args.length - 1)\n            {\n                masterPwd = args[++i];\n            }\n            else if (\"-masterSalt\".equals(arg) && i < args.length - 1)\n            {\n                masterSalt = args[++i];\n            }\n            else if (\"-plaintext\".equals(arg) && i < args.length - 1)\n            {\n                plaintext = args[++i];\n            }\n            else if (\"-overwrite\".equals(arg))\n            {\n                overwrite = true;\n            }\n        }\n\n        DefaultCipherService defaultCipherService = new DefaultCipherService();\n\n        if (masterPwd != null && masterSalt != null)\n        {\n            String masterSaltHash = defaultCipherService.setMasterHash(masterPwd, masterSalt, overwrite);\n\n            System.out.println(\"A new master password got set. Hash key is \" + masterSaltHash);\n        }\n        else if (plaintext != null && masterSalt != null)\n        {\n            String encrypted = defaultCipherService.encrypt(plaintext, masterSalt);\n            System.out.println(\"Encrypted value: \" + encrypted);\n        }\n        else\n        {\n            printHelp();\n            System.exit(-1);\n        }\n    }\n\n    private static void printHelp()\n    {\n        StringBuilder usage = new StringBuilder(1024);\n        usage.append(\"To create a master password use:\");\n        usage.append(\"\\n$> java -jar deltaspike-core-impl.jar encode -masterPassword \" +\n            \"yourMasterPassword -masterSalt someSecretOnlyKnownToYouAndTheApplication\");\n        usage.append(\"\\n   you can also specify -overwrite to replace an existing masterpassword.\");\n        usage.append(\"\\n\\nFor encrypting a secret with a previously stored masterPassword use:\");\n        usage.append(\"\\n$> java -jar deltaspike-core-impl.jar encode -plaintext plaintextToEncrypt \" +\n            \"-masterSalt someSecretOnlyKnownToYouAndTheApplication\");\n        usage.append(\"\\n\\nVisit https://deltaspike.apache.org for more information.\\n\");\n\n        System.out.print(usage.toString());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/crypto/DefaultCipherService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.crypto;\n\nimport javax.crypto.Cipher;\nimport javax.crypto.spec.SecretKeySpec;\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.nio.charset.Charset;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Arrays;\nimport java.util.Properties;\n\n\n/**\n * handle Encryption\n */\npublic class DefaultCipherService\n{\n    private static final Charset UTF_8 = Charset.forName(\"UTF-8\");\n    private static final String HASH_ALGORITHM = \"SHA-256\";\n    private static final String CIPHER_ALGORITHM = \"AES\";\n\n    public String setMasterHash(String masterPassword, String masterSalt, boolean overwrite)\n        throws IOException\n    {\n        File masterFile = getMasterFile();\n        if (!masterFile.getParentFile().exists())\n        {\n            if (!masterFile.getParentFile().mkdirs())\n            {\n                throw new IOException(\"Can not create directory \" + masterFile.getParent());\n            }\n        }\n        String saltHash = byteToHex(secureHash(masterSalt));\n        String saltKey = byteToHex(secureHash(saltHash));\n\n        String encrypted = byteToHex(aesEncrypt(byteToHex(secureHash(masterPassword)), saltHash));\n\n\n        Properties keys = new Properties();\n        if (masterFile.exists())\n        {\n            keys = loadProperties(masterFile.toURI().toURL());\n        }\n\n        if (keys.get(saltKey) != null && !overwrite)\n        {\n            throw new IllegalStateException(\"MasterKey for hash \" + saltKey +\n                \" already exists. Forced overwrite option needed\");\n        }\n\n        keys.put(saltKey, encrypted);\n\n        keys.store(new FileOutputStream(masterFile), null);\n\n        return saltKey;\n    }\n\n    protected String getMasterKey(String masterSalt)\n    {\n        File masterFile = getMasterFile();\n        if (!masterFile.exists())\n        {\n            throw new IllegalStateException(\"Could not find master.hash file. Create a master password first!\");\n        }\n\n        try\n        {\n            String saltHash = byteToHex(secureHash(masterSalt));\n            String saltKey = byteToHex(secureHash(saltHash));\n\n            Properties keys = loadProperties(masterFile.toURI().toURL());\n\n            String encryptedMasterKey = (String) keys.get(saltKey);\n            if (encryptedMasterKey == null)\n            {\n                throw new IllegalStateException(\"Could not find master key for hash \" + saltKey +\n                    \". Create a master password first!\");\n            }\n\n            return aesDecrypt(hexToByte(encryptedMasterKey), saltHash);\n        }\n        catch (MalformedURLException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public String encrypt(String cleartext, String masterSalt)\n    {\n        return byteToHex(aesEncrypt(cleartext, getMasterKey(masterSalt)));\n    }\n\n    public String decrypt(String encryptedValue, String masterSalt)\n    {\n        return aesDecrypt(hexToByte(encryptedValue), getMasterKey(masterSalt));\n    }\n\n    protected File getMasterFile()\n    {\n        String userHome = System.getProperty(\"user.home\");\n        if (userHome == null || userHome.isEmpty())\n        {\n            throw new IllegalStateException(\"Can not determine user home directory\");\n        }\n        return new File(userHome, \".deltaspike/master.hash\");\n    }\n\n\n    protected byte[] secureHash(String value)\n    {\n        try\n        {\n            MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM);\n            return md.digest(value.getBytes(UTF_8));\n        }\n        catch (NoSuchAlgorithmException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    /**\n     * performs an AES encryption of the given text with the given password key\n     */\n    public byte[] aesEncrypt(String valueToEncrypt, String key)\n    {\n        try\n        {\n            SecretKeySpec secretKeySpec = getSecretKeySpec(key);\n\n            Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);\n            cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\n            return cipher.doFinal(valueToEncrypt.getBytes(UTF_8));\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    /**\n     * performs an AES decryption of the given text with the given key key\n     */\n    public String aesDecrypt(byte[] encryptedValue, String key)\n    {\n        try\n        {\n            SecretKeySpec secretKeySpec = getSecretKeySpec(key);\n\n            Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);\n            cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);\n            return new String(cipher.doFinal(encryptedValue), UTF_8);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private SecretKeySpec getSecretKeySpec(String password)\n    {\n        byte[] pwdHash = secureHash(password);\n        byte[] key = Arrays.copyOf(pwdHash, 16); // use only first 128 bit\n\n        // Note: using 128 bit AES avoids requirement for \"Unlimited Crypto\" patch\n        return new SecretKeySpec(key, \"AES\");\n    }\n\n\n    protected String byteToHex(final byte[] hash)\n    {\n        StringBuilder sb = new StringBuilder(hash.length * 2);\n\n        for (byte b : hash)\n        {\n            sb.append(Character.forDigit(b >> 4 & 0x0f, 16));\n            sb.append(Character.forDigit(b & 0x0f, 16));\n        }\n\n        return sb.toString();\n    }\n\n    protected byte[] hexToByte(String hexString)\n    {\n        if (hexString == null || hexString.length() == 0)\n        {\n            return new byte[0];\n        }\n        hexString = hexString.trim();\n\n        if (hexString.length() % 2 != 0)\n        {\n            throw new IllegalArgumentException(\"not a valid hex string \" + hexString);\n        }\n\n        byte[] bytes = new byte[hexString.length() / 2];\n        for (int i = 0; i < hexString.length() / 2; i++)\n        {\n            int val = (Character.digit(hexString.charAt(i * 2), 16) << 4) +\n                      (Character.digit(hexString.charAt( (i * 2) + 1), 16));\n            bytes[i] = (byte) val;\n        }\n\n        return bytes;\n    }\n\n\n    /**\n     * Copied over from PropertyFileUtils to avoid the need for having the api\n     * on the classpath when using the password encode CLI\n     */\n    private Properties loadProperties(URL url)\n    {\n        Properties props = new Properties();\n\n        InputStream inputStream = null;\n        try\n        {\n            inputStream = url.openStream();\n\n            if (inputStream != null)\n            {\n                props.load(inputStream);\n            }\n        }\n        catch (IOException e)\n        {\n            throw new IllegalStateException(e);\n        }\n        finally\n        {\n            try\n            {\n                if (inputStream != null)\n                {\n                    inputStream.close();\n                }\n            }\n            catch (IOException e)\n            {\n                // no worries, means that the file is already closed\n            }\n        }\n\n        return props;\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/CustomProjectStageBeanFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.exclude;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\n/**\n * Allows to deactivate the autom. filtering of custom project-stages -> @Typed() needs to be used manually\n */\npublic interface CustomProjectStageBeanFilter extends Deactivatable\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.exclude.extension;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.exclude.Exclude;\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.api.interpreter.ExpressionInterpreter;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.impl.exclude.CustomProjectStageBeanFilter;\nimport org.apache.deltaspike.core.impl.interpreter.PropertyExpressionInterpreter;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterDeploymentValidation;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\nimport java.lang.reflect.Modifier;\nimport java.net.URL;\nimport java.util.jar.Attributes;\nimport java.util.jar.Manifest;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * <p>This class implements the logic for handling\n * {@link org.apache.deltaspike.core.api.exclude.Exclude} annotations.</p>\n * <p/>\n * <p>Further details see {@link org.apache.deltaspike.core.api.exclude.Exclude}</p>\n */\npublic class ExcludeExtension implements Extension, Deactivatable\n{\n    private static final Logger LOG = Logger.getLogger(ExcludeExtension.class.getName());\n\n    private boolean isActivated = true;\n    private boolean isCustomProjectStageBeanFilterActivated = true;\n\n    //overruling the filter is supported via config-ordinal - for now only one is supported to keep it simple\n    //a custom filter can always delegate to multiple filters\n    //(e.g. in combination with ServiceUtils or querying all config-sources explicitly)\n    private ClassFilter classFilter;\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager)\n    {\n        isActivated =\n                ClassDeactivationUtils.isActivated(getClass());\n\n        isCustomProjectStageBeanFilterActivated =\n                ClassDeactivationUtils.isActivated(CustomProjectStageBeanFilter.class);\n\n        boolean isClassFilterActivated = ClassDeactivationUtils.isActivated(ClassFilter.class);\n\n        if (isClassFilterActivated)\n        {\n            String classFilterClassName = ClassFilter.class.getName();\n            String activeClassFilterName =\n                ConfigResolver.getProjectStageAwarePropertyValue(classFilterClassName, classFilterClassName);\n\n            if (!classFilterClassName.equals(activeClassFilterName))\n            {\n                classFilter = ClassUtils.tryToInstantiateClassForName(activeClassFilterName, ClassFilter.class);\n            }\n        }\n    }\n\n    /**\n     * triggers initialization in any case\n     * @param afterDeploymentValidation observed event\n     */\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void initProjectStage(@Observes AfterDeploymentValidation afterDeploymentValidation)\n    {\n        ProjectStageProducer.getInstance();\n    }\n\n    /**\n     * Observer which is vetoing beans based on {@link Exclude}\n     * @param processAnnotatedType observed event\n     */\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void vetoBeans(@Observes ProcessAnnotatedType processAnnotatedType, BeanManager beanManager)\n    {\n        //we need to do it before the exclude logic to keep the @Exclude support for global alternatives\n        if (isCustomProjectStageBeanFilterActivated)\n        {\n            vetoCustomProjectStageBeans(processAnnotatedType);\n        }\n\n        if (!isActivated)\n        {\n            return;\n        }\n\n        if (classFilter != null)\n        {\n            Class<?> beanClass = processAnnotatedType.getAnnotatedType().getJavaClass();\n\n            if (classFilter.isFiltered(beanClass))\n            {\n                veto(processAnnotatedType, classFilter.getClass().getName());\n                return;\n            }\n        }\n\n        //TODO needs further discussions for a different feature CodiStartupBroadcaster.broadcastStartup();\n\n        //also forces deterministic project-stage initialization\n        ProjectStage projectStage = ProjectStageProducer.getInstance().getProjectStage();\n\n        Exclude exclude = extractExcludeAnnotation(processAnnotatedType.getAnnotatedType().getJavaClass());\n\n        if (exclude == null)\n        {\n            return;\n        }\n\n        if (!evalExcludeWithoutCondition(processAnnotatedType, exclude))\n        {\n            return; //veto called already\n        }\n\n        if (!evalExcludeInProjectStage(processAnnotatedType, exclude, projectStage))\n        {\n            return; //veto called already\n        }\n\n        if (!evalExcludeNotInProjectStage(processAnnotatedType, exclude, projectStage))\n        {\n            return; //veto called already\n        }\n\n        evalExcludeWithExpression(processAnnotatedType, exclude);\n    }\n\n    //only support the physical usage and inheritance if @Exclude comes from an abstract class\n    //TODO re-visit the impact of java.lang.annotation.Inherited (for @Exclude) for the available use-cases\n    protected Exclude extractExcludeAnnotation(Class<?> currentClass)\n    {\n        Exclude result = currentClass.getAnnotation(Exclude.class);\n\n        if (result != null)\n        {\n            return result;\n        }\n\n        currentClass = currentClass.getSuperclass();\n\n        while (!Object.class.equals(currentClass) && currentClass != null)\n        {\n            if (Modifier.isAbstract(currentClass.getModifiers()))\n            {\n                result = currentClass.getAnnotation(Exclude.class);\n            }\n\n            if (result != null)\n            {\n                return result;\n            }\n\n            currentClass = currentClass.getSuperclass();\n        }\n        return null;\n    }\n\n    protected void vetoCustomProjectStageBeans(ProcessAnnotatedType processAnnotatedType)\n    {\n        //currently there is a veto for all project-stage implementations,\n        //but we still need for the provided implementations in case of the deactivation of this behaviour\n        if (ProjectStage.class.isAssignableFrom(processAnnotatedType.getAnnotatedType().getJavaClass()))\n        {\n            processAnnotatedType.veto();\n        }\n    }\n\n\n    private boolean evalExcludeWithoutCondition(ProcessAnnotatedType processAnnotatedType, Exclude exclude)\n    {\n        if (exclude.ifProjectStage().length == 0 && exclude.exceptIfProjectStage().length == 0 &&\n                \"\".equals(exclude.onExpression()))\n        {\n            veto(processAnnotatedType, \"Stateless\");\n            return false;\n        }\n        return true;\n    }\n\n    private boolean evalExcludeInProjectStage(ProcessAnnotatedType processAnnotatedType, Exclude exclude,\n        ProjectStage currentlyConfiguredProjectStage)\n    {\n        Class<? extends ProjectStage>[] activatedIn = exclude.ifProjectStage();\n\n        if (activatedIn.length == 0)\n        {\n            return true;\n        }\n\n        if (isInProjectStage(activatedIn, currentlyConfiguredProjectStage))\n        {\n            veto(processAnnotatedType, \"IfProjectState\");\n            return false;\n        }\n        return true;\n    }\n\n    private boolean evalExcludeNotInProjectStage(ProcessAnnotatedType processAnnotatedType, Exclude exclude,\n        ProjectStage currentlyConfiguredProjectStage)\n    {\n        Class<? extends ProjectStage>[] notIn = exclude.exceptIfProjectStage();\n\n        if (notIn.length == 0)\n        {\n            return true;\n        }\n\n        if (!isInProjectStage(notIn, currentlyConfiguredProjectStage))\n        {\n            veto(processAnnotatedType, \"ExceptIfProjectState\");\n            return false;\n        }\n        return true;\n    }\n\n    private void evalExcludeWithExpression(ProcessAnnotatedType processAnnotatedType, Exclude exclude)\n    {\n        if (\"\".equals(exclude.onExpression()))\n        {\n            return;\n        }\n\n        if (isDeactivated(exclude, PropertyExpressionInterpreter.class))\n        {\n            veto(processAnnotatedType, \"Expression\");\n        }\n    }\n\n    private boolean isInProjectStage(Class<? extends ProjectStage>[] activatedIn,\n        ProjectStage currentlyConfiguredProjectStage)\n    {\n        if (activatedIn != null && activatedIn.length > 0)\n        {\n            for (Class<? extends ProjectStage> activated : activatedIn)\n            {\n                if (currentlyConfiguredProjectStage.getClass().equals(activated))\n                {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    private boolean isDeactivated(Exclude exclude, Class defaultExpressionInterpreterClass)\n    {\n        String expressions = exclude.onExpression();\n\n        Class<? extends ExpressionInterpreter> interpreterClass = exclude.interpretedBy();\n\n        if (interpreterClass.equals(ExpressionInterpreter.class))\n        {\n            interpreterClass = defaultExpressionInterpreterClass;\n        }\n\n        ExpressionInterpreter<String, Boolean> expressionInterpreter =\n                ClassUtils.tryToInstantiateClass(interpreterClass);\n\n        if (expressionInterpreter == null)\n        {\n            if (LOG.isLoggable(Level.WARNING))\n            {\n                LOG.warning(\"can't instantiate \" + interpreterClass.getClass().getName());\n            }\n            return true;\n        }\n\n        return expressionInterpreter.evaluate(expressions);\n    }\n\n    private void veto(ProcessAnnotatedType processAnnotatedType, String vetoType)\n    {\n        processAnnotatedType.veto();\n        LOG.finer(vetoType + \" based veto for bean with type: \" +\n                processAnnotatedType.getAnnotatedType().getJavaClass());\n    }\n\n    private static String getJarVersion(Class targetClass)\n    {\n        String manifestFileLocation = getManifestFileLocationOfClass(targetClass);\n\n        try\n        {\n            return new Manifest(new URL(manifestFileLocation).openStream())\n                    //weld doesn't use IMPLEMENTATION_VERSION\n                    .getMainAttributes().getValue(Attributes.Name.SPECIFICATION_VERSION);\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n    private static String getManifestFileLocationOfClass(Class targetClass)\n    {\n        String manifestFileLocation;\n\n        try\n        {\n            manifestFileLocation = getManifestLocation(targetClass);\n        }\n        catch (Exception e)\n        {\n            //in this case we have a proxy\n            manifestFileLocation = getManifestLocation(targetClass.getSuperclass());\n        }\n        return manifestFileLocation;\n    }\n\n    private static String getManifestLocation(Class targetClass)\n    {\n        String classFilePath = targetClass.getCanonicalName().replace('.', '/') + \".class\";\n        String manifestFilePath = \"/META-INF/MANIFEST.MF\";\n\n        String classLocation = targetClass.getResource(targetClass.getSimpleName() + \".class\").toString();\n        return classLocation.substring(0, classLocation.indexOf(classFilePath) - 1) + manifestFilePath;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/future/DefaultFutureableStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.future;\n\nimport org.apache.deltaspike.core.api.future.Futureable;\nimport org.apache.deltaspike.core.impl.util.AnnotatedMethods;\nimport org.apache.deltaspike.core.spi.future.FutureableStrategy;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Future;\n\n@Dependent\npublic class DefaultFutureableStrategy implements FutureableStrategy\n{\n    private static final Class<?> COMPLETION_STAGE;\n    private static final Class<?> COMPLETABLE_FUTURE;\n    private static final Method COMPLETABLE_STAGE_TO_FUTURE;\n\n    // only for weld1\n    private static final boolean IS_WELD1;\n    private static final ThreadLocal<LinkedList<CallKey>> STACK = new ThreadLocal<LinkedList<CallKey>>()\n    {\n        @Override\n        protected LinkedList<CallKey> initialValue()\n        {\n            return new LinkedList<CallKey>();\n        }\n    };\n\n    static\n    {\n        Class<?> completionStageClass = null;\n        Class<?> completableFutureClass = null;\n        Method completionStageClassToCompletableFuture = null;\n        try\n        {\n            final ClassLoader classLoader = ClassLoader.getSystemClassLoader();\n            completionStageClass = classLoader.loadClass(\"java.util.concurrent.CompletionStage\");\n            completionStageClassToCompletableFuture = completionStageClass.getMethod(\"toCompletableFuture\");\n            completableFutureClass = classLoader.loadClass(\"java.util.concurrent.CompletableFuture\");\n        }\n        catch (final Exception e)\n        {\n            // not on java 8\n        }\n        COMPLETION_STAGE = completionStageClass;\n        COMPLETABLE_FUTURE = completableFutureClass;\n        COMPLETABLE_STAGE_TO_FUTURE = completionStageClassToCompletableFuture;\n\n        { // workaround for weld -> use a thread local to track the invocations\n            boolean weld1 = false;\n            try\n            {\n                final Class<?> impl = Thread.currentThread().getContextClassLoader()\n                        .loadClass(\"org.jboss.weld.manager.BeanManagerImpl\");\n                final Package pck = impl.getPackage();\n                weld1 = \"Weld Implementation\".equals(pck.getImplementationTitle())\n                        && pck.getSpecificationVersion() != null && pck.getSpecificationVersion().startsWith(\"1.1.\");\n            }\n            catch (final Throwable cnfe)\n            {\n                // no-op\n            }\n            IS_WELD1 = weld1;\n        }\n    }\n\n    @Inject\n    private ThreadPoolManager manager;\n\n    @Inject\n    private BeanManager beanManager;\n\n    private transient ConcurrentMap<Method, ExecutorService> configByMethod =\n        new ConcurrentHashMap<Method, ExecutorService>();\n\n\n    @Override\n    public Object execute(final InvocationContext ic) throws Exception\n    {\n        final CallKey invocationKey;\n        if (IS_WELD1)\n        {\n            invocationKey = new CallKey(ic);\n            { // weld1 workaround\n                final LinkedList<CallKey> stack = STACK.get();\n                if (!stack.isEmpty() && stack.getLast().equals(invocationKey))\n                {\n                    try\n                    {\n                        return ic.proceed();\n                    }\n                    finally\n                    {\n                        if (stack.isEmpty())\n                        {\n                            STACK.remove();\n                        }\n                    }\n                }\n            }\n        }\n        else\n        {\n            invocationKey = null;\n        }\n\n        // validate usage\n        final Class<?> returnType = ic.getMethod().getReturnType();\n        if (!Future.class.isAssignableFrom(returnType) &&\n                !void.class.isAssignableFrom(returnType) &&\n                (COMPLETION_STAGE == null || !COMPLETION_STAGE.isAssignableFrom(returnType)))\n        {\n            throw new IllegalArgumentException(\"Return type should be a CompletableStage, Future or void\");\n        }\n\n        if (configByMethod == null)\n        {\n            synchronized (this)\n            {\n                if (configByMethod == null)\n                {\n                    configByMethod = new ConcurrentHashMap<Method, ExecutorService>();\n                }\n            }\n        }\n\n        // running < j8 we cant have cancellation\n        //final AtomicReference<Callable<?>> cancelHook = new AtomicReference<Callable<?>>();\n        final Callable<Object> invocation = new Callable<Object>()\n        {\n            @Override\n            public Object call() throws Exception\n            {\n                final LinkedList<CallKey> callStack;\n                if (IS_WELD1)\n                {\n                    callStack = STACK.get();\n                    callStack.add(invocationKey);\n                }\n                else\n                {\n                    callStack = null;\n                }\n                try\n                {\n                    final Object proceed = ic.proceed();\n                    final Future<?> future = COMPLETION_STAGE == null || !COMPLETION_STAGE.isInstance(proceed) ?\n                            Future.class.cast(proceed) :\n                            Future.class.cast(COMPLETABLE_STAGE_TO_FUTURE.invoke(proceed));\n                    return future.get();\n                }\n                catch (final InvocationTargetException e)\n                {\n                    throw ExceptionUtils.throwAsRuntimeException(e.getCause());\n                }\n                catch (final Exception e)\n                {\n                    throw ExceptionUtils.throwAsRuntimeException(e);\n                }\n                finally\n                {\n                    if (IS_WELD1)\n                    {\n                        callStack.removeLast();\n                        if (callStack.isEmpty())\n                        {\n                            STACK.remove();\n                        }\n                    }\n                }\n            }\n        };\n\n        final ExecutorService pool = getOrCreatePool(ic);\n        \n        if (void.class.isAssignableFrom(returnType))\n        {\n            pool.submit(invocation);\n            return null;\n        }\n        \n        if (COMPLETABLE_FUTURE == null)  // not on java 8 can only be a future\n        {\n            return pool.submit(invocation);\n        }\n\n        // java 8, use CompletableFuture, it impl CompletionStage and Future so everyone is happy\n        final Object completableFuture = COMPLETABLE_FUTURE.newInstance();\n        pool.submit(new J8PromiseCompanionTask(completableFuture, invocation));\n        // TODO: handle cancel\n        return completableFuture;\n    }\n\n    protected ExecutorService getOrCreatePool(final InvocationContext ic)\n    {\n        final Method method = ic.getMethod();\n        ExecutorService executorService = configByMethod.get(method);\n        if (executorService == null)\n        {\n            final AnnotatedType<?> annotatedType = beanManager.createAnnotatedType(method.getDeclaringClass());\n            final AnnotatedMethod<?> annotatedMethod = AnnotatedMethods.findMethod(annotatedType, method);\n            final Futureable methodConfig = annotatedMethod.getAnnotation(Futureable.class);\n            final ExecutorService instance = manager.find(\n                    (methodConfig == null ? annotatedType.getAnnotation(Futureable.class) : methodConfig).value());\n            configByMethod.putIfAbsent(method, instance);\n            executorService = instance;\n        }\n        return executorService;\n    }\n\n    private static final class CallKey\n    {\n        private final InvocationContext ic;\n        private final int hash;\n\n        private CallKey(final InvocationContext ic)\n        {\n            this.ic = ic;\n\n            final Object[] parameters = ic.getParameters();\n            this.hash = ic.getMethod().hashCode() + (parameters == null ? 0 : Arrays.hashCode(parameters));\n        }\n\n        @Override\n        public boolean equals(final Object o)\n        {\n            return this == o || !(o == null || getClass() != o.getClass()) && equals(ic, CallKey.class.cast(o).ic);\n        }\n\n        @Override\n        public int hashCode()\n        {\n            return hash;\n        }\n\n        private boolean equals(final InvocationContext ic1, final InvocationContext ic2)\n        {\n            final Object[] parameters1 = ic1.getParameters();\n            final Object[] parameters2 = ic2.getParameters();\n            return ic2.getMethod().equals(ic1.getMethod()) &&\n                    (parameters1 == parameters2 ||\n                    (parameters1 != null && parameters2 != null && Arrays.equals(parameters1, ic2.getParameters())));\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/future/FutureableInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.future;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.core.api.future.Futureable;\nimport org.apache.deltaspike.core.spi.future.FutureableStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@Interceptor\n@Futureable\n@Priority(1000)\npublic class FutureableInterceptor implements Serializable\n{\n    @Inject\n    private FutureableStrategy futureableStrategy;\n\n    @AroundInvoke\n    public Object invoke(final InvocationContext ic) throws Exception\n    {\n        return futureableStrategy.execute(ic);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/future/J8PromiseCompanionTask.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.future;\n\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.concurrent.Callable;\n\nclass J8PromiseCompanionTask<T> implements Runnable\n{\n    private static final Method COMPLETABLE_FUTURE_COMPLETE;\n    private static final Method COMPLETABLE_FUTURE_COMPLETE_ERROR;\n\n    static\n    {\n        Class<?> completableFutureClass = null;\n        Method completableFutureComplete = null;\n        Method completableFutureCompleteError = null;\n        try\n        {\n            final ClassLoader classLoader = ClassLoader.getSystemClassLoader();\n            completableFutureClass = classLoader.loadClass(\"java.util.concurrent.CompletableFuture\");\n            completableFutureComplete = completableFutureClass.getMethod(\"complete\", Object.class);\n            completableFutureCompleteError = completableFutureClass.getMethod(\"completeExceptionally\", Throwable.class);\n        }\n        catch (final Exception e)\n        {\n            // not on java 8\n        }\n        COMPLETABLE_FUTURE_COMPLETE = completableFutureComplete;\n        COMPLETABLE_FUTURE_COMPLETE_ERROR = completableFutureCompleteError;\n    }\n\n    private Object dep;\n    private Callable<T> fn;\n\n    J8PromiseCompanionTask(final Object dep, Callable<T> fn)\n    {\n        this.dep = dep;\n        this.fn = fn;\n    }\n\n    public void run()\n    {\n        try\n        {\n            COMPLETABLE_FUTURE_COMPLETE.invoke(dep, fn.call());\n        }\n        catch (final InvocationTargetException e)\n        {\n            try\n            {\n                COMPLETABLE_FUTURE_COMPLETE_ERROR.invoke(dep, e.getCause());\n            }\n            catch (IllegalAccessException e1)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e1);\n            }\n            catch (final InvocationTargetException e1)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e1.getCause());\n            }\n        }\n        catch (Exception e)\n        {\n            try\n            {\n                COMPLETABLE_FUTURE_COMPLETE_ERROR.invoke(dep, e);\n            }\n            catch (IllegalAccessException e1)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e1);\n            }\n            catch (final InvocationTargetException e1)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e1.getCause());\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/future/ThreadPoolManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.future;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Set;\nimport java.util.concurrent.ArrayBlockingQueue;\nimport java.util.concurrent.BlockingQueue;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.LinkedBlockingQueue;\nimport java.util.concurrent.RejectedExecutionHandler;\nimport java.util.concurrent.SynchronousQueue;\nimport java.util.concurrent.ThreadFactory;\nimport java.util.concurrent.ThreadPoolExecutor;\nimport java.util.concurrent.TimeUnit;\n\nimport static java.util.Arrays.asList;\n\n@ApplicationScoped\npublic class ThreadPoolManager\n{\n    private final ConcurrentMap<String, ExecutorService> pools = new ConcurrentHashMap<String, ExecutorService>();\n    private final Collection<CreationalContext<?>> contexts = new ArrayList<CreationalContext<?>>(8);\n    private volatile boolean closed = false;\n\n    @Inject\n    private BeanManager beanManager;\n\n    @PreDestroy\n    private void shutdown()\n    {\n        closed = true;\n        final long timeout = CoreBaseConfig.TimeoutCustomization.FUTUREABLE_TERMINATION_TIMEOUT_IN_MILLISECONDS;\n        for (final ExecutorService es : pools.values())\n        {\n            es.shutdown();\n        }\n        for (final ExecutorService es : pools.values())\n        {\n            try\n            {\n                es.awaitTermination(timeout, TimeUnit.MILLISECONDS);\n            }\n            catch (final InterruptedException e)\n            {\n                Thread.interrupted();\n            }\n        }\n        pools.clear();\n\n        for (final CreationalContext<?> ctx : contexts)\n        {\n            ctx.release();\n        }\n        contexts.clear();\n    }\n\n    public ExecutorService find(final String name)\n    {\n        if (closed)\n        {\n            throw new IllegalStateException(\"Container is shutting down\");\n        }\n        ExecutorService pool = pools.get(name);\n        if (pool == null)\n        {\n            synchronized (this)\n            {\n                pool = pools.get(name);\n                if (pool == null)\n                {\n                    // the instantiation does the following:\n                    // 1. check if there is a named bean matching this name using @Default qualifier\n                    // 2. check if there is a JNDI entry (ManagedExecutorService case) matching this name\n                    // 3. create a new executor service based on the DS-config\n\n                    // 1.\n                    final Set<Bean<?>> beans = beanManager.getBeans(name);\n                    if (beans != null && !beans.isEmpty())\n                    {\n                        final Bean<?> bean = beanManager.resolve(beans);\n                        if (bean.getTypes().contains(ExecutorService.class))\n                        {\n                            final CreationalContext<Object> creationalContext =\n                                    beanManager.createCreationalContext(null);\n                            if (!beanManager.isNormalScope(bean.getScope()))\n                            {\n                                contexts.add(creationalContext);\n                            }\n                            pool = ExecutorService.class.cast(beanManager.getReference(\n                                    bean, ExecutorService.class, creationalContext));\n                        }\n                    }\n\n                    if (pool == null) // 2.\n                    {\n                        for (final String prefix : asList(\n                                \"\", \"java:app/\", \"java:global/\", \"java:global/threads/\",\n                                \"java:global/deltaspike/\", \"java:\"))\n                        {\n                            try\n                            {\n                                final Object instance = new InitialContext().lookup(prefix + name);\n                                if (ExecutorService.class.isInstance(instance))\n                                {\n                                    pool = ExecutorService.class.cast(instance);\n                                    break;\n                                }\n                            }\n                            catch (final NamingException e)\n                            {\n                                // no-op\n                            }\n                        }\n                    }\n\n                    if (pool == null) // 3.\n                    {\n                        final String configPrefix = \"futureable.pool.\" + name + \".\";\n                        final int coreSize = ConfigResolver.resolve(configPrefix + \"coreSize\")\n                                .as(Integer.class)\n                                .withDefault(Math.max(2, Runtime.getRuntime().availableProcessors()))\n                                .getValue();\n                        final int maxSize = ConfigResolver.resolve(configPrefix + \"maxSize\")\n                                .as(Integer.class)\n                                .withDefault(coreSize)\n                                .getValue();\n                        final long keepAlive = ConfigResolver.resolve(configPrefix + \"keepAlive.value\")\n                                .as(Long.class)\n                                .withDefault(0L)\n                                .getValue();\n                        final String keepAliveUnit = ConfigResolver.resolve(configPrefix + \"keepAlive.unit\")\n                                .as(String.class)\n                                .withDefault(\"MILLISECONDS\")\n                                .getValue();\n\n                        final String queueType = ConfigResolver.resolve(configPrefix + \"queue.type\")\n                                .as(String.class)\n                                .withDefault(\"LINKED\")\n                                .getValue();\n                        final BlockingQueue<Runnable> queue;\n                        if (\"ARRAY\".equalsIgnoreCase(queueType))\n                        {\n                            final int size = ConfigResolver.resolve(configPrefix + \"queue.size\")\n                                    .as(Integer.class)\n                                    .withDefault(1024)\n                                    .getValue();\n                            final boolean fair = ConfigResolver.resolve(configPrefix + \"queue.fair\")\n                                    .as(Boolean.class)\n                                    .withDefault(false)\n                                    .getValue();\n                            queue = new ArrayBlockingQueue<Runnable>(size, fair);\n                        }\n                        else if (\"SYNCHRONOUS\".equalsIgnoreCase(queueType))\n                        {\n                            final boolean fair = ConfigResolver.resolve(configPrefix + \"queue.fair\")\n                                    .as(Boolean.class)\n                                    .withDefault(false)\n                                    .getValue();\n                            queue = new SynchronousQueue<Runnable>(fair);\n                        }\n                        else\n                        {\n                            final int capacity = ConfigResolver.resolve(configPrefix + \"queue.capacity\")\n                                    .as(Integer.class)\n                                    .withDefault(Integer.MAX_VALUE)\n                                    .getValue();\n                            queue = new LinkedBlockingQueue<Runnable>(capacity);\n                        }\n\n                        final String threadFactoryName = ConfigResolver.getPropertyValue(\n                                configPrefix + \"threadFactory.name\");\n                        final ThreadFactory threadFactory;\n                        if (threadFactoryName != null)\n                        {\n                            threadFactory = lookupByName(threadFactoryName, ThreadFactory.class);\n                        }\n                        else\n                        {\n                            threadFactory = Executors.defaultThreadFactory();\n                        }\n\n                        final String rejectedHandlerName = ConfigResolver.getPropertyValue(\n                                configPrefix + \"rejectedExecutionHandler.name\");\n                        final RejectedExecutionHandler rejectedHandler;\n                        if (rejectedHandlerName != null)\n                        {\n                            rejectedHandler = lookupByName(rejectedHandlerName, RejectedExecutionHandler.class);\n                        }\n                        else\n                        {\n                            rejectedHandler = new ThreadPoolExecutor.AbortPolicy();\n                        }\n\n                        pool = new ThreadPoolExecutor(\n                                coreSize, maxSize,\n                                keepAlive, TimeUnit.valueOf(keepAliveUnit),\n                                queue, threadFactory, rejectedHandler);\n                    }\n\n                    pools.put(name, pool);\n                }\n            }\n        }\n        return pool;\n    }\n\n    private <T> T lookupByName(final String name, final Class<T> type)\n    {\n        final Set<Bean<?>> tfb = beanManager.getBeans(name);\n        final Bean<?> bean = beanManager.resolve(tfb);\n        final CreationalContext<?> ctx = beanManager.createCreationalContext(null);\n        if (!beanManager.isNormalScope(bean.getScope()))\n        {\n            contexts.add(ctx);\n        }\n        return type.cast(beanManager.getReference(bean, type, ctx));\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/GlobalInterceptorWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.interceptor;\n\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nclass GlobalInterceptorWrapper implements AnnotatedType<Object>\n{\n    private final AnnotatedType wrapped;\n    private Map<Class<? extends Annotation>, Annotation> annotations;\n    private Set<Annotation> annotationSet;\n\n    GlobalInterceptorWrapper(AnnotatedType wrapped,\n                             Annotation priorityAnnotation)\n    {\n        this.wrapped = wrapped;\n        Set<Annotation> originalAnnotationSet = wrapped.getAnnotations();\n        this.annotations = new HashMap<Class<? extends Annotation>, Annotation>(originalAnnotationSet.size());\n\n        for (Annotation originalAnnotation : originalAnnotationSet)\n        {\n            this.annotations.put(originalAnnotation.annotationType(), originalAnnotation);\n        }\n\n        this.annotations.put(priorityAnnotation.annotationType(), priorityAnnotation);\n\n        this.annotationSet = new HashSet<Annotation>(this.annotations.size());\n        this.annotationSet.addAll(this.annotations.values());\n    }\n\n    @Override\n    public Class getJavaClass()\n    {\n        return wrapped.getJavaClass();\n    }\n\n    @Override\n    public Set getConstructors()\n    {\n        return wrapped.getConstructors();\n    }\n\n    @Override\n    public Set getMethods()\n    {\n        return wrapped.getMethods();\n    }\n\n    @Override\n    public Set getFields()\n    {\n        return wrapped.getFields();\n    }\n\n    @Override\n    public Type getBaseType()\n    {\n        return wrapped.getBaseType();\n    }\n\n    @Override\n    public Set<Type> getTypeClosure()\n    {\n        return wrapped.getTypeClosure();\n    }\n\n    @Override\n    public <T extends Annotation> T getAnnotation(Class<T> targetClass)\n    {\n        return (T) this.annotations.get(targetClass);\n    }\n\n    @Override\n    public Set<Annotation> getAnnotations()\n    {\n        return this.annotationSet;\n    }\n\n    @Override\n    public boolean isAnnotationPresent(Class<? extends Annotation> targetClass)\n    {\n        return this.annotations.containsKey(targetClass);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/AnnotationRule.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.interceptor.interdyn;\n\n\nimport java.lang.annotation.Annotation;\n\n/**\n * Contains a mapping between a dynamic interceptor rule and the name of the additional annotation to be added\n */\n\npublic class AnnotationRule\n{\n    /**\n     * A RegExp to identify the classes which should get modified\n     */\n    private String rule;\n\n    /**\n     * The Annotation to be added\n     */\n    private Annotation additionalAnnotation;\n\n    private boolean requiresProxy;\n\n    public AnnotationRule(String rule, Annotation interceptorBinding, boolean requiresProxy)\n    {\n        this.rule = rule;\n        this.additionalAnnotation = interceptorBinding;\n        this.requiresProxy = requiresProxy;\n    }\n\n    public String getRule()\n    {\n        return rule;\n    }\n\n    public Annotation getAdditionalAnnotation()\n    {\n        return additionalAnnotation;\n    }\n\n    public boolean requiresProxy()\n    {\n        return requiresProxy;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/InterDynExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.interceptor.interdyn;\n\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\n/**\n * <p>InterDyn is a CDI (JSR-299) Extension for dynamically\n * applying annotations (e.g. CDI interceptors) to a class.</p>\n *\n * The main usage is to apply Interceptors per regExp, thus the name.\n *\n */\npublic class InterDynExtension implements Deactivatable, Extension\n{\n    private List<AnnotationRule> interceptorRules = new ArrayList<AnnotationRule>();\n\n\n    private Logger logger = Logger.getLogger(InterDynExtension.class.getName());\n\n    private Map<String, Annotation> usedInterceptorBindings = new HashMap<String, Annotation>();\n\n    private boolean enabled = false;\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager)\n    {\n        if (!ClassDeactivationUtils.isActivated(getClass()))\n        {\n            return;\n        }\n\n        enabled = CoreBaseConfig.InterDynCustomization.INTERDYN_ENABLED.getValue();\n\n        if (enabled)\n        {\n            logger.info(\"Starting with deltaspike.interdyn instrumentation\");\n            init();\n        }\n    }\n\n    public void init()\n    {\n        Set<String> ruleConfigKeys = new HashSet<String>();\n\n        // first we collect all the rule property names\n        for (String propertyName : ConfigResolver.getAllProperties().keySet())\n        {\n            if (propertyName.startsWith(CoreBaseConfig.InterDynCustomization.INTERDYN_RULE_PREFIX) &&\n                propertyName.contains(\".match\"))\n            {\n                ruleConfigKeys.add(propertyName.substring(0, propertyName.indexOf(\".match\")));\n            }\n        }\n\n        for (String ruleConfigKey : ruleConfigKeys)\n        {\n            String match = ConfigResolver.getPropertyValue(ruleConfigKey + \".match\");\n            String annotationClassName = ConfigResolver.getPropertyValue(ruleConfigKey + \".annotation\");\n\n            if (match != null && annotationClassName != null &&\n                match.length() > 0 && annotationClassName.length() > 0)\n            {\n                Annotation anno = getAnnotationImplementation(annotationClassName);\n                boolean requiresProxy = anno.annotationType().getAnnotation(InterceptorBinding.class) != null;\n                interceptorRules.add(new AnnotationRule(match, anno, requiresProxy));\n            }\n        }\n\n\n        if (interceptorRules.isEmpty())\n        {\n            enabled = false;\n        }\n    }\n\n    public void processAnnotatedType(@Observes ProcessAnnotatedType pat)\n    {\n        if (enabled)\n        {\n            AnnotatedType at = pat.getAnnotatedType();\n            String beanClassName = at.getJavaClass().getName();\n            for (AnnotationRule rule : interceptorRules)\n            {\n                if (beanClassName.matches(rule.getRule()))\n                {\n                    if (rule.requiresProxy() && !ClassUtils.isProxyableClass(at.getJavaClass()))\n                    {\n                        logger.info(\"Skipping unproxyable class \" + beanClassName +\n                                \" even if matches rule=\" + rule.getRule());\n                        return;\n                    }\n\n                    pat.configureAnnotatedType()\n                        .add(rule.getAdditionalAnnotation());\n                    logger.info(\"Adding Dynamic Interceptor \" + rule.getAdditionalAnnotation()\n                            + \" to class \" + beanClassName );\n                }\n            }\n        }\n    }\n\n    private Annotation getAnnotationImplementation(String interceptorBindingClassName)\n    {\n        Annotation ann = usedInterceptorBindings.get(interceptorBindingClassName);\n\n        if (ann == null)\n        {\n            Class<? extends Annotation> annClass;\n            try\n            {\n                annClass = (Class<? extends Annotation>)\n                        ClassUtils.getClassLoader(null).loadClass(interceptorBindingClassName);\n            }\n            catch (ClassNotFoundException e)\n            {\n                throw new RuntimeException(\"Error while picking up dynamic InterceptorBindingType for class\" +\n                                           interceptorBindingClassName, e);\n            }\n            ann = AnnotationInstanceProvider.of(annClass);\n            usedInterceptorBindings.put(interceptorBindingClassName, ann);\n        }\n        return ann;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interpreter/PropertyExpressionInterpreter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.interpreter;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.interpreter.BasePropertyExpressionInterpreter;\n\n/**\n * Interpreter which uses the lookup chain of DeltaSpike for configured values\n */\npublic class PropertyExpressionInterpreter extends BasePropertyExpressionInterpreter\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    protected String getConfiguredValue(String key)\n    {\n        return ConfigResolver.getProjectStageAwarePropertyValue(key);\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/AttributeAccessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.jmx;\n\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\n/**\n * Just a helper class mapping a JMX attribute.\n * It make the link between the attribute and its accessors validating\n * operations (read/write) are possible.\n */\npublic class AttributeAccessor\n{\n    private final Method getter;\n    private final Method setter;\n    private final boolean presentAsTabularIfPossible;\n\n    public AttributeAccessor(final Method get, final Method set, final boolean presentAsTabularIfPossible)\n    {\n        this.setter = set;\n        this.getter = get;\n        this.presentAsTabularIfPossible = presentAsTabularIfPossible;\n    }\n\n    public boolean isPresentAsTabularIfPossible()\n    {\n        return presentAsTabularIfPossible;\n    }\n\n    public Object get(final Object instance) throws InvocationTargetException, IllegalAccessException\n    {\n        if (getter == null)\n        {\n            throw new IllegalAccessException(\"This attribute has no getter\");\n        }\n        return getter.invoke(instance);\n    }\n\n    public void set(final Object instance, final Object value) throws InvocationTargetException, IllegalAccessException\n    {\n        if (setter == null)\n        {\n            throw new IllegalAccessException(\"This attribute has no setter\");\n        }\n        setter.invoke(instance, value);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/BroadcasterProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.jmx.JmxBroadcaster;\nimport org.apache.deltaspike.core.api.jmx.MBean;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class BroadcasterProducer\n{\n    @Inject\n    private MBeanExtension extension;\n\n    @Produces\n    @Dependent\n    public JmxBroadcaster jmxBroadcaster(final InjectionPoint ip)\n    {\n        final Class<?> declaringClass = ip.getMember().getDeclaringClass();\n        final JmxBroadcaster broadcaster = extension.getBroadcasterFor(declaringClass);\n        if (broadcaster == null)\n        {\n            //TODO discuss validation during bootstrapping\n            throw new IllegalStateException(\"Invalid injection of \" + JmxBroadcaster.class.getName() +\n                    \" in \" + declaringClass.getName() + \" detected. It is required to annotate the class with @\" +\n                    MBean.class.getName());\n        }\n        return broadcaster;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/DynamicMBeanWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.jmx.JmxBroadcaster;\nimport org.apache.deltaspike.core.api.jmx.JmxManaged;\nimport org.apache.deltaspike.core.api.jmx.JmxParameter;\nimport org.apache.deltaspike.core.api.jmx.MBean;\nimport org.apache.deltaspike.core.api.jmx.NotificationInfo;\nimport org.apache.deltaspike.core.api.jmx.Table;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ParameterUtil;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport javax.management.Attribute;\nimport javax.management.AttributeList;\nimport javax.management.AttributeNotFoundException;\nimport javax.management.DynamicMBean;\nimport javax.management.ImmutableDescriptor;\nimport javax.management.InvalidAttributeValueException;\nimport javax.management.MBeanAttributeInfo;\nimport javax.management.MBeanException;\nimport javax.management.MBeanFeatureInfo;\nimport javax.management.MBeanInfo;\nimport javax.management.MBeanNotificationInfo;\nimport javax.management.MBeanOperationInfo;\nimport javax.management.MBeanParameterInfo;\nimport javax.management.Notification;\nimport javax.management.NotificationBroadcasterSupport;\nimport javax.management.ReflectionException;\nimport javax.management.openmbean.CompositeDataSupport;\nimport javax.management.openmbean.CompositeType;\nimport javax.management.openmbean.OpenDataException;\nimport javax.management.openmbean.OpenType;\nimport javax.management.openmbean.SimpleType;\nimport javax.management.openmbean.TabularData;\nimport javax.management.openmbean.TabularDataSupport;\nimport javax.management.openmbean.TabularType;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * This class is the MBean implementation of a CDI bean.\n * It basically delegates to a CDI instance.\n */\npublic class DynamicMBeanWrapper extends NotificationBroadcasterSupport implements DynamicMBean, JmxBroadcaster\n{\n    public static final Logger LOGGER = Logger.getLogger(DynamicMBeanWrapper.class.getName());\n\n    private final MBeanInfo info;\n    private final Map<String, AttributeAccessor> fields = new HashMap<String, AttributeAccessor>();\n    private final Map<String, Operation> operations = new HashMap<String, Operation>();\n    private final ClassLoader classloader;\n    private final Class<?> clazz;\n    private final boolean normalScope;\n\n    private final Annotation[] qualifiers;\n\n    private Object instance = null;\n\n    /**\n     * The constructor is the builder for the MBean. All the MBean parsing logic is done here.\n     *\n     * @param annotatedMBean the class of the CDI managed bean\n     * @param normalScope is the CDI bean @Dependent or not\n     * @param qualifiers qualfiers of the CDI bean (used to retrieve it)\n     */\n    public DynamicMBeanWrapper(final Class<?> annotatedMBean,\n                               final boolean normalScope,\n                               final Annotation[] qualifiers)\n    {\n        this.clazz = annotatedMBean;\n        this.classloader = Thread.currentThread().getContextClassLoader();\n        this.normalScope = normalScope;\n        this.qualifiers = qualifiers;\n\n        final List<MBeanAttributeInfo> attributeInfos = new ArrayList<MBeanAttributeInfo>();\n        final List<MBeanOperationInfo> operationInfos = new ArrayList<MBeanOperationInfo>();\n        final List<MBeanNotificationInfo> notificationInfos = new ArrayList<MBeanNotificationInfo>();\n\n        // class\n        final String description =\n            getDescription(annotatedMBean.getAnnotation(MBean.class).description(), annotatedMBean.getName());\n\n        final NotificationInfo notification = annotatedMBean.getAnnotation(NotificationInfo.class);\n        if (notification != null)\n        {\n            notificationInfos.add(getNotificationInfo(notification, annotatedMBean.getName()));\n        }\n\n        final NotificationInfo.List notifications = annotatedMBean.getAnnotation(NotificationInfo.List.class);\n        if (notifications != null)\n        {\n            for (NotificationInfo notificationInfo : notifications.value())\n            {\n                notificationInfos.add(getNotificationInfo(notificationInfo, annotatedMBean.getName()));\n            }\n        }\n\n\n        // methods\n        for (Method method : annotatedMBean.getMethods())\n        {\n            final int modifiers = method.getModifiers();\n            final JmxManaged annotation = method.getAnnotation(JmxManaged.class);\n            if (method.getDeclaringClass().equals(Object.class)\n                    || !Modifier.isPublic(modifiers)\n                    || Modifier.isAbstract(modifiers)\n                    || Modifier.isStatic(modifiers)\n                    || annotation == null)\n            {\n                continue;\n            }\n\n            operations.put(method.getName(), new Operation(method, annotation.convertToTabularData()));\n\n            String operationDescr = getDescription(annotation.description(), method.getName());\n            \n            Annotation[][] parametersAnnotations = method.getParameterAnnotations();\n            Class<?>[] parameterTypes = method.getParameterTypes();\n            MBeanParameterInfo[] parameterInfos = new MBeanParameterInfo[parameterTypes.length];\n            for (int i = 0; i < parametersAnnotations.length; i++)\n            {\n                String parameterDescription = null;\n                String parameterName = \"p\" + (i + 1);\n                String java8ParameterName = ParameterUtil.getName(method, i);\n                if (java8ParameterName != null)\n                {\n                    parameterName = java8ParameterName;\n                }\n                for (int j = 0; j < parametersAnnotations[i].length; j++)\n                {\n                    if (parametersAnnotations[i][j] instanceof JmxParameter)\n                    {\n                        JmxParameter jmxParameter = (JmxParameter) parametersAnnotations[i][j];\n                        if (!\"\".equals(jmxParameter.name()))\n                        {\n                            parameterName = jmxParameter.name();\n                        }\n                        if (!\"\".equals(jmxParameter.description()))\n                        {\n                            parameterDescription = jmxParameter.description();\n                        }\n                    }\n                }\n                parameterInfos[i] = new MBeanParameterInfo(parameterName,\n                    parameterTypes[i].getName(),\n                    parameterDescription\n                );\n            }\n\n            operationInfos.add(new MBeanOperationInfo(method.getName(),\n                operationDescr,\n                parameterInfos,\n                method.getReturnType().getName(),\n                MBeanOperationInfo.UNKNOWN\n            ));\n        }\n\n        Class<?> clazz = annotatedMBean;\n        while (!Object.class.equals(clazz) && clazz != null)\n        {\n            for (Field field : clazz.getDeclaredFields())\n            {\n                final JmxManaged annotation = field.getAnnotation(JmxManaged.class);\n                if (annotation != null)\n                {\n                    field.setAccessible(true);\n\n                    final String fieldName = field.getName();\n                    final String fieldDescription = getDescription(annotation.description(), fieldName);\n                    final Class<?> type = field.getType();\n\n                    final String methodName;\n                    if (fieldName.length() > 1)\n                    {\n                        methodName = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);\n                    }\n                    else\n                    {\n                        methodName = Character.toString(Character.toUpperCase(fieldName.charAt(0)));\n                    }\n\n                    Method setter = null;\n                    Method getter = null;\n                    try\n                    {\n                        getter = clazz.getMethod(\"get\" + methodName);\n                    }\n                    catch (NoSuchMethodException e1)\n                    {\n                        try\n                        {\n                            getter = clazz.getMethod(\"is\" + methodName);\n                        }\n                        catch (NoSuchMethodException e2)\n                        {\n                            // ignored\n                        }\n                    }\n                    try\n                    {\n                        setter = clazz.getMethod(\"set\" + methodName, field.getType());\n                    }\n                    catch (NoSuchMethodException e)\n                    {\n                        // ignored\n                    }\n\n                    attributeInfos.add(new MBeanAttributeInfo(\n                        fieldName, toMBeanType(type).getName(), fieldDescription,\n                            getter != null, setter != null, false));\n\n                    fields.put(fieldName, new AttributeAccessor(getter, setter, annotation.convertToTabularData()));\n                }\n            }\n            clazz = clazz.getSuperclass();\n        }\n\n        Collections.sort(attributeInfos, MBeanFeatureInfoSorter.INSTANCE);\n        Collections.sort(operationInfos, MBeanFeatureInfoSorter.INSTANCE);\n        Collections.sort(notificationInfos, MBeanFeatureInfoSorter.INSTANCE);\n\n        info = new MBeanInfo(annotatedMBean.getName(),\n                description,\n                attributeInfos.toArray(new MBeanAttributeInfo[attributeInfos.size()]),\n                null, // default constructor is mandatory\n                operationInfos.toArray(new MBeanOperationInfo[operationInfos.size()]),\n                notificationInfos.toArray(new MBeanNotificationInfo[notificationInfos.size()]));\n    }\n\n    private Class<?> toMBeanType(final Class<?> type)\n    {\n        if (Map.class.isAssignableFrom(type) || Table.class.isAssignableFrom(type))\n        {\n            return TabularData.class;\n        }\n        return type;\n    }\n\n    private MBeanNotificationInfo getNotificationInfo(final NotificationInfo notificationInfo, String sourceInfo)\n    {\n        return new MBeanNotificationInfo(\n            notificationInfo.types(),\n            notificationInfo.notificationClass().getName(),\n            getDescription(notificationInfo.description(), sourceInfo),\n            new ImmutableDescriptor(notificationInfo.descriptorFields()));\n    }\n\n    private String getDescription(final String description, String defaultDescription)\n    {\n        if (description.isEmpty())\n        {\n            return defaultDescription;\n        }\n\n        String descriptionValue = description.trim();\n\n        if (descriptionValue.startsWith(\"{\") && descriptionValue.endsWith(\"}\"))\n        {\n            return ConfigResolver.getPropertyValue(\n                descriptionValue.substring(1, descriptionValue.length() - 1), defaultDescription);\n        }\n        return description;\n    }\n\n    @Override\n    public MBeanInfo getMBeanInfo()\n    {\n        return info;\n    }\n\n    @Override\n    public Object getAttribute(final String attribute)\n        throws AttributeNotFoundException, MBeanException, ReflectionException\n    {\n        if (fields.containsKey(attribute))\n        {\n            final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();\n            Thread.currentThread().setContextClassLoader(classloader);\n            try\n            {\n                final AttributeAccessor attributeAccessor = fields.get(attribute);\n                final Object value = attributeAccessor.get(instance());\n                return attributeAccessor.isPresentAsTabularIfPossible() ? toResult(attribute, value) : value;\n            }\n            catch (IllegalArgumentException e)\n            {\n                LOGGER.log(Level.SEVERE, \"can't get \" + attribute + \" value\", e);\n            }\n            catch (IllegalAccessException e)\n            {\n                LOGGER.log(Level.SEVERE, \"can't get \" + attribute + \" value\", e);\n            }\n            catch (InvocationTargetException e)\n            {\n                LOGGER.log(Level.SEVERE, \"can't get \" + attribute + \" value\", e);\n            }\n            finally\n            {\n                Thread.currentThread().setContextClassLoader(oldCl);\n            }\n        }\n        throw new AttributeNotFoundException();\n    }\n\n    private Object toResult(final String attribute, final Object value)\n        throws InvocationTargetException, IllegalAccessException\n    {\n        if (Map.class.isInstance(value))\n        {\n            Map map = Map.class.cast(value);\n            return toTabularData(attribute, attribute, new Table().withColumns(map.keySet()).withLine(map.values()));\n        }\n        if (Table.class.isInstance(value))\n        {\n            return toTabularData(attribute, attribute, Table.class.cast(value));\n        }\n        return value;\n    }\n\n    private TabularData toTabularData(final String typeName, final String description, final Table table)\n    {\n        final OpenType<?>[] types = new OpenType<?>[table.getColumnNames().size()];\n        for (int i = 0; i < types.length; i++)\n        {\n            types[i] = SimpleType.STRING;\n        }\n\n        try\n        {\n            final String[] keys = table.getColumnNames().toArray(new String[table.getColumnNames().size()]);\n            final CompositeType ct = new CompositeType(\n                    typeName, description, keys, keys, types);\n            final TabularType type = new TabularType(typeName, description, ct, keys);\n            final TabularDataSupport data = new TabularDataSupport(type);\n            for (final Collection<String> line : table.getLines())\n            {\n                data.put(new CompositeDataSupport(ct, keys, line.toArray(new Object[line.size()])));\n            }\n            return data;\n        }\n        catch (final OpenDataException e)\n        {\n            throw new IllegalArgumentException(e);\n        }\n    }\n\n    @Override\n    public void setAttribute(final Attribute attribute)\n        throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException\n    {\n        if (fields.containsKey(attribute.getName()))\n        {\n            final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();\n            Thread.currentThread().setContextClassLoader(classloader);\n            try\n            {\n                fields.get(attribute.getName()).set(instance(), attribute.getValue());\n            }\n            catch (IllegalArgumentException e)\n            {\n                LOGGER.log(Level.SEVERE, \"can't set \" + attribute + \" value\", e);\n            }\n            catch (IllegalAccessException e)\n            {\n                LOGGER.log(Level.SEVERE, \"can't set \" + attribute + \" value\", e);\n            }\n            catch (InvocationTargetException e)\n            {\n                LOGGER.log(Level.SEVERE, \"can't set \" + attribute + \" value\", e);\n            }\n            finally\n            {\n                Thread.currentThread().setContextClassLoader(oldCl);\n            }\n        }\n        else\n        {\n            throw new AttributeNotFoundException();\n        }\n    }\n\n    @Override\n    public AttributeList getAttributes(final String[] attributes)\n    {\n        final AttributeList list = new AttributeList();\n        for (String n : attributes)\n        {\n            try\n            {\n                list.add(new Attribute(n, getAttribute(n)));\n            }\n            catch (Exception ignore)\n            {\n                // no-op\n            }\n        }\n        return list;\n    }\n\n    @Override\n    public AttributeList setAttributes(final AttributeList attributes)\n    {\n        final AttributeList list = new AttributeList();\n        for (Object o : attributes)\n        {\n            final Attribute attr = (Attribute) o;\n            try\n            {\n                setAttribute(attr);\n                list.add(attr);\n            }\n            catch (Exception ignore)\n            {\n                // no-op\n            }\n        }\n        return list;\n    }\n\n    @Override\n    public Object invoke(final String actionName, final Object[] params, final String[] signature)\n        throws MBeanException, ReflectionException\n    {\n        if (operations.containsKey(actionName))\n        {\n            final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();\n            Thread.currentThread().setContextClassLoader(classloader);\n            try\n            {\n                final Operation operation = operations.get(actionName);\n                final Object result = operation.getOperation().invoke(instance(), params);\n                return operation.isPresentAsTabularIfPossible() ? toResult(actionName, result) : result;\n            }\n            catch (InvocationTargetException e)\n            {\n                final Throwable cause = e.getCause();\n                if (cause instanceof Error)\n                {\n                    throw (Error) cause;\n                }\n                if (cause instanceof MBeanException)\n                {\n                    throw (MBeanException) cause;\n                }\n                throw new MBeanException((Exception) cause, actionName + \" failed with exception\");\n            }\n            catch (IllegalAccessException e)\n            {\n                throw new ReflectionException(e, actionName + \" could not be invoked\");\n            }\n            catch (IllegalArgumentException e)\n            {\n                throw new ReflectionException(e, actionName + \" could not be invoked\");\n            }\n            finally\n            {\n                Thread.currentThread().setContextClassLoader(oldCl);\n            }\n        }\n        throw new ReflectionException(new NoSuchMethodException(actionName + \" doesn't exist\"));\n    }\n\n    private synchronized Object instance()\n    {\n        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();\n        Thread.currentThread().setContextClassLoader(classloader);\n        try\n        {\n            if (instance != null)\n            {\n                return instance;\n            }\n\n            if (normalScope)\n            {\n                instance = BeanProvider.getContextualReference(clazz, qualifiers);\n            }\n            else\n            {\n                final BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();\n                final Set<Bean<?>> beans = bm.getBeans(clazz, qualifiers);\n                if (beans == null || beans.isEmpty())\n                {\n                    throw new IllegalStateException(\"Could not find beans for Type=\" + clazz\n                            + \" and qualifiers:\" + Arrays.toString(qualifiers));\n                }\n\n                final Bean<?> resolvedBean = bm.resolve(beans);\n                final CreationalContext<?> creationalContext = bm.createCreationalContext(resolvedBean);\n                instance = bm.getReference(resolvedBean, clazz, creationalContext);\n                creationalContext.release();\n            }\n            return instance;\n        }\n        finally\n        {\n            Thread.currentThread().setContextClassLoader(oldCl);\n        }\n    }\n\n    @Override\n    public void send(final Notification notification)\n    {\n        sendNotification(notification);\n    }\n\n    private static class MBeanFeatureInfoSorter<T extends MBeanFeatureInfo> implements Comparator<T>\n    {\n        private static final Comparator<? super MBeanFeatureInfo> INSTANCE\n            = new MBeanFeatureInfoSorter<MBeanFeatureInfo>();\n\n        @Override\n        public int compare(final T o1, final T o2)\n        {\n            return o1.getName().compareTo(o2.getName());\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/MBeanExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.core.api.jmx.JmxBroadcaster;\nimport org.apache.deltaspike.core.api.jmx.MBean;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.BeanUtils;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.BeforeShutdown;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessManagedBean;\nimport javax.management.MBeanServer;\nimport javax.management.ObjectName;\nimport java.lang.annotation.Annotation;\nimport java.lang.management.ManagementFactory;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.logging.Logger;\n\npublic class MBeanExtension implements Extension, Deactivatable\n{\n    private static final Logger LOGGER = Logger.getLogger(MBeanExtension.class.getName());\n    private static final String DEFAULT_TYPE = \"MBeans\";\n    private static final String DEFAULT_CATEGORY = \"org.apache.deltaspike\";\n\n    private final Map<Class<?>, DynamicMBeanWrapper> wrappers = new ConcurrentHashMap<Class<?>, DynamicMBeanWrapper>();\n\n    private final Collection<ObjectName> objectNames = new ArrayList<ObjectName>();\n\n    private Boolean isActivated = true;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    protected void processBean(@Observes final ProcessManagedBean<?> bean, final BeanManager bm) throws Exception\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        MBean mBeanAnnotation = bean.getAnnotated().getAnnotation(MBean.class);\n        if (mBeanAnnotation != null)\n        {\n            registerObject(bean, mBeanAnnotation, bm);\n        }\n    }\n\n    protected void shutdown(@Observes final BeforeShutdown shutdown) throws Exception\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        final MBeanServer mBeanServer = mBeanServer();\n        for (ObjectName objectName : objectNames)\n        {\n            mBeanServer.unregisterMBean(objectName);\n            LOGGER.info(\"Unregistered MBean \" + objectName.getCanonicalName());\n        }\n        objectNames.clear();\n    }\n\n    private void registerObject(final ProcessManagedBean<?> bean,\n                                final MBean mBeanAnnotation,\n                                final BeanManager bm) throws Exception\n    {\n        final Class<?> clazz = bean.getAnnotatedBeanClass().getJavaClass();\n\n        String objectNameValue = mBeanAnnotation.objectName();\n        if (objectNameValue.isEmpty())\n        {\n            final String type = getConfigurableAttribute(mBeanAnnotation.type(), DEFAULT_TYPE);\n            final String category = getConfigurableAttribute(mBeanAnnotation.category(), DEFAULT_CATEGORY);\n            final String properties = getConfigurableAttribute(mBeanAnnotation.properties(), \"\");\n            final String name = mBeanAnnotation.name();\n\n            final StringBuilder builder = new StringBuilder(category).append(':');\n            if (!properties.contains(\"type=\"))\n            {\n                builder.append(\"type=\").append(type);\n            }\n            else if (!DEFAULT_TYPE.equals(type))\n            {\n                LOGGER.warning(\"type() ignored on \" + clazz + \" since properties contains it.\");\n            }\n            if (!properties.contains(\"name=\"))\n            {\n                if (!name.isEmpty() || properties.isEmpty())\n                {\n                    builder.append(\",name=\");\n                    if (name.isEmpty())\n                    {\n                        builder.append(clazz.getName());\n                    }\n                    else\n                    {\n                        builder.append(name);\n                    }\n                } // else skip. type is important in JMX but name is a fully custom property so we are able to skip it\n            }\n            if (!properties.isEmpty())\n            {\n                builder.append(',').append(properties);\n            }\n            objectNameValue = builder.toString();\n        }\n\n        final ObjectName objectName = new ObjectName(objectNameValue);\n\n        final boolean normalScoped = isNormalScope(bean.getAnnotated().getAnnotations(), bm);\n        final Annotation[] qualifiers = qualifiers(bean.getAnnotatedBeanClass(), bm);\n        final DynamicMBeanWrapper mbean = new DynamicMBeanWrapper(clazz, normalScoped, qualifiers);\n        final MBeanServer server = mBeanServer();\n        if (server.isRegistered(objectName) && CoreBaseConfig.MBeanIntegration.AUTO_UNREGISTER)\n        {\n            server.unregisterMBean(objectName);\n        }\n        server.registerMBean(mbean, objectName);\n\n        objectNames.add(objectName);\n        wrappers.put(clazz, mbean);\n\n        LOGGER.info(\"Registered MBean \" + objectName); // don't use canonical name cause it can reorder properties\n    }\n\n    private Annotation[] qualifiers(final AnnotatedType<?> annotatedBeanClass, final BeanManager bm)\n    {\n        final Set<Annotation> qualifiers = BeanUtils.getQualifiers(bm, annotatedBeanClass.getAnnotations());\n        return qualifiers.toArray(new Annotation[qualifiers.size()]);\n    }\n\n    // annotated doesn't always contain inherited annotations\n    // TODO we have to check the origin of this issue\n    private boolean isNormalScope(final Set<Annotation> annotations, final BeanManager bm)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (bm.isNormalScope(annotation.annotationType()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    JmxBroadcaster getBroadcasterFor(final Class<?> clazz)\n    {\n        return wrappers.get(clazz);\n    }\n\n    private MBeanServer mBeanServer()\n    {\n        return ManagementFactory.getPlatformMBeanServer();\n    }\n\n    private String getConfigurableAttribute(final String annotationAttributeValue, final String defaultValue)\n    {\n        String val = annotationAttributeValue.trim();\n        if (val.startsWith(\"{\") && val.endsWith(\"}\"))\n        {\n            val = ConfigResolver.getPropertyValue(val.substring(1, val.length() - 1), defaultValue);\n        }\n        return val == null || val.isEmpty() ? defaultValue : val;\n    }\n}"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/Operation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.jmx;\n\nimport java.lang.reflect.Method;\n\n/**\n * Just a helper class mapping a JMX operation.\n */\nclass Operation\n{\n    private final Method operation;\n    private final boolean presentAsTabularIfPossible;\n\n    Operation(final Method operation, final boolean presentAsTabularIfPossible)\n    {\n        this.operation = operation;\n        this.presentAsTabularIfPossible = presentAsTabularIfPossible;\n    }\n\n    boolean isPresentAsTabularIfPossible()\n    {\n        return presentAsTabularIfPossible;\n    }\n\n    Method getOperation()\n    {\n        return operation;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/lock/DefaultLockedStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.lock;\n\nimport org.apache.deltaspike.core.spi.lock.LockedStrategy;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.util.concurrent.locks.Lock;\n\n@Dependent\npublic class DefaultLockedStrategy implements LockedStrategy\n{\n    @Inject\n    private LockSupplierStorage lockSupplierStorage;\n\n    @Override\n    public Object execute(InvocationContext ic) throws Exception\n    {\n        final Lock lock = lockSupplierStorage.getLockSupplier(ic).get();\n        try\n        {\n            return ic.proceed();\n        }\n        finally\n        {\n            lock.unlock();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/lock/LockSupplier.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.lock;\n\nimport java.util.concurrent.locks.Lock;\n\ninterface LockSupplier\n{\n    Lock get();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/lock/LockSupplierStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.lock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.api.lock.Locked;\nimport org.apache.deltaspike.core.impl.util.AnnotatedMethods;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.reflect.Method;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.locks.Lock;\nimport java.util.concurrent.locks.ReadWriteLock;\nimport java.util.concurrent.locks.ReentrantReadWriteLock;\n\nimport static org.apache.deltaspike.core.api.lock.Locked.Operation.READ;\n\n@ApplicationScoped\n@Typed(LockSupplierStorage.class)\npublic class LockSupplierStorage implements Locked.LockFactory\n{\n    private final ConcurrentMap<String, ReadWriteLock> locks = new ConcurrentHashMap<String, ReadWriteLock>();\n\n    // read or write\n    private final ConcurrentMap<Method, LockSupplier> lockSuppliers = new ConcurrentHashMap<Method, LockSupplier>();\n\n    @Inject\n    private BeanManager beanManager;\n\n    protected LockSupplier getLockSupplier(final InvocationContext ic)\n    {\n        final Method key = ic.getMethod();\n        LockSupplier operation = lockSuppliers.get(key);\n        if (operation == null)\n        {\n            final Class declaringClass = key.getDeclaringClass();\n            final AnnotatedType<Object> annotatedType = beanManager.createAnnotatedType(declaringClass);\n            final AnnotatedMethod<?> annotatedMethod = AnnotatedMethods.findMethod(annotatedType, key);\n\n            Locked config = annotatedMethod.getAnnotation(Locked.class);\n            if (config == null)\n            {\n                config = annotatedType.getAnnotation(Locked.class);\n            }\n            final Locked.LockFactory factory = config.factory() != Locked.LockFactory.class ?\n                    Locked.LockFactory.class.cast(\n                            beanManager.getReference(beanManager.resolve(\n                                    beanManager.getBeans(\n                                            config.factory())),\n                                    Locked.LockFactory.class, null)) : this;\n\n            final ReadWriteLock writeLock = factory.newLock(annotatedMethod, config.fair());\n            final long timeout = config.timeoutUnit().toMillis(config.timeout());\n            final Lock lock = config.operation() == READ ? writeLock.readLock() : writeLock.writeLock();\n\n            if (timeout > 0)\n            {\n                operation = new LockSupplier()\n                {\n                    @Override\n                    public Lock get()\n                    {\n                        try\n                        {\n                            if (!lock.tryLock(timeout, TimeUnit.MILLISECONDS))\n                            {\n                                throw new IllegalStateException(\"Can't lock for \" + key + \" in \" + timeout + \"ms\");\n                            }\n                        }\n                        catch (final InterruptedException e)\n                        {\n                            Thread.interrupted();\n                            throw new IllegalStateException(\"Locking interrupted\", e);\n                        }\n                        return lock;\n                    }\n                };\n            }\n            else\n            {\n                operation = new LockSupplier()\n                {\n                    @Override\n                    public Lock get()\n                    {\n                        lock.lock();\n                        return lock;\n                    }\n                };\n            }\n\n            final LockSupplier existing = lockSuppliers.putIfAbsent(key, operation);\n            if (existing != null)\n            {\n                operation = existing;\n            }\n        }\n        return operation;\n    }\n\n    @Override\n    public ReadWriteLock newLock(final AnnotatedMethod<?> method, final boolean fair)\n    {\n        final String name = method.getJavaMember().getDeclaringClass().getName();\n        ReadWriteLock lock = locks.get(name);\n        if (lock == null)\n        {\n            lock = new ReentrantReadWriteLock(fair);\n            final ReadWriteLock existing = locks.putIfAbsent(name, lock);\n            if (existing != null)\n            {\n                lock = existing;\n            }\n        }\n        return lock;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/lock/LockedInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.lock;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.core.api.lock.Locked;\nimport org.apache.deltaspike.core.spi.lock.LockedStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@Locked\n@Interceptor\n@Priority(1000)\npublic class LockedInterceptor implements Serializable\n{\n    @Inject\n    private LockedStrategy lockedStrategy;\n\n    @AroundInvoke\n    public Object invoke(final InvocationContext ic) throws Exception\n    {\n        return lockedStrategy.execute(ic);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/DefaultLocaleResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\n\nimport jakarta.enterprise.context.Dependent;\nimport java.io.Serializable;\nimport java.util.Locale;\n\n/**\n * Provide the default implementation for picking up the Locale\n * for messages.\n */\n@Dependent\npublic class DefaultLocaleResolver implements LocaleResolver, Serializable\n{\n    private static final long serialVersionUID = 2075618472090834156L;\n\n    @Override\n    public Locale getLocale()\n    {\n        return Locale.getDefault();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/DefaultMessage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\nimport org.apache.deltaspike.core.api.message.MessageResolver;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Locale;\n\nimport static org.apache.deltaspike.core.api.message.MessageResolver.MISSING_RESOURCE_MARKER;\n\n/**\n * {@inheritDoc}\n */\n@Vetoed\npublic class DefaultMessage implements Message\n{\n    private String messageTemplate;\n    private List<Serializable> arguments = new ArrayList<>();\n\n    private MessageContext messageContext;\n\n    public DefaultMessage(MessageContext messageContext)\n    {\n        reset();\n\n        this.messageContext = messageContext;\n    }\n\n    protected void reset()\n    {\n        messageTemplate = null;\n        arguments = new ArrayList<>();\n    }\n\n    @Override\n    public Message argument(Serializable... arguments)\n    {\n        if (arguments != null)\n        {\n            Collections.addAll(this.arguments, arguments);\n        }\n        return this;\n    }\n\n    @Override\n    public Message template(String messageTemplate)\n    {\n        this.messageTemplate = messageTemplate;\n        return this;\n    }\n\n    @Override\n    public String getTemplate()\n    {\n        return messageTemplate;\n    }\n\n    @Override\n    public Serializable[] getArguments()\n    {\n        return arguments.toArray(new Serializable[arguments.size()]);\n    }\n\n\n\n    @Override\n    public String toString()\n    {\n        return toString((String) null);\n    }\n\n    @Override\n    public String toString(String category)\n    {\n\n        // the string construction happens in 3 phases\n\n        // first try to pickup the message via the MessageResolver\n        String template = getTemplate();\n        if (template == null)\n        {\n            return \"\";\n        }\n\n        String ret = template;\n        MessageResolver messageResolver = messageContext.getMessageResolver();\n        if (messageResolver != null)\n        {\n            String resolvedTemplate = messageResolver.getMessage(messageContext, template, category);\n\n            if (resolvedTemplate == null)\n            {\n                // this means an error happened during message resolving\n                resolvedTemplate = markAsUnresolved(template);\n            }\n            ret = resolvedTemplate;\n            template = resolvedTemplate;\n        }\n\n        // last step is to interpolate the message\n        MessageInterpolator messageInterpolator = messageContext.getMessageInterpolator();\n        if (messageInterpolator != null)\n        {\n            Locale locale = messageContext.getLocale();\n\n            ret = messageInterpolator.interpolate(template, getArguments(), locale);\n        }\n\n        return ret;\n    }\n\n    private String markAsUnresolved(String template)\n    {\n        if (messageTemplate.startsWith(\"{\") && messageTemplate.endsWith(\"}\"))\n        {\n            template = messageTemplate.substring(1, messageTemplate.length() - 1);\n        }\n\n        StringBuilder sb = new StringBuilder(MISSING_RESOURCE_MARKER + template + MISSING_RESOURCE_MARKER);\n        if (getArguments() != null && getArguments().length > 0)\n        {\n            sb.append(\" \").append(Arrays.toString(getArguments()));\n        }\n\n        return sb.toString();\n    }\n\n    @Override\n    public String toString(MessageContext messageContext)\n    {\n        return toString(messageContext, null);\n    }\n\n    @Override\n    public String toString(MessageContext messageContext, String category)\n    {\n        return messageContext.message()\n                .template(getTemplate())\n                .argument(getArguments())\n                .toString(category);\n    }\n\n\n    /**\n     * Attention, the {@link #messageContext} is deliberately not part of the equation!\n     */\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n\n        if (!(o instanceof Message))\n        {\n            return false;\n        }\n\n        Message other = (Message) o;\n\n        if (getTemplate() == null && other.getTemplate() != null)\n        {\n            return false;\n        }\n\n        if (getTemplate() != null && !getTemplate().equals(other.getTemplate()))\n        {\n            return false;\n        }\n\n        //noinspection RedundantIfStatement\n        if (arguments != null\n                ? !Arrays.equals(arguments.toArray(), other.getArguments())\n                : other.getArguments() != null)\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * Attention, the {@link #messageContext} is deliberately not part of the equation!\n     */\n    @Override\n    public int hashCode()\n    {\n        int result = getTemplate().hashCode();\n        result = 31 * result + (arguments != null ? arguments.hashCode() : 0);\n        return result;\n    }\n\n    @Override\n    public Message argumentArray(Serializable[] arguments)\n    {\n        if (arguments != null)\n        {\n            return argument(Arrays.asList(arguments)); \n        }\n        return this;\n    }\n\n    @Override\n    public Message argument(Collection<Serializable> arguments)\n    {\n        if (arguments != null)\n        {\n            this.arguments.addAll(arguments); \n        }\n        return this;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/DefaultMessageContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\nimport org.apache.deltaspike.core.api.message.MessageResolver;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Locale;\n\n@Dependent\n@Typed(MessageContext.class)\nclass DefaultMessageContext implements MessageContext\n{\n    private static final long serialVersionUID = -110779217295211303L;\n\n\n    @Inject\n    private MessageInterpolator messageInterpolator = null;\n\n    @Inject\n    private MessageResolver messageResolver = null;\n\n    @Inject\n    private LocaleResolver localeResolver = null;\n\n    private List<String> messageSources = new ArrayList<String>();\n\n    DefaultMessageContext()\n    {\n    }\n\n    DefaultMessageContext(MessageContext otherMessageContext)\n    {\n        messageInterpolator(otherMessageContext.getMessageInterpolator());\n        localeResolver(otherMessageContext.getLocaleResolver());\n        messageResolver(otherMessageContext.getMessageResolver());\n\n        messageSources.addAll(otherMessageContext.getMessageSources());\n    }\n\n    @Override\n    public MessageContext clone()\n    {\n        return new DefaultMessageContext(this);\n    }\n\n    @Override\n    public Message message()\n    {\n        return new DefaultMessage(this);\n    }\n\n    @Override\n    public MessageContext messageSource(String... messageSource)\n    {\n        List<String> newMessageSources = new ArrayList<String>();\n\n        for (String currentMessageSource : messageSource)\n        {\n            //don't insert message-sources twice\n            if (!messageSources.contains(currentMessageSource))\n            {\n                newMessageSources.add(currentMessageSource);\n            }\n        }\n        // add on first position\n        messageSources.addAll(0, newMessageSources);\n        return this;\n    }\n\n    @Override\n    public Locale getLocale()\n    {\n        if (getLocaleResolver() == null)\n        {\n            return Locale.getDefault();\n        }\n\n        return getLocaleResolver().getLocale();\n    }\n\n    @Override\n    public LocaleResolver getLocaleResolver()\n    {\n        return localeResolver;\n    }\n\n    @Override\n    public List<String> getMessageSources()\n    {\n        return Collections.unmodifiableList(messageSources);\n    }\n\n    @Override\n    public MessageContext localeResolver(LocaleResolver localeResolver)\n    {\n        this.localeResolver = localeResolver;\n        return this;\n    }\n\n    @Override\n    public MessageInterpolator getMessageInterpolator()\n    {\n        return messageInterpolator;\n    }\n\n    @Override\n    public MessageContext messageInterpolator(MessageInterpolator messageInterpolator)\n    {\n        this.messageInterpolator = messageInterpolator;\n        return this;\n    }\n\n    @Override\n    public MessageResolver getMessageResolver()\n    {\n        return messageResolver;\n    }\n\n    @Override\n    public MessageContext messageResolver(MessageResolver messageResolver)\n    {\n        this.messageResolver = messageResolver;\n        return this;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/DefaultMessageInterpolator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.io.Serializable;\nimport java.util.Locale;\n\n/**\n * {@inheritDoc}\n */\n@ApplicationScoped\npublic class DefaultMessageInterpolator implements MessageInterpolator, Serializable\n{\n    private static final long serialVersionUID = -8854087197813424812L;\n\n    @Override\n    public String interpolate(String messageTemplate, Serializable[] arguments, Locale locale)\n    {\n        if (arguments == null || arguments.length == 0)\n        {\n            return messageTemplate;\n        }\n\n        return String.format(locale, messageTemplate, arguments);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/DefaultMessageResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageResolver;\nimport org.apache.deltaspike.core.util.PropertyFileUtils;\n\nimport jakarta.enterprise.context.Dependent;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.MissingResourceException;\nimport java.util.ResourceBundle;\n\n@Dependent\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class DefaultMessageResolver implements MessageResolver\n{\n    private static final long serialVersionUID = 5834411208472341006L;\n\n    @Override\n    public String getMessage(MessageContext messageContext, String messageTemplate, String category)\n    {\n        // we can use {{ as escaping for now\n        if (messageTemplate.startsWith(\"{{\"))\n        {\n            // in which case we just cut of the first '{'\n            return messageTemplate.substring(1);\n        }\n\n        if (messageTemplate.startsWith(\"{\") && messageTemplate.endsWith(\"}\"))\n        {\n            String resourceKey = messageTemplate.substring(1, messageTemplate.length() - 1);\n\n            List<String> messageSources = getMessageSources(messageContext);\n\n            if (messageSources == null || messageSources.isEmpty())\n            {\n                // using {} without a bundle is always an error\n                return null;\n            }\n\n            Iterator<String> messageSourceIterator = messageSources.iterator();\n\n            Locale locale = messageContext.getLocale();\n\n            String currentMessageSource;\n            while (messageSourceIterator.hasNext())\n            {\n                currentMessageSource = messageSourceIterator.next();\n\n                try\n                {\n                    ResourceBundle messageBundle = PropertyFileUtils.getResourceBundle(currentMessageSource, locale);\n\n                    if (category != null && category.length() > 0)\n                    {\n                        try\n                        {\n                            return messageBundle.getString(resourceKey + \"_\" + category);\n                        }\n                        catch (MissingResourceException e)\n                        {\n                            // we fallback on the version without the category\n                            return messageBundle.getString(resourceKey);\n                        }\n                    }\n\n                    return messageBundle.getString(resourceKey);\n                }\n                catch (MissingResourceException e)\n                {\n                    if (!messageSourceIterator.hasNext())\n                    {\n                        return null;\n                    }\n                }\n            }\n        }\n\n        return messageTemplate;\n    }\n\n    protected List<String> getMessageSources(MessageContext messageContext)\n    {\n        return messageContext.getMessageSources();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.Bean;\n\n@Vetoed\nabstract class MessageBundleContext\n{\n    private static final ThreadLocal<Bean> MESSAGE_BUNDLE_BEAN = new ThreadLocal<Bean>();\n\n    private MessageBundleContext()\n    {\n        // prevent instantiation\n    }\n\n    static void setBean(Bean bean)\n    {\n        MESSAGE_BUNDLE_BEAN.set(bean);\n    }\n\n    static void reset()\n    {\n        MESSAGE_BUNDLE_BEAN.set(null);\n        MESSAGE_BUNDLE_BEAN.remove();\n    }\n\n    static Bean getCurrentMessageBundleBean()\n    {\n        return MESSAGE_BUNDLE_BEAN.get();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.spi.*;\nimport jakarta.enterprise.inject.spi.configurator.BeanConfigurator;\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.BeanConfiguratorUtils;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\n\nimport java.io.Serializable;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Proxy;\nimport java.util.*;\n\n/**\n * Extension for handling {@link MessageBundle}s.\n *\n * @see MessageBundle\n * @see MessageTemplate\n */\npublic class MessageBundleExtension implements Extension, Deactivatable\n{\n    private final Collection<AnnotatedType<?>> messageBundleTypes = new HashSet<AnnotatedType<?>>();\n\n    private List<String> deploymentErrors = new ArrayList<String>();\n\n    private Boolean isActivated = true;\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void detectInterfaces(@Observes ProcessAnnotatedType processAnnotatedType)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        AnnotatedType<?> type = processAnnotatedType.getAnnotatedType();\n\n        if (type.isAnnotationPresent(MessageBundle.class))\n        {\n            if (validateMessageBundle(type.getJavaClass()))\n            {\n                messageBundleTypes.add(type);\n            }\n        }\n    }\n\n    /**\n     * @return <code>true</code> if all is well\n     */\n    private boolean validateMessageBundle(Class<?> currentClass)\n    {\n        boolean ok = true;\n\n        // sanity check: annotated class must be an Interface\n        if (!currentClass.isInterface())\n        {\n            deploymentErrors.add(\"@MessageBundle must only be used on Interfaces, but got used on class \" +\n                    currentClass.getName());\n            return false;\n        }\n\n        for (Method currentMethod : currentClass.getDeclaredMethods())\n        {\n            if (!currentMethod.isAnnotationPresent(MessageTemplate.class))\n            {\n                continue;\n            }\n            \n            if (String.class.isAssignableFrom(currentMethod.getReturnType()))\n            {\n                continue;\n            }\n\n            if (Message.class.isAssignableFrom(currentMethod.getReturnType()))\n            {\n                continue;\n            }\n\n            deploymentErrors.add(currentMethod.getReturnType().getName() + \" isn't supported. Details: \" +\n                    currentMethod.getDeclaringClass().getName() + \"#\" + currentMethod.getName() +\n                    \" only \" + String.class.getName() + \" or \" + Message.class.getName());\n            ok = false;\n        }\n\n        return ok;\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void installMessageBundleProducerBeans(@Observes AfterBeanDiscovery abd, BeanManager beanManager)\n    {\n        if (!deploymentErrors.isEmpty())\n        {\n            abd.addDefinitionError(new IllegalArgumentException(\"The following MessageBundle problems where found: \" +\n                    Arrays.toString(deploymentErrors.toArray())));\n            return;\n        }\n\n        for (AnnotatedType<?> type : messageBundleTypes)\n        {\n            addAsBean(abd, beanManager, type);\n        }\n    }\n\n    protected <T> void addAsBean(AfterBeanDiscovery abd, BeanManager beanManager, AnnotatedType<T> type)\n    {\n        BeanConfigurator<T> beanConfigurator = abd.addBean()\n                .createWith(cc ->\n                    {\n                        final Bean<?> invocationHandlerBean = beanManager.resolve(\n                                beanManager.getBeans(MessageBundleInvocationHandler.class));\n\n                        return createMessageBundleProxy(type.getJavaClass(),\n                                (MessageBundleInvocationHandler)\n                                        beanManager.getReference(invocationHandlerBean, MessageBundleInvocationHandler.class, cc));\n                    });\n        BeanConfiguratorUtils.read(beanManager, beanConfigurator, type)\n                .types(type.getJavaClass(), Object.class, Serializable.class)\n                .addQualifier(Default.Literal.INSTANCE)\n                .scope(ApplicationScoped.class) // needs to be a normalscope due to a bug in older Weld versions\n                .id(\"MessageBundleBean#\" + type.getJavaClass().getName());\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void cleanup(@Observes AfterDeploymentValidation afterDeploymentValidation)\n    {\n        messageBundleTypes.clear();\n    }\n\n    private <T> T createMessageBundleProxy(Class<T> type, MessageBundleInvocationHandler handler)\n    {\n        return type.cast(Proxy.newProxyInstance(ClassUtils.getClassLoader(null),\n            new Class<?>[]{type, Serializable.class}, handler));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleInvocationHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.core.impl.message;\r\n\r\nimport jakarta.enterprise.context.Dependent;\r\nimport jakarta.enterprise.inject.Any;\r\nimport jakarta.enterprise.inject.Typed;\r\nimport jakarta.inject.Inject;\r\nimport java.io.Serializable;\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\r\nimport org.apache.deltaspike.core.api.message.Message;\r\nimport org.apache.deltaspike.core.api.message.MessageContext;\r\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\r\nimport org.apache.deltaspike.core.api.message.MessageResolver;\r\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\r\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.core.util.ClassUtils;\r\n\r\n/**\r\n * This Proxy InvocationHandler implements the handling for all our\r\n * {@link org.apache.deltaspike.core.api.message.MessageBundle}s.\r\n */\r\n@Dependent\r\n@Typed(MessageBundleInvocationHandler.class)\r\npublic class MessageBundleInvocationHandler implements InvocationHandler, Serializable\r\n{\r\n    private static final long serialVersionUID = -8980912335543392357L;\r\n\r\n    @Inject\r\n    private MessageContext baseMessageContext = null;\r\n\r\n    /**\r\n     * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,\r\n     *      java.lang.reflect.Method, java.lang.Object[])\r\n     */\r\n    @Override\r\n    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable\r\n    {\r\n        if (method.getDeclaringClass().equals(Object.class))\r\n        {\r\n            // this sometimes gets invoked directly by the container\r\n            // there is no perfect solution for those methods,\r\n            // so we try to use the best info we have atm.\r\n\r\n            if (\"hashCode\".equals(method.getName()))\r\n            {\r\n                return proxy.getClass().hashCode();\r\n            }\r\n\r\n            if (\"toString\".equals(method.getName()))\r\n            {\r\n                return proxy.getClass().toString();\r\n            }\r\n\r\n            if (\"equals\".equals(method.getName()))\r\n            {\r\n                return proxy.getClass().equals(args[0].getClass());\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        final MessageTemplate messageTemplate = method.getAnnotation(MessageTemplate.class);\r\n\r\n        String messageTemplateValue;\r\n\r\n        if (messageTemplate != null)\r\n        {\r\n            messageTemplateValue = messageTemplate.value();\r\n        }\r\n        else\r\n        {\r\n            messageTemplateValue = \"{\" + method.getName() + \"}\";\r\n        }\r\n\r\n        MessageContext messageContext = resolveMessageContextFromArguments(args);\r\n        List<Serializable> arguments = resolveMessageArguments(args);\r\n\r\n        if (messageContext == null)\r\n        {\r\n            messageContext = baseMessageContext.clone();\r\n\r\n            MessageContextConfig messageContextConfig =\r\n                method.getDeclaringClass().getAnnotation(MessageContextConfig.class);\r\n\r\n            if (messageContextConfig != null)\r\n            {\r\n                applyMessageContextConfig(messageContext, messageContextConfig);\r\n            }\r\n        }\r\n\r\n        String messageBundleName = method.getDeclaringClass().getName();\r\n\r\n        Message message =  messageContext\r\n                .messageSource(messageBundleName).message()\r\n                .template(messageTemplateValue)\r\n                .argument(arguments.toArray(new Serializable[arguments.size()]));\r\n\r\n        if (String.class.isAssignableFrom(method.getReturnType()))\r\n        {\r\n            return message.toString();\r\n        }\r\n\r\n        return message;\r\n    }\r\n\r\n    private void applyMessageContextConfig(MessageContext messageContext, MessageContextConfig messageContextConfig)\r\n    {\r\n        if (!MessageResolver.class.equals(messageContextConfig.messageResolver()))\r\n        {\r\n            Class<? extends MessageResolver> messageResolverClass =\r\n                    ClassUtils.tryToLoadClassForName(messageContextConfig.messageResolver().getName());\r\n\r\n            messageContext.messageResolver(\r\n                    BeanProvider.getContextualReference(messageResolverClass, Any.Literal.INSTANCE));\r\n        }\r\n\r\n        if (!MessageInterpolator.class.equals(messageContextConfig.messageInterpolator()))\r\n        {\r\n            Class<? extends MessageInterpolator> messageInterpolatorClass =\r\n                    ClassUtils.tryToLoadClassForName(messageContextConfig.messageInterpolator().getName());\r\n\r\n            messageContext.messageInterpolator(\r\n                    BeanProvider.getContextualReference(messageInterpolatorClass, Any.Literal.INSTANCE));\r\n        }\r\n\r\n        if (!LocaleResolver.class.equals(messageContextConfig.localeResolver()))\r\n        {\r\n            Class<? extends LocaleResolver> localeResolverClass =\r\n                    ClassUtils.tryToLoadClassForName(messageContextConfig.localeResolver().getName());\r\n\r\n            messageContext.localeResolver(\r\n                    BeanProvider.getContextualReference(localeResolverClass, Any.Literal.INSTANCE));\r\n        }\r\n        \r\n        String[] messageSources = messageContextConfig.messageSource();\r\n        messageContext.messageSource(messageSources);\r\n\r\n    }\r\n\r\n    private List<Serializable> resolveMessageArguments(Object[] args)\r\n    {\r\n        List<Serializable> arguments = new ArrayList<Serializable>();\r\n        if (args != null && args.length > 0)\r\n        {\r\n            for (int i = 0; i < args.length; i++)\r\n            {\r\n                Object arg = args[i];\r\n\r\n                if (i == 0 && arg != null && MessageContext.class.isAssignableFrom(arg.getClass()))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (arg instanceof Serializable)\r\n                {\r\n                    arguments.add((Serializable) arg);\r\n                }\r\n                else\r\n                {\r\n                    // for non-serializable objects we perform an immediate toString() instead\r\n                    arguments.add(arg == null ? null : arg.toString());\r\n                }\r\n            }\r\n        }\r\n\r\n        return arguments;\r\n    }\r\n\r\n    private MessageContext resolveMessageContextFromArguments(Object[] args)\r\n    {\r\n        if (args != null && args.length > 0 &&  args[0] != null &&\r\n            MessageContext.class.isAssignableFrom(args[0].getClass()))\r\n        {\r\n            return (MessageContext) args[0];\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageFormatMessageInterpolator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.message;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\nimport java.io.Serializable;\nimport java.util.Locale;\nimport java.text.MessageFormat;\n\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\n\n/**\n * This is an Alternative implementation of a {@link MessageInterpolator} which\n * uses java.text.MessageFormat for formatting.\n *\n * Please note that for some EE containers you might need to add this &lt;alternative&gt>\n * to all JARs and classpath entries beanx.xml files.\n *\n * {@inheritDoc}\n */\n@ApplicationScoped\n@Alternative\npublic class MessageFormatMessageInterpolator implements MessageInterpolator, Serializable\n{\n    private static final long serialVersionUID = -8854087197813424812L;\n\n    @Override\n    public String interpolate(String messageTemplate, Serializable[] arguments, Locale locale)\n    {\n        MessageFormat messageFormat = new MessageFormat(messageTemplate, locale);\n        return messageFormat.format(arguments);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/monitoring/InvocationMonitorInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.monitoring;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.core.api.monitoring.InvocationMonitored;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n@Interceptor\n@InvocationMonitored\n@Priority(1000)\npublic class InvocationMonitorInterceptor implements Serializable\n{\n    private static final Logger logger = Logger.getLogger(InvocationMonitorInterceptor.class.getName());\n\n    @Inject\n    private RequestInvocationCounter requestInvocationCounter;\n\n    @AroundInvoke\n    public Object track(InvocationContext ic) throws Exception\n    {\n        long start = System.nanoTime();\n        Object retVal = ic.proceed();\n        long end = System.nanoTime();\n        try\n        {\n            requestInvocationCounter.count(ic.getTarget().getClass().getName(), ic.getMethod().getName(), end - start);\n        }\n        catch (ContextNotActiveException cnae)\n        {\n            logger.log(Level.FINE, \"could not monitor invocatino to {} due to RequestContext not being active\",\n                ic.getMethod().toString());\n        }\n\n        return retVal;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/monitoring/InvocationResultLogger.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.monitoring;\n\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.core.api.exclude.Exclude;\nimport org.apache.deltaspike.core.api.monitoring.MonitorResultEvent;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Observes;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.concurrent.atomic.AtomicLong;\nimport java.util.logging.Logger;\n\n/**\n * This class will observe all {@link MonitorResultEvent}s\n * and log them accordingly\n */\n@ApplicationScoped\n@Exclude(onExpression = InvocationResultLogger.DISABLED_EXPRESSION)\npublic class InvocationResultLogger\n{\n\n    static final String DISABLED_EXPRESSION = CoreBaseConfig.InterDynCustomization.CONFIG_INVOCATIONRESULTLOGGER_ENABLED + \"==false\";\n\n    private static final Logger logger = Logger.getLogger(InvocationResultLogger.class.getName());\n\n    private static final int DEFAULT_MAX_LOG_LINES = 8;\n    private static final String PROPERTY_MAX_LOG_LINES = \"MAX_LOG_LINES\";\n\n    private int maxLogLines = DEFAULT_MAX_LOG_LINES + 1;\n\n    @PostConstruct\n    private void init()\n    {\n        String maxLogLinesProp = System.getProperty(PROPERTY_MAX_LOG_LINES);\n        if (maxLogLinesProp != null)\n        {\n            maxLogLines = Integer.parseInt(maxLogLinesProp) + 1;\n        }\n\n        logger.info(\"Using MAX_LOG_LINE=\" + maxLogLines);\n    }\n\n    public void logMonitorResultEvents(@Observes MonitorResultEvent mre)\n    {\n        // we copy them because we don't like to make the event data dirty.\n        // there might be other observers interested in the result...\n        List<ResultEntry> methodInvocations\n            = createMethodResultEntries(mre.getMethodInvocations(), mre.getMethodDurations());\n        List<ResultEntry> classInvocations\n            = createClassResultEntries(mre.getClassInvocations());\n\n        StringBuilder sb = new StringBuilder();\n        sb.append(\"Top Class Invocations:\\n\");\n        for (int i = 1; i < maxLogLines && i <= classInvocations.size(); i++)\n        {\n            ResultEntry re = classInvocations.get(classInvocations.size() - i);\n            sb.append(\"  count: \").append(re.getCount()).append(\"\\t\").append(re.getToken()).append(\"\\n\");\n        }\n        logger.info(sb.toString());\n\n        sb = new StringBuilder();\n        sb.append(\"Top Method Invocations:\\n\");\n        for (int i = 1; i < maxLogLines && i <= methodInvocations.size(); i++)\n        {\n            ResultEntry re = methodInvocations.get(methodInvocations.size() - i);\n            sb.append(\"  dur[ms]: \").append(re.getDuration() / 1e6f).append(\"\\tcount: \").\n                    append(re.getCount()).append(\"\\t\").append(re.getToken()).append(\"\\n\");\n        }\n        logger.info(sb.toString());\n    }\n\n\n    private List<ResultEntry> createMethodResultEntries(Map<String, AtomicInteger> invocations,\n                                                        Map<String, AtomicLong> durations)\n    {\n        List<ResultEntry> resultEntries = new ArrayList<ResultEntry>(invocations.size());\n\n\n\n        for (Map.Entry<String, AtomicInteger> entry : invocations.entrySet())\n        {\n            long dur = durations.get(entry.getKey()).longValue();\n            resultEntries.add(new ResultEntry(entry.getValue().intValue(), entry.getKey(), dur));\n        }\n\n        Collections.sort(resultEntries);\n\n        return resultEntries;\n    }\n\n    private List<ResultEntry> createClassResultEntries(Map<String, AtomicInteger> invocations)\n    {\n        List<ResultEntry> resultEntries = new ArrayList<ResultEntry>(invocations.size());\n\n        for (Map.Entry<String, AtomicInteger> entry : invocations.entrySet())\n        {\n            resultEntries.add(new ResultEntry(entry.getValue().intValue(), entry.getKey(), 0L));\n        }\n\n        Collections.sort(resultEntries);\n\n        return resultEntries;\n    }\n\n    private static class ResultEntry implements Comparable<ResultEntry>\n    {\n        private Integer count;\n        private String token;\n        private long    duration;\n\n        private ResultEntry(Integer count, String token, long duration)\n        {\n            this.count = count;\n            this.token = token;\n            this.duration = duration;\n        }\n\n        public Integer getCount()\n        {\n            return count;\n        }\n\n        public String getToken()\n        {\n            return token;\n        }\n\n        public long getDuration()\n        {\n            return duration;\n        }\n\n        public int compareTo(ResultEntry o)\n        {\n            if (duration == 0 && o.duration == 0)\n            {\n                return count.compareTo(o.count);\n            }\n\n            return duration < o.duration ? -1 : (duration == o.duration ? 0 : 1);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/monitoring/RequestInvocationCounter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.monitoring;\n\nimport org.apache.deltaspike.core.api.monitoring.MonitorResultEvent;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.event.Event;\nimport jakarta.inject.Inject;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.concurrent.atomic.AtomicLong;\n\n/**\n * This bean will get used to count invocations for a single request\n */\n@RequestScoped\npublic class RequestInvocationCounter\n{\n    @Inject\n    private Event<MonitorResultEvent> mre;\n\n\n    /**\n     * Counter for all method invocations\n     * key = fully qualified method name (includes class)\n     * value = Integer with value\n     */\n    private Map<String, AtomicInteger> methodInvocations = new HashMap<String, AtomicInteger>();\n\n    /**\n     * Duration of all method invocations\n     * key = fully qualified method name (includes class)\n     * value = Integer with value\n     */\n    private Map<String, AtomicLong> methodDurations = new HashMap<String, AtomicLong>();\n\n    /**\n     * Counter for all class invocations\n     * key = fully qualified class name\n     * value = Integer with value\n     */\n    private Map<String, AtomicInteger> classInvocations  = new HashMap<String, AtomicInteger>();\n\n\n    @PreDestroy\n    public void postUsage()\n    {\n        mre.fire(new MonitorResultEvent(methodInvocations, classInvocations, methodDurations));\n    }\n\n    /**\n     * increment the respective counters\n     * @param className the getName() of the class\n     * @param methodName the invoked methods name\n     * @param duration duration of the method invocation in nano time\n     */\n    public void count(String className, String methodName, long duration)\n    {\n        AtomicInteger classCount = classInvocations.get(className);\n        if (classCount == null)\n        {\n            classCount = new AtomicInteger(0);\n            classInvocations.put(className, classCount);\n        }\n        classCount.incrementAndGet();\n\n\n        String methodKey = className + \"#\" + methodName;\n\n        AtomicInteger methCount = methodInvocations.get(methodKey);\n        if (methCount == null)\n        {\n            methCount = new AtomicInteger(0);\n            methodInvocations.put(methodKey, methCount);\n        }\n        methCount.incrementAndGet();\n\n        AtomicLong methDur = methodDurations.get(methodKey);\n        if (methDur == null)\n        {\n            methDur = new AtomicLong(0);\n            methodDurations.put(methodKey, methDur);\n        }\n        methDur.addAndGet(duration);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/AbstractBeanHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope;\n\nimport org.apache.deltaspike.core.util.context.AbstractContext;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\npublic abstract class AbstractBeanHolder<K> implements Serializable\n{\n    private Map<K, ContextualStorage> storageMap = new ConcurrentHashMap<K, ContextualStorage>();\n\n    private final boolean useConcurrentStorage;\n    private final boolean usePassivationCapableStorage;\n\n    protected AbstractBeanHolder()\n    {\n        this(true, true);\n    }\n\n    protected AbstractBeanHolder(boolean useConcurrentStorage, boolean usePassivationCapableStorage)\n    {\n        this.useConcurrentStorage = useConcurrentStorage;\n        this.usePassivationCapableStorage = usePassivationCapableStorage;\n    }\n\n    public ContextualStorage getContextualStorage(BeanManager beanManager, K key, boolean createIfNotExist)\n    {\n        ContextualStorage contextualStorage = storageMap.get(key);\n\n        if (contextualStorage == null && createIfNotExist)\n        {\n            contextualStorage = createContextualStorage(beanManager, key);\n        }\n\n        return contextualStorage;\n    }\n\n    protected synchronized ContextualStorage createContextualStorage(BeanManager beanManager, K key)\n    {\n        ContextualStorage contextualStorage = storageMap.get(key);\n        if (contextualStorage == null)\n        {\n            contextualStorage = new ContextualStorage(beanManager, useConcurrentStorage, usePassivationCapableStorage);\n            storageMap.put(key, contextualStorage);\n        }\n        return contextualStorage;\n    }\n\n    public Map<K, ContextualStorage> getStorageMap()\n    {\n        return storageMap;\n    }\n\n    public Map<K, ContextualStorage> forceNewStorage()\n    {\n        Map<K, ContextualStorage> oldStorageMap = storageMap;\n        storageMap = new ConcurrentHashMap<K, ContextualStorage>();\n        return oldStorageMap;\n    }\n\n    @PreDestroy\n    public void destroyBeans()\n    {\n        Map<K, ContextualStorage> oldWindowContextStorages = forceNewStorage();\n\n        for (ContextualStorage contextualStorage : oldWindowContextStorages.values())\n        {\n            AbstractContext.destroyAllActive(contextualStorage);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/DeltaSpikeContextExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.AfterDeploymentValidation;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.impl.scope.conversation.ConversationBeanHolder;\nimport org.apache.deltaspike.core.impl.scope.conversation.GroupedConversationContext;\nimport org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessBeanAccessHistory;\nimport org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessBeanHolder;\nimport org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext;\nimport org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessViewHistory;\nimport org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder;\nimport org.apache.deltaspike.core.impl.scope.window.WindowContextImpl;\nimport org.apache.deltaspike.core.impl.scope.window.WindowIdHolder;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\n/**\n * Handle all DeltaSpike WindowContext and ConversationContext\n * related features.\n */\npublic class DeltaSpikeContextExtension implements Extension, Deactivatable\n{\n    private WindowContextImpl windowContext;\n    private GroupedConversationContext conversationContext;\n    private ViewAccessContext viewAccessScopedContext;\n\n    private Boolean isActivated = true;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    public void registerDeltaSpikeContexts(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        windowContext = new WindowContextImpl(beanManager);\n        conversationContext = new GroupedConversationContext(beanManager, windowContext);\n        viewAccessScopedContext = new ViewAccessContext(beanManager, windowContext);\n        afterBeanDiscovery.addContext(windowContext);\n        afterBeanDiscovery.addContext(conversationContext);\n        afterBeanDiscovery.addContext(viewAccessScopedContext);\n    }\n\n    /**\n     * We can only initialize our contexts in AfterDeploymentValidation because\n     * getBeans must not be invoked earlier than this phase to reduce randomness\n     * caused by Beans no being fully registered yet.\n     */\n    public void initializeDeltaSpikeContexts(@Observes AfterDeploymentValidation adv, BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        WindowBeanHolder windowBeanHolder =\n            BeanProvider.getContextualReference(beanManager, WindowBeanHolder.class, false);\n\n        WindowIdHolder windowIdHolder =\n            BeanProvider.getContextualReference(beanManager, WindowIdHolder.class, false);\n\n        windowContext.init(windowBeanHolder, windowIdHolder);\n\n        ConversationBeanHolder conversationBeanHolder =\n            BeanProvider.getContextualReference(beanManager, ConversationBeanHolder.class, false);\n        conversationContext.init(conversationBeanHolder);\n        \n        ViewAccessBeanHolder viewAccessBeanHolder =\n            BeanProvider.getContextualReference(beanManager, ViewAccessBeanHolder.class, false);\n        ViewAccessBeanAccessHistory viewAccessBeanAccessHistory =\n            BeanProvider.getContextualReference(beanManager, ViewAccessBeanAccessHistory.class, false);\n        ViewAccessViewHistory viewAccessViewHistory =\n            BeanProvider.getContextualReference(beanManager, ViewAccessViewHistory.class, false);\n        viewAccessScopedContext.init(viewAccessBeanHolder, viewAccessBeanAccessHistory, viewAccessViewHistory);\n    }\n\n    public WindowContextImpl getWindowContext()\n    {\n        return windowContext;\n    }\n\n    public GroupedConversationContext getConversationContext()\n    {\n        return conversationContext;\n    }\n    \n    public ViewAccessContext getViewAccessScopedContext()\n    {\n        return viewAccessScopedContext;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/conversation/ConversationBeanHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.conversation;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\nimport org.apache.deltaspike.core.impl.scope.AbstractBeanHolder;\n\n@WindowScoped\npublic class ConversationBeanHolder extends AbstractBeanHolder<ConversationKey>\n{\n    private static final long serialVersionUID = 6313493410718133308L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/conversation/ConversationKey.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.conversation;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class ConversationKey implements Serializable\n{\n    private static final long serialVersionUID = 6565204223928766263L;\n\n    private final Class<?> groupKey;\n\n    //HashSet due to Serializable warning in checkstyle rules\n    private HashSet<Annotation> qualifiers;\n\n    public ConversationKey(Class<?> groupKey, Annotation... qualifiers)\n    {\n        this.groupKey = groupKey;\n\n        //TODO maybe we have to add a real qualifier instead\n        Class<? extends Annotation> annotationType;\n        for (Annotation qualifier : qualifiers)\n        {\n            annotationType = qualifier.annotationType();\n\n            if (Any.class.isAssignableFrom(annotationType) ||\n                    Default.class.isAssignableFrom(annotationType) ||\n                    Named.class.isAssignableFrom(annotationType) ||\n                    ConversationGroup.class.isAssignableFrom(annotationType))\n            {\n                //won't be used for this key!\n                continue;\n            }\n\n            if (this.qualifiers == null)\n            {\n                this.qualifiers = new HashSet<Annotation>();\n            }\n            this.qualifiers.add(qualifier);\n        }\n    }\n\n    public Class<?> getConversationGroup()\n    {\n        return groupKey;\n    }\n\n    public Set<Annotation> getQualifiers()\n    {\n        if (qualifiers == null)\n        {\n            return Collections.emptySet();\n        }\n        return Collections.unmodifiableSet(this.qualifiers);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (!(o instanceof ConversationKey))\n        {\n            return false;\n        }\n\n        ConversationKey that = (ConversationKey) o;\n\n        if (!groupKey.equals(that.groupKey))\n        {\n            return false;\n        }\n        if (qualifiers == null && that.qualifiers == null)\n        {\n            return true;\n        }\n        if (qualifiers != null && that.qualifiers == null)\n        {\n            return false;\n        }\n\n        if (!that.qualifiers.equals(qualifiers))\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public int hashCode()\n    {\n        int result = groupKey.hashCode();\n        result = 31 * result + (qualifiers != null ? qualifiers.hashCode() : 0);\n        return result;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String toString()\n    {\n        StringBuilder result = new StringBuilder(\"conversation-key\\n\");\n\n        result.append(\"\\n\");\n        result.append(\"\\tgroup:\\t\\t\");\n        result.append(this.groupKey.getName());\n\n        result.append(\"\\n\");\n        result.append(\"\\tqualifiers:\\t\");\n\n        if (qualifiers != null)\n        {\n            for (Annotation qualifier : this.qualifiers)\n            {\n                result.append(qualifier.annotationType().getName());\n                result.append(\" \");\n            }\n        }\n        else\n        {\n            result.append(\"---\");\n        }\n\n        return result.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/conversation/GroupedConversationArtifactProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.conversation;\n\nimport org.apache.deltaspike.core.api.scope.GroupedConversation;\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.impl.util.ConversationUtils;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class GroupedConversationArtifactProducer\n{\n    @Inject\n    private DeltaSpikeContextExtension deltaSpikeContextExtension;\n\n    @Produces\n    @Dependent\n    public GroupedConversationManager getGroupedConversationManager()\n    {\n        return new InjectableGroupedConversationManager(deltaSpikeContextExtension.getConversationContext());\n    }\n\n    @Produces\n    @Dependent\n    public GroupedConversation getGroupedConversation(InjectionPoint injectionPoint, BeanManager beanManager)\n    {\n        ConversationKey conversationKey =\n            ConversationUtils.convertToConversationKey(injectionPoint.getBean(), beanManager);\n        return new InjectableGroupedConversation(conversationKey, getGroupedConversationManager());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/conversation/GroupedConversationContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.conversation;\n\nimport org.apache.deltaspike.core.api.scope.ConversationSubGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\nimport org.apache.deltaspike.core.impl.scope.window.WindowContextImpl;\nimport org.apache.deltaspike.core.impl.util.ConversationUtils;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.util.context.AbstractContext;\nimport org.apache.deltaspike.core.util.context.ContextualInstanceInfo;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\n@Vetoed\n//TODO add RequestCache\n//TODO ConversationSubGroup\npublic class GroupedConversationContext extends AbstractContext implements GroupedConversationManager\n{\n    private static final long serialVersionUID = -5463564406828391468L;\n\n    private final BeanManager beanManager;\n\n    private final WindowContextImpl windowContext;\n\n    private ConversationBeanHolder conversationBeanHolder;\n\n    public GroupedConversationContext(BeanManager beanManager, WindowContextImpl windowContext)\n    {\n        super(beanManager);\n\n        this.beanManager = beanManager;\n        this.windowContext = windowContext;\n    }\n\n    public void init(ConversationBeanHolder conversationBeanHolder)\n    {\n        this.conversationBeanHolder = conversationBeanHolder;\n    }\n\n    @Override\n    protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExist)\n    {\n        ConversationKey conversationKey = ConversationUtils.convertToConversationKey(contextual, this.beanManager);\n        return this.conversationBeanHolder.getContextualStorage(this.beanManager, conversationKey, createIfNotExist);\n    }\n\n    @Override\n    protected List<ContextualStorage> getActiveContextualStorages()\n    {\n        List<ContextualStorage> result = new ArrayList<ContextualStorage>();\n        result.addAll(this.conversationBeanHolder.getStorageMap().values());\n        return result;\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope()\n    {\n        return GroupedConversationScoped.class;\n    }\n\n    @Override\n    public boolean isActive()\n    {\n        return this.windowContext.isActive(); //autom. active once a window is active\n    }\n\n    @Override\n    public ContextualStorage closeConversation(Class<?> conversationGroup, Annotation... qualifiers)\n    {\n        ConversationKey conversationKey = new ConversationKey(conversationGroup, qualifiers);\n        ContextualStorage contextualStorage = this.conversationBeanHolder.getStorageMap().remove(conversationKey);\n\n        if (contextualStorage != null)\n        {\n            AbstractContext.destroyAllActive(contextualStorage);\n        }\n\n        return contextualStorage;\n    }\n\n    @Override\n    public Set<ContextualStorage> closeConversationGroup(Class<?> conversationGroup)\n    {\n        Set<ContextualStorage> result = new HashSet<ContextualStorage>();\n\n        ConversationSubGroup conversationSubGroup = conversationGroup.getAnnotation(ConversationSubGroup.class);\n        Set<Class<?>> subGroups = null;\n\n        if (conversationSubGroup != null)\n        {\n            conversationGroup = ConversationUtils.getDeclaredConversationGroup(conversationGroup);\n\n            subGroups = new HashSet<Class<?>>(conversationSubGroup.subGroup().length);\n            Collections.addAll(subGroups, conversationSubGroup.subGroup());\n        }\n\n        Map<ConversationKey, ContextualStorage> storageMap = this.conversationBeanHolder.getStorageMap();\n        for (Map.Entry<ConversationKey, ContextualStorage> entry : storageMap.entrySet())\n        {\n            if (entry.getKey().getConversationGroup().equals(conversationGroup))\n            {\n                if (subGroups == null)\n                {\n                    AbstractContext.destroyAllActive(entry.getValue());\n                    result.add(entry.getValue());\n                    storageMap.remove(entry.getKey()); //ok due to ConcurrentHashMap\n                }\n                else\n                {\n                    tryToDestroySubGroup(subGroups, entry);\n\n                    if (entry.getValue().getStorage().isEmpty())\n                    {\n                        storageMap.remove(entry.getKey()); //ok due to ConcurrentHashMap\n                    }\n                }\n            }\n        }\n        return result;\n    }\n\n    private void tryToDestroySubGroup(Set<Class<?>> subGroups, Map.Entry<ConversationKey, ContextualStorage> entry)\n    {\n        ContextualStorage storage = entry.getValue();\n\n        for (Map.Entry<Object, ContextualInstanceInfo<?>> storageEntry : storage.getStorage().entrySet())\n        {\n            for (Class<?> subGroup : subGroups)\n            {\n                Class classOfEntry = storageEntry.getValue().getContextualInstance().getClass();\n                if (subGroup.equals(classOfEntry) ||\n                    (subGroup.isInterface() && subGroup.isAssignableFrom(classOfEntry)))\n                {\n                    Contextual bean = storage.getBean(storageEntry.getKey());\n                    AbstractContext.destroyBean(bean, storageEntry.getValue());\n                    storage.getStorage().remove(storageEntry.getKey()); //ok due to ConcurrentHashMap\n                    break;\n                }\n            }\n        }\n    }\n\n    @Override\n    public void closeConversations()\n    {\n        this.conversationBeanHolder.destroyBeans();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/conversation/InjectableGroupedConversation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.conversation;\n\nimport org.apache.deltaspike.core.api.scope.GroupedConversation;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.annotation.Annotation;\nimport java.util.Set;\n\n@Vetoed\nclass InjectableGroupedConversation implements GroupedConversation\n{\n    private static final long serialVersionUID = -3909049219127821425L;\n\n    private final ConversationKey conversationKey;\n    private final GroupedConversationManager conversationManager;\n\n    InjectableGroupedConversation(ConversationKey conversationKey, GroupedConversationManager conversationManager)\n    {\n        this.conversationManager = conversationManager;\n        this.conversationKey = conversationKey;\n    }\n\n    @Override\n    public void close()\n    {\n        Set<Annotation> qualifiers = this.conversationKey.getQualifiers();\n\n        this.conversationManager.closeConversation(\n            this.conversationKey.getConversationGroup(), qualifiers.toArray(new Annotation[qualifiers.size()]));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/conversation/InjectableGroupedConversationManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.conversation;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.annotation.Annotation;\nimport java.util.Set;\n\n@Vetoed\nclass InjectableGroupedConversationManager implements GroupedConversationManager\n{\n    private transient volatile GroupedConversationManager conversationManager;\n\n    InjectableGroupedConversationManager(GroupedConversationManager conversationManager)\n    {\n        this.conversationManager = conversationManager;\n    }\n\n    private GroupedConversationManager getConversationManager()\n    {\n        if (this.conversationManager == null)\n        {\n            this.conversationManager =\n                BeanProvider.getContextualReference(DeltaSpikeContextExtension.class).getConversationContext();\n        }\n        return conversationManager;\n    }\n\n    @Override\n    public ContextualStorage closeConversation(Class<?> conversationGroup, Annotation... qualifiers)\n    {\n        return getConversationManager().closeConversation(conversationGroup, qualifiers);\n    }\n\n    @Override\n    public Set<ContextualStorage> closeConversationGroup(Class<?> conversationGroup)\n    {\n        return getConversationManager().closeConversationGroup(conversationGroup);\n    }\n\n    @Override\n    public void closeConversations()\n    {\n        getConversationManager().closeConversations();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/InjectableViewAccessContextManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.viewaccess;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.spi.scope.viewaccess.ViewAccessContextManager;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Vetoed\nclass InjectableViewAccessContextManager implements ViewAccessContextManager\n{\n    private transient volatile ViewAccessContextManager viewAccessContextManager;\n\n    public InjectableViewAccessContextManager(ViewAccessContextManager viewAccessContextManager)\n    {\n        this.viewAccessContextManager = viewAccessContextManager;\n    }\n\n    private ViewAccessContextManager getConversationManager()\n    {\n        if (this.viewAccessContextManager == null)\n        {\n            this.viewAccessContextManager =\n                BeanProvider.getContextualReference(DeltaSpikeContextExtension.class).getViewAccessScopedContext();\n        }\n        return this.viewAccessContextManager;\n    }\n\n    @Override\n    public void close()\n    {\n        getConversationManager().close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessBeanAccessHistory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.viewaccess;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class ViewAccessBeanAccessHistory\n{    \n    private final List<String> accessedBeans = new ArrayList<String>();\n\n    public List<String> getAccessedBeans()\n    {\n        return accessedBeans;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessBeanHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.viewaccess;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\nimport org.apache.deltaspike.core.impl.scope.AbstractBeanHolder;\n\n@WindowScoped\npublic class ViewAccessBeanHolder extends AbstractBeanHolder<String>\n{\n    private static final long serialVersionUID = 6313403410718143908L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.viewaccess;\n\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\nimport org.apache.deltaspike.core.impl.scope.window.WindowContextImpl;\nimport org.apache.deltaspike.core.spi.scope.viewaccess.ViewAccessContextManager;\nimport org.apache.deltaspike.core.util.context.AbstractContext;\nimport org.apache.deltaspike.core.util.context.ContextualInstanceInfo;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport java.lang.annotation.Annotation;\nimport java.util.Map;\n\n@Vetoed\npublic class ViewAccessContext extends AbstractContext implements ViewAccessContextManager\n{\n    private static final String KEY = \"VAS\"; //TODO re-visit key (e.g. view-id instead of using one big storage)\n\n    private final BeanManager beanManager;\n    private final WindowContextImpl windowContext;\n\n    private ViewAccessBeanHolder viewAccessBeanHolder;\n    private ViewAccessBeanAccessHistory viewAccessBeanAccessHistory;\n    private ViewAccessViewHistory viewAccessViewHistory;\n    \n    public ViewAccessContext(BeanManager beanManager, WindowContextImpl windowContext)\n    {\n        super(beanManager);\n\n        this.beanManager = beanManager;\n        this.windowContext = windowContext;\n    }\n\n    public void init(ViewAccessBeanHolder viewAccessBeanHolder,\n            ViewAccessBeanAccessHistory viewAccessBeanAccessHistory,\n            ViewAccessViewHistory viewAccessViewHistory)\n    {\n        this.viewAccessBeanHolder = viewAccessBeanHolder;\n        this.viewAccessBeanAccessHistory = viewAccessBeanAccessHistory;\n        this.viewAccessViewHistory = viewAccessViewHistory;\n    }\n\n    @Override\n    public <T> T get(Contextual<T> bean)\n    {\n        try\n        {\n            return super.get(bean);\n        }\n        finally\n        {\n            if (bean instanceof PassivationCapable)\n            {\n                PassivationCapable pc = (PassivationCapable) bean;\n                viewAccessBeanAccessHistory.getAccessedBeans().add(pc.getId());\n            }\n        }\n    }\n\n    @Override\n    public <T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)\n    {\n        try\n        {\n            return super.get(bean, creationalContext);\n        }\n        finally\n        {\n            if (bean instanceof PassivationCapable)\n            {\n                PassivationCapable pc = (PassivationCapable) bean;\n                viewAccessBeanAccessHistory.getAccessedBeans().add(pc.getId());\n            }\n        }\n    }\n    \n    @Override\n    protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExist)\n    {\n        return this.viewAccessBeanHolder.getContextualStorage(this.beanManager, KEY, createIfNotExist);\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope()\n    {\n        return ViewAccessScoped.class;\n    }\n\n    @Override\n    public boolean isActive()\n    {\n        return this.windowContext.isActive(); //autom. active once a window is active\n    }\n\n    public void onProcessingViewFinished(String view)\n    {\n        close(view, false);\n    }\n\n    public void close(String view, boolean force)\n    {\n        // ignore if WindowContext isn't active - our ViewAccessViewHistory is WindowScoped\n        if (!windowContext.isActive())\n        {\n            return;\n        }\n\n        // destroy beans only if the view has been changed\n        if (force || !view.equals(viewAccessViewHistory.getLastView()))\n        {\n            viewAccessViewHistory.setLastView(view);\n            \n            destroyExpiredBeans(force);\n        }\n        \n        // clear history after each rendering process\n        viewAccessBeanAccessHistory.getAccessedBeans().clear();\n    }\n    \n    private void destroyExpiredBeans(boolean force)\n    {\n        ContextualStorage storage = viewAccessBeanHolder.getContextualStorage(beanManager, KEY, false);\n        if (storage != null)\n        {\n            for (Map.Entry<Object, ContextualInstanceInfo<?>> storageEntry : storage.getStorage().entrySet())\n            {\n                if (force || !viewAccessBeanAccessHistory.getAccessedBeans().contains((String) storageEntry.getKey()))\n                {\n                    Contextual bean = storage.getBean(storageEntry.getKey());\n                    AbstractContext.destroyBean(bean, storageEntry.getValue());\n                    storage.getStorage().remove(storageEntry.getKey()); //ok due to ConcurrentHashMap\n                }\n            }\n        }\n    }\n\n    @Override\n    public void close()\n    {\n        close(null, true);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContextArtifactProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.viewaccess;\n\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.spi.scope.viewaccess.ViewAccessContextManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class ViewAccessContextArtifactProducer\n{\n    @Inject\n    private DeltaSpikeContextExtension deltaSpikeContextExtension;\n\n    @Produces\n    @Dependent\n    public ViewAccessContextManager getViewAccessContextManager()\n    {\n        return new InjectableViewAccessContextManager(this.deltaSpikeContextExtension.getViewAccessScopedContext());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessViewHistory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.viewaccess;\n\nimport java.io.Serializable;\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\n\n@WindowScoped\npublic class ViewAccessViewHistory implements Serializable\n{\n    private static final long serialVersionUID = 8917607910721148527L;\n    \n    private String lastView;\n\n    public String getLastView()\n    {\n        return lastView;\n    }\n\n    public void setLastView(String lastView)\n    {\n        this.lastView = lastView;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/DefaultWindowContextQuotaHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContextQuotaHandler;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\nimport java.util.Stack;\n\n@SessionScoped\n//could be also dependent-scoped since we only inject it in one session-scoped bean, however,\n//if users would like to customize the behavior they wouldn't be able to use it (if it would be dependent-scoped)\npublic class DefaultWindowContextQuotaHandler implements WindowContextQuotaHandler\n{\n    protected int maxWindowContextCount;\n\n    @Inject\n    private WindowContextQuotaHandlerCache quotaHandlerCache;\n\n    private Stack<String> windowIdStack = new Stack<String>();\n\n    @PostConstruct\n    protected void init()\n    {\n        this.maxWindowContextCount = CoreBaseConfig.ScopeCustomization.WindowRestriction.MAX_COUNT;\n    }\n\n    public synchronized /*no issue due to session-scoped instance*/ void checkWindowContextQuota(String windowId)\n    {\n        if (windowId == null)\n        {\n            return;\n        }\n\n        if (this.quotaHandlerCache.cacheWindowId(windowId))\n        {\n            return;\n        }\n\n        /*\n         * the following part gets executed only once per request, if the window-id is the same\n         */\n\n        if (this.windowIdStack.contains(windowId))\n        {\n            if (windowIdStack.size() > 1) //don't move it up if there is just one entry\n            {\n                this.windowIdStack.remove(windowId);\n                this.windowIdStack.push(windowId);\n            }\n        }\n        else\n        {\n            this.windowIdStack.push(windowId);\n            if (this.windowIdStack.size() > this.maxWindowContextCount)\n            {\n                String windowIdToRemove = this.windowIdStack.remove(0);\n                //destroy it lazily at the end of the request to avoid an overhead during the request\n                //which might be caused by pre-destroy logic of window-scoped beans\n                this.quotaHandlerCache.setWindowIdToDestroy(windowIdToRemove);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/InjectableWindowContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n//keep it public for supporting #{dsWindowContext.getCurrentWindowId()} in addition to\n//#{dsWindowContext.currentWindowId}\n@Vetoed\npublic class InjectableWindowContext implements WindowContext\n{\n    private static final long serialVersionUID = -3606786361833889628L;\n\n    private transient volatile WindowContext windowContext;\n\n    InjectableWindowContext(WindowContext windowContext)\n    {\n        this.windowContext = windowContext;\n    }\n\n    private WindowContext getWindowContext()\n    {\n        if (this.windowContext == null)\n        {\n            this.windowContext =\n                BeanProvider.getContextualReference(DeltaSpikeContextExtension.class).getWindowContext();\n        }\n        return this.windowContext;\n    }\n\n    @Override\n    public String getCurrentWindowId()\n    {\n        return getWindowContext().getCurrentWindowId();\n    }\n\n    @Override\n    public void activateWindow(String windowId)\n    {\n        getWindowContext().activateWindow(windowId);\n    }\n\n    @Override\n    public boolean closeWindow(String windowId)\n    {\n        return getWindowContext().closeWindow(windowId);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowBeanHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport org.apache.deltaspike.core.impl.scope.AbstractBeanHolder;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContextQuotaHandler;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\n/**\n * This holder will store the window Ids and it's beans for the current\n * HTTP Session. We use standard SessionScoped bean to not need\n * to treat async-supported and similar headache.\n */\n@SessionScoped\npublic class WindowBeanHolder extends AbstractBeanHolder<String>\n{\n    private static final long serialVersionUID = 6313493410718133308L;\n\n    @Inject\n    private WindowContextQuotaHandler windowContextQuotaHandler;\n\n    private boolean windowContextQuotaHandlerEnabled;\n\n    @PostConstruct\n    protected void init()\n    {\n        Class<? extends Deactivatable> windowContextQuotaHandlerClass =\n            ProxyUtils.getUnproxiedClass(windowContextQuotaHandler.getClass());\n\n        this.windowContextQuotaHandlerEnabled = ClassDeactivationUtils.isActivated(windowContextQuotaHandlerClass);\n    }\n\n    @Override\n    public ContextualStorage getContextualStorage(BeanManager beanManager, String key, boolean createIfNotExist)\n    {\n        ContextualStorage result = super.getContextualStorage(beanManager, key, createIfNotExist);\n        if (this.windowContextQuotaHandlerEnabled)\n        {\n            //only check it once the storage was created successfully\n            this.windowContextQuotaHandler.checkWindowContextQuota(key);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\nimport java.lang.annotation.Annotation;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.core.util.context.AbstractContext;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\n/**\n * CDI Context to handle &#064;{@link WindowScoped} beans.\n * This also implements the interface to control the id of\n * the currently active 'window' (e.g. a web browser tab).\n */\n@Vetoed\npublic class WindowContextImpl extends AbstractContext implements WindowContext\n{\n    /**\n     * Holds the currently active windowId of each Request\n     */\n    private WindowIdHolder windowIdHolder;\n\n    /**\n     * Contains the stored WindowScoped contextual instances.\n     */\n    private WindowBeanHolder windowBeanHolder;\n\n    /**\n     * needed for serialisation and passivationId\n     */\n    private BeanManager beanManager;\n\n\n    public WindowContextImpl(BeanManager beanManager)\n    {\n        super(beanManager);\n\n        this.beanManager = beanManager;\n    }\n\n    /**\n     * We need to pass the session scoped windowbean holder and the\n     * requestscoped windowIdHolder in a later phase because\n     * getBeans is only allowed from AfterDeploymentValidation onwards.\n     */\n    public void init(WindowBeanHolder windowBeanHolder, WindowIdHolder windowIdHolder)\n    {\n        this.windowBeanHolder = windowBeanHolder;\n        this.windowIdHolder = windowIdHolder;\n    }\n\n\n    @Override\n    public void activateWindow(String windowId)\n    {\n        windowIdHolder.setWindowId(windowId);\n    }\n\n    @Override\n    public String getCurrentWindowId()\n    {\n        if (windowIdHolder == null)\n        {\n            return null;\n        }\n\n        return windowIdHolder.getWindowId();\n    }\n\n    @Override\n    public boolean closeWindow(String windowId)\n    {\n        if (windowId == null)\n        {\n            return false;\n        }\n\n        ContextualStorage windowStorage = windowBeanHolder.getStorageMap().remove(windowId);\n\n        if (windowStorage != null)\n        {\n            if (windowId.equals(this.windowIdHolder.getWindowId()))\n            {\n                this.windowIdHolder.setWindowId(null);\n            }\n            AbstractContext.destroyAllActive(windowStorage);\n        }\n\n        return windowStorage != null;\n    }\n\n    @Override\n    protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExist)\n    {\n        String windowId = getCurrentWindowId();\n        if (windowId == null)\n        {\n            throw new ContextNotActiveException(\"WindowContext: no windowId set for the current Thread yet!\");\n        }\n\n        return windowBeanHolder.getContextualStorage(beanManager, windowId, createIfNotExist);\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope()\n    {\n        return WindowScoped.class;\n    }\n\n    /**\n     * The WindowContext is active once a current windowId is set for the current Thread.\n     * @return\n     */\n    @Override\n    public boolean isActive()\n    {\n        String windowId = getCurrentWindowId();\n        return windowId != null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\n\n/**\n * This producer provides access to the internally created\n * {@link WindowContext} implementation.\n * It simply wraps through to the instance used in the\n * {@link org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension}.\n */\n@ApplicationScoped\npublic class WindowContextProducer\n{\n    @Inject\n    private DeltaSpikeContextExtension deltaSpikeContextExtension;\n\n    @Produces\n    @Named(\"dsWindowContext\")\n    @Dependent\n    public WindowContext getWindowContext()\n    {\n        return new InjectableWindowContext(deltaSpikeContextExtension.getWindowContext());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextQuotaHandlerCache.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Inject;\nimport java.io.Serializable;\n\n@RequestScoped\npublic class WindowContextQuotaHandlerCache implements Serializable\n{\n    private String checkedWindowId;\n    private String windowIdToRemove;\n\n    @Inject\n    private WindowContext windowContext;\n\n    /**\n     * @param currentWindowId window-id which gets processed right now\n     * @return true if the previously checked window-id is the same, false otherwise\n     */\n    public boolean cacheWindowId(String currentWindowId)\n    {\n        boolean result = currentWindowId.equals(this.checkedWindowId);\n        this.checkedWindowId = currentWindowId;\n        return result;\n    }\n\n    public void setWindowIdToDestroy(String windowIdToRemove)\n    {\n        this.windowIdToRemove = windowIdToRemove;\n    }\n\n    @PreDestroy\n    public void cleanup()\n    {\n        if (this.windowIdToRemove != null)\n        {\n            this.windowContext.closeWindow(this.windowIdToRemove);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowIdHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.scope.window;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n/**\n * Simple class which just provides a &#064;RequestScoped windowId.\n * This assures that there is maximum one single windowId associated\n * with a single Thread or Request. We use &#064;RequestScoped because\n * this also works in async-supported Servlets without having to\n * take care about moving info between ThreadLocals.\n */\n@RequestScoped\npublic class WindowIdHolder\n{\n    private String windowId;\n\n    /**\n     * @return the detected windowId or <code>null</code> if not yet set.\n     */\n    public String getWindowId()\n    {\n        return windowId;\n    }\n\n    /**\n     * Set the windowId for the current thread.\n     * @param windowId\n     */\n    public void setWindowId(String windowId)\n    {\n        this.windowId = windowId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/throttling/DefaultThrottledStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.throttling;\n\nimport org.apache.deltaspike.core.spi.throttling.ThrottledStrategy;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\n\n@Dependent\npublic class DefaultThrottledStrategy implements ThrottledStrategy\n{\n    @Inject\n    private InvokerStorage metadata;\n\n    @Override\n    public Object execute(InvocationContext ic) throws Exception\n    {\n        return metadata.getOrCreateInvoker(ic).invoke(ic);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/throttling/Invoker.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.throttling;\n\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\nimport jakarta.interceptor.InvocationContext;\nimport java.util.concurrent.Semaphore;\nimport java.util.concurrent.TimeUnit;\n\nclass Invoker\n{\n    private final int weight;\n    private final Semaphore semaphore;\n    private final long timeout;\n\n    Invoker(final Semaphore semaphore, final int weight, final long timeout)\n    {\n        this.semaphore = semaphore;\n        this.weight = weight;\n        this.timeout = timeout;\n    }\n\n    public Object invoke(final InvocationContext context) throws Exception\n    {\n        if (timeout > 0)\n        {\n            try\n            {\n                if (!semaphore.tryAcquire(weight, timeout, TimeUnit.MILLISECONDS))\n                {\n                    throw new IllegalStateException(\n                        \"Can't acquire \" + weight + \" permits for \" + context.getMethod() + \" in \" + timeout + \"ms\");\n                }\n            }\n            catch (final InterruptedException e)\n            {\n                return onInterruption(e);\n            }\n        }\n        else\n        {\n            try\n            {\n                semaphore.acquire(weight);\n            }\n            catch (final InterruptedException e)\n            {\n                return onInterruption(e);\n            }\n        }\n        try\n        {\n            return context.proceed();\n        }\n        finally\n        {\n            semaphore.release(weight);\n        }\n    }\n\n    private static Semaphore onInterruption(final InterruptedException e)\n    {\n        Thread.interrupted();\n        throw ExceptionUtils.throwAsRuntimeException(e);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/throttling/InvokerStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.throttling;\n\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.api.throttling.Throttled;\nimport org.apache.deltaspike.core.api.throttling.Throttling;\nimport org.apache.deltaspike.core.impl.util.AnnotatedMethods;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.reflect.Method;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.concurrent.Semaphore;\n\n@ApplicationScoped\n@Typed(InvokerStorage.class)\npublic class InvokerStorage implements Throttling.SemaphoreFactory\n{\n    private final ConcurrentMap<String, Semaphore> semaphores = new ConcurrentHashMap<String, Semaphore>();\n    private final ConcurrentMap<Method, Invoker> providers = new ConcurrentHashMap<Method, Invoker>();\n\n    @Inject\n    private BeanManager beanManager;\n\n    Invoker getOrCreateInvoker(final InvocationContext ic)\n    {\n        final Method method = ic.getMethod();\n        Invoker i = providers.get(method);\n        if (i == null)\n        {\n            final Class declaringClass = method.getDeclaringClass();\n            final AnnotatedType<Object> annotatedType = beanManager.createAnnotatedType(declaringClass);\n            final AnnotatedMethod<?> annotatedMethod = AnnotatedMethods.findMethod(annotatedType, method);\n\n            Throttled config = annotatedMethod.getAnnotation(Throttled.class);\n            if (config == null)\n            {\n                config = annotatedType.getAnnotation(Throttled.class);\n            }\n            Throttling sharedConfig = annotatedMethod.getAnnotation(Throttling.class);\n            if (sharedConfig == null)\n            {\n                sharedConfig = annotatedType.getAnnotation(Throttling.class);\n            }\n\n            final Throttling.SemaphoreFactory factory =\n                    sharedConfig != null && sharedConfig.factory() != Throttling.SemaphoreFactory.class ?\n                            Throttling.SemaphoreFactory.class.cast(\n                                    beanManager.getReference(beanManager.resolve(\n                                            beanManager.getBeans(\n                                                    sharedConfig.factory())),\n                                            Throttling.SemaphoreFactory.class, null)) : this;\n\n            final Semaphore semaphore = factory.newSemaphore(\n                    annotatedMethod,\n                    sharedConfig != null && !sharedConfig.name().isEmpty() ?\n                            sharedConfig.name() : declaringClass.getName(),\n                    sharedConfig != null && sharedConfig.fair(),\n                    sharedConfig != null ? sharedConfig.permits() : 1);\n            final long timeout = config.timeoutUnit().toMillis(config.timeout());\n            final int weigth = config.weight();\n            i = new Invoker(semaphore, weigth, timeout);\n            final Invoker existing = providers.putIfAbsent(ic.getMethod(), i);\n            if (existing != null)\n            {\n                i = existing;\n            }\n        }\n        return i;\n    }\n\n    @Override\n    public Semaphore newSemaphore(final AnnotatedMethod<?> method, final String name,\n                                  final boolean fair, final int permits)\n    {\n        Semaphore semaphore = semaphores.get(name);\n        if (semaphore == null)\n        {\n            semaphore = new Semaphore(permits, fair);\n            final Semaphore existing = semaphores.putIfAbsent(name, semaphore);\n            if (existing != null)\n            {\n                semaphore = existing;\n            }\n        }\n        return semaphore;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/throttling/ThrottledInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.throttling;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.core.api.throttling.Throttled;\nimport org.apache.deltaspike.core.spi.throttling.ThrottledStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@Throttled\n@Interceptor\n@Priority(1000)\npublic class ThrottledInterceptor implements Serializable\n{\n    @Inject\n    private ThrottledStrategy throttledStrategy;\n\n    @AroundInvoke\n    public Object invoke(final InvocationContext ic) throws Exception\n    {\n        return throttledStrategy.execute(ic);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/AnnotatedMethods.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.util;\n\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport java.lang.reflect.Method;\n\npublic final class AnnotatedMethods\n{\n    private AnnotatedMethods()\n    {\n        // no-op\n    }\n\n    public static AnnotatedMethod<?> findMethod(final AnnotatedType<?> type, final Method method)\n    {\n        AnnotatedMethod<?> annotatedMethod = null;\n        for (final AnnotatedMethod<?> am : type.getMethods())\n        {\n            if (am.getJavaMember().equals(method))\n            {\n                annotatedMethod = am;\n                break;\n            }\n        }\n        if (annotatedMethod == null)\n        {\n            throw new IllegalStateException(\"No annotated method for \" + method);\n        }\n        return annotatedMethod;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/ConversationUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.util;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.ConversationSubGroup;\nimport org.apache.deltaspike.core.impl.scope.conversation.ConversationKey;\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport java.lang.annotation.Annotation;\nimport java.util.Set;\n\n@Vetoed\npublic abstract class ConversationUtils\n{\n    private ConversationUtils()\n    {\n    }\n\n    public static ConversationKey convertToConversationKey(Contextual<?> contextual, BeanManager beanManager)\n    {\n        if (!(contextual instanceof Bean))\n        {\n            if (contextual instanceof PassivationCapable)\n            {\n                contextual = beanManager.getPassivationCapableBean(((PassivationCapable) contextual).getId());\n            }\n            else\n            {\n                throw new IllegalArgumentException(\n                    contextual.getClass().getName() + \" is not of type \" + Bean.class.getName());\n            }\n        }\n\n        Bean<?> bean = (Bean<?>) contextual;\n\n        //don't cache it (due to the support of different producers)\n        ConversationGroup conversationGroupAnnotation = findConversationGroupAnnotation(bean);\n\n        Class<?> conversationGroup;\n        if (conversationGroupAnnotation != null)\n        {\n            conversationGroup = conversationGroupAnnotation.value();\n        }\n        else\n        {\n            conversationGroup = bean.getBeanClass();\n        }\n\n        Set<Annotation> qualifiers = bean.getQualifiers();\n        return new ConversationKey(conversationGroup, qualifiers.toArray(new Annotation[qualifiers.size()]));\n    }\n\n    private static ConversationGroup findConversationGroupAnnotation(Bean<?> bean)\n    {\n        Set<Annotation> qualifiers = bean.getQualifiers();\n\n        for (Annotation qualifier : qualifiers)\n        {\n            if (ConversationGroup.class.isAssignableFrom(qualifier.annotationType()))\n            {\n                return (ConversationGroup) qualifier;\n            }\n        }\n        return null;\n    }\n\n    public static Class<?> getDeclaredConversationGroup(Class<?> conversationGroup)\n    {\n        ConversationSubGroup conversationSubGroup = conversationGroup.getAnnotation(ConversationSubGroup.class);\n\n        if (conversationSubGroup == null)\n        {\n            return conversationGroup;\n        }\n\n        Class<?> result = conversationSubGroup.of();\n\n        if (!ConversationSubGroup.class.equals(result))\n        {\n            return result;\n        }\n\n        result = conversationGroup.getSuperclass();\n\n        if ((result == null || Object.class.getName().equals(result.getName())) &&\n                conversationGroup.getInterfaces().length == 1)\n        {\n            return conversationGroup.getInterfaces()[0];\n        }\n\n        if (result == null)\n        {\n            //TODO move validation to the bootstrapping process\n            throw new IllegalStateException(conversationGroup.getName() + \" hosts an invalid usage of @\" +\n                ConversationSubGroup.class.getName());\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.core.impl.util;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport javax.naming.InitialContext;\nimport javax.naming.Name;\nimport javax.naming.NameClassPair;\nimport javax.naming.NameParser;\nimport javax.naming.NamingEnumeration;\nimport javax.naming.NamingException;\n\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\n\n/**\n * This is the internal helper class for low level access to JNDI\n */\n@Vetoed\npublic abstract class JndiUtils\n{\n    private static final Logger LOG = Logger.getLogger(JndiUtils.class.getName());\n\n    private static InitialContext initialContext = null;\n\n    static\n    {\n        try\n        {\n            initialContext = new InitialContext();\n        }\n        catch (Exception e)\n        {\n            throw new ExceptionInInitializerError(e);\n        }\n    }\n\n    private JndiUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * Resolves an instance for the given name.\n     *\n     * @param name       current name\n     * @param targetType target type\n     * @param <T>        type\n     * @return the found instance, null otherwise\n     */\n    public static <T> T lookup(Name name, Class<? extends T> targetType)\n    {\n        try\n        {\n            return verifyLookupResult(initialContext.lookup(name), name.toString(), targetType);\n        }\n        catch (NamingException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    /**\n     * Resolves an instance for the given name.\n     *\n     * @param name       current name\n     * @param targetType target type\n     * @param <T>        type\n     * @return the found instance, null otherwise\n     */\n    public static <T> T lookup(String name, Class<? extends T> targetType)\n    {\n        try\n        {\n            return verifyLookupResult(initialContext.lookup(name), name, targetType);\n        }\n        catch (NamingException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    /**\n     * Does a checks on given instance looked up previously from JNDI.\n     *\n     * @param name       current name\n     * @param targetType target type\n     * @param <T>        type\n     * @return the found instance, null otherwise\n     */\n    @SuppressWarnings(\"unchecked\")\n    private static <T> T verifyLookupResult(Object result, String name, Class<? extends T> targetType)\n    {\n        if (result != null)\n        {\n            if (targetType.isAssignableFrom(result.getClass()))\n            {\n                // we have a value and the type fits\n                return (T) result;\n            }\n            else if (result instanceof String) //but the target type != String\n            {\n                // lookedUp might be a class name\n                try\n                {\n                    Class<?> classOfResult = ClassUtils.loadClassForName((String) result);\n                    if (targetType.isAssignableFrom(classOfResult))\n                    {\n                        try\n                        {\n                            return (T) classOfResult.newInstance();\n                        }\n                        catch (Exception e)\n                        {\n                            // could not create instance\n                            LOG.log(Level.SEVERE, \"Class \" + classOfResult + \" from JNDI lookup for name \"\n                                    + name + \" could not be instantiated\", e);\n                        }\n                    }\n                    else\n                    {\n                        // lookedUpClass does not extend/implement expectedClass\n                        LOG.log(Level.SEVERE, \"JNDI lookup for key \" + name\n                                + \" returned class \" + classOfResult.getName()\n                                + \" which does not implement/extend the expected class\"\n                                + targetType.getName());\n                    }\n                }\n                catch (ClassNotFoundException cnfe)\n                {\n                    // could not find class\n                    LOG.log(Level.SEVERE, \"Could not find Class \" + result\n                            + \" from JNDI lookup for name \" + name, cnfe);\n                }\n            }\n            else\n            {\n                // we have a value, but the value does not fit\n                LOG.log(Level.SEVERE, \"JNDI lookup for key \" + name + \" should return a value of \"\n                        + targetType + \", but returned \" + result);\n            }\n        }\n\n        return null;\n    }\n\n    /**\n     * Resolves an instances for the given naming context.\n     *\n     * @param name       context name\n     * @param type       target type\n     * @param <T>        type\n     * @return the found instances, null otherwise\n     */\n    public static <T> Map<String, T> list(String name, Class<T> type)\n    {\n        Map<String, T> result = new HashMap<String, T>();\n\n        try\n        {\n            NameParser nameParser = initialContext.getNameParser(name);\n            NamingEnumeration<NameClassPair> enumeration = initialContext.list(name);\n            while (enumeration.hasMoreElements())\n            {\n                try\n                {\n                    NameClassPair binding = enumeration.nextElement();\n                    Name bindingName = nameParser.parse(name).add(binding.getName());                \n                    result.put(binding.getName(), lookup(bindingName, type));\n                }\n                catch (NamingException e)\n                {\n                    if (LOG.isLoggable(Level.FINEST))\n                    {\n                        // this is expected if there is no entry in JNDI for the requested name or type\n                        // so finest level is ok, if devs want to see it they can enable this logger level.\n                        LOG.log(Level.FINEST, \"InitialContext#list failed!\", e);\n                    }\n                }\n            }\n        }\n        catch (NamingException e)\n        {\n            // this is fine at this point, since the individual lines will be caught currently.\n            LOG.log(Level.WARNING,\"Problem reading the name of the JNDI location \" + name\n                + \" or failuring listing pairs.\",e);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/resources/META-INF/MANIFEST.MF",
    "content": "Main-Class: org.apache.deltaspike.core.impl.crypto.CipherCli\nBundle-License: https://www.apache.org/licenses/LICENSE-2.0.txt\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n  <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/core/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension\norg.apache.deltaspike.core.impl.message.MessageBundleExtension\norg.apache.deltaspike.core.impl.config.ConfigurationExtension\norg.apache.deltaspike.core.impl.jmx.MBeanExtension\norg.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension\norg.apache.deltaspike.core.impl.interceptor.interdyn.InterDynExtension"
  },
  {
    "path": "deltaspike/core/impl/src/main/resources/META-INF/services/org.apache.deltaspike.core.api.config.ConfigResolver$ConfigProvider",
    "content": "#\r\n# Licensed to the Apache Software Foundation (ASF) under one\r\n# or more contributor license agreements. See the NOTICE file\r\n# distributed with this work for additional information\r\n# regarding copyright ownership. The ASF licenses this file\r\n# to you under the Apache License, Version 2.0 (the\r\n# \"License\"); you may not use this file except in compliance\r\n# with the License. You may obtain a copy of the License at\r\n#\r\n# http://www.apache.org/licenses/LICENSE-2.0\r\n#\r\n# Unless required by applicable law or agreed to in writing,\r\n# software distributed under the License is distributed on an\r\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n# KIND, either express or implied. See the License for the\r\n# specific language governing permissions and limitations\r\n# under the License.\r\n#\r\n\r\norg.apache.deltaspike.core.impl.config.ConfigProviderImpl"
  },
  {
    "path": "deltaspike/core/impl/src/main/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.core.impl.config.DefaultConfigSourceProvider\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/BeanConfigResolverTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport java.util.function.BiFunction;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.test.core.api.config.beans.ServerEndpointPojoWithCt;\nimport org.apache.deltaspike.test.core.api.config.beans.ServerEndpointPojoWithFields;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class BeanConfigResolverTest\n{\n    @Test\n    public void testBeanConverterConfig()\n    {\n        final BiFunction<Config, String, ServerEndpointPojoWithCt> serverBeanConverter = (cfg, path) -> new ServerEndpointPojoWithCt(\n            cfg.resolve(path + \"host\").getValue(),\n            cfg.resolve(path + \"port\").as(Integer.class).getValue(),\n            cfg.resolve(path + \"path\").getValue());\n\n        final ServerEndpointPojoWithCt someServer = ConfigResolver.resolve(\"myapp.some.server\")\n            .asBean(ServerEndpointPojoWithCt.class, serverBeanConverter)\n            .getValue();\n        Assert.assertNotNull(someServer);\n        Assert.assertEquals(\"http://myserver:80/myapp/endpoint1\", someServer.toString());\n\n        final ServerEndpointPojoWithCt otherServer = ConfigResolver.resolve(\"myapp.other.server\")\n            .asBean(ServerEndpointPojoWithCt.class, serverBeanConverter)\n            .getValue();\n        Assert.assertNotNull(otherServer);\n        Assert.assertEquals(\"https://otherserver:443/otherapp/endpoint2\", otherServer.toString());\n    }\n\n    @Test\n    public void testConfigBeanWithCt()\n    {\n        final ServerEndpointPojoWithCt someServer = ConfigResolver.resolve(\"myapp.some.server\")\n            .asBean(ServerEndpointPojoWithCt.class)\n            .getValue();\n        Assert.assertNotNull(someServer);\n        Assert.assertEquals(\"http://myserver:80/myapp/endpoint1\", someServer.toString());\n    }\n\n    @Test\n    public void testConfigBeanWithFields()\n    {\n        final ServerEndpointPojoWithFields someServer = ConfigResolver.resolve(\"myapp.some.server\")\n            .asBean(ServerEndpointPojoWithFields.class)\n            .getValue();\n        Assert.assertNotNull(someServer);\n        Assert.assertEquals(\"http://myserver:80/myapp/endpoint1\", someServer.toString());\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigHelperTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\npublic class ConfigHelperTest {\n\n    @Test\n    public void testDiffConfig() {\n        ConfigResolver.ConfigHelper cfgHelper = ConfigResolver.getConfigProvider().getHelper();\n\n        Map<String, String> oldVal = new HashMap<>();\n        Map<String, String> newVal = new HashMap<>();\n\n        oldVal.put(\"a\", \"1\");\n\n        newVal.put(\"b\", \"2\");\n        newVal.put(\"a\", \"1\");\n\n        assertAll(cfgHelper.diffConfig(null, newVal), \"a\", \"b\");\n        assertAll(cfgHelper.diffConfig(oldVal, null), \"a\");\n        assertAll(cfgHelper.diffConfig(oldVal, newVal), \"b\");\n        assertAll(cfgHelper.diffConfig(oldVal, oldVal));\n        assertAll(cfgHelper.diffConfig(newVal, newVal));\n\n        newVal.put(\"a\", \"5\");\n        assertAll(cfgHelper.diffConfig(oldVal, newVal), \"a\", \"b\");\n\n    }\n\n    private void assertAll(Set<String> actualVals, String... expectedVals) {\n        Assert.assertNotNull(actualVals);\n        Assert.assertEquals(expectedVals.length, actualVals.size());\n\n        for (String expectedVal : expectedVals) {\n            Assert.assertTrue(actualVals.contains(expectedVal));\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigResolverTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.function.BiFunction;\n\n@SuppressWarnings(\"Duplicates\")\npublic class ConfigResolverTest\n{\n    private static final String DEFAULT_VALUE = \"defaultValue\";\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void testOverruledValue()\n    {\n        String result = ConfigResolver.getPropertyValue(\"test\");\n\n        Assert.assertEquals(\"test2\", result);\n    }\n\n    @Test\n    public void testOrderOfAllValues()\n    {\n        List<String> result = ConfigResolver.getAllPropertyValues(\"test\");\n\n        Assert.assertEquals(2, result.size());\n        Assert.assertEquals(\"test1\", result.get(0));\n        Assert.assertEquals(\"test2\", result.get(1));\n    }\n\n    @Test\n    public void testStandaloneConfigSource()\n    {\n        Assert.assertNull(ConfigResolver.getPropertyValue(\"notexisting\"));\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey\"));\n    }\n\n    @Test\n    public void testGetProjectStageAwarePropertyValue()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n        Assert.assertNull(ConfigResolver.getProjectStageAwarePropertyValue(\"notexisting\", null));\n\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey\"));\n        Assert.assertEquals(\"unittestvalue\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey\"));\n        Assert.assertEquals(\"unittestvalue\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey\", null));\n\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey2\"));\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey2\"));\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey2\", null));\n\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey3\"));\n        Assert.assertEquals(\"\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey3\"));\n        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue(\"testkey3\", DEFAULT_VALUE));\n\n        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue(\"deltaspike.test.projectstagefallback\", DEFAULT_VALUE));\n        Assert.assertEquals(\"\", ConfigResolver.getProjectStageAwarePropertyValue(\"deltaspike.test.projectstagefallback\"));\n\n        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.resolve(\"deltaspike.test.projectstagefallback\").as(String.class).withDefault(DEFAULT_VALUE).withCurrentProjectStage(true).getValue());\n        Assert.assertEquals(\"\", ConfigResolver.resolve(\"deltaspike.test.projectstagefallback\").as(String.class).withCurrentProjectStage(true).getValue());\n    }\n\n    @Test\n    public void testGetPropertyAwarePropertyValue()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n\n        Assert.assertNull(ConfigResolver.getPropertyAwarePropertyValue(\"notexisting\", null));\n\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey\"));\n        Assert.assertEquals(\"unittestvalue\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey\", \"dbvendor\"));\n        Assert.assertEquals(\"unittestvalue\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey\", \"dbvendor\", null));\n\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey2\"));\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey2\", \"dbvendor\"));\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey2\", \"dbvendor\", null));\n\n        Assert.assertEquals(\"testvalue\", ConfigResolver.getPropertyValue(\"testkey3\"));\n        Assert.assertEquals(\"\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey3\", \"dbvendor\"));\n        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getPropertyAwarePropertyValue(\"testkey3\", \"dbvendor\", DEFAULT_VALUE));\n\n        Assert.assertEquals(\"TestDataSource\", ConfigResolver.getPropertyAwarePropertyValue(\"dataSource\", \"dbvendor\"));\n        Assert.assertEquals(\"PostgreDataSource\", ConfigResolver.getPropertyAwarePropertyValue(\"dataSource\", \"dbvendor2\"));\n        Assert.assertEquals(\"UnitTestDataSource\", ConfigResolver.getPropertyAwarePropertyValue(\"dataSource\", \"dbvendorX\"));\n\n        Assert.assertEquals(\"TestDataSource\", ConfigResolver.getPropertyAwarePropertyValue(\"dataSource\", \"dbvendor\", null));\n        Assert.assertEquals(\"PostgreDataSource\", ConfigResolver.getPropertyAwarePropertyValue(\"dataSource\", \"dbvendor2\", null));\n        Assert.assertEquals(\"UnitTestDataSource\", ConfigResolver.getPropertyAwarePropertyValue(\"dataSource\", \"dbvendorX\", null));\n        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getPropertyAwarePropertyValue(\"dataSourceX\", \"dbvendorX\", DEFAULT_VALUE));\n    }\n\n    @Test\n    public void testConfigFilter()\n    {\n        ConfigFilter configFilter = new TestConfigFilter();\n\n        Assert.assertEquals(\"shouldGetDecrypted: value\", configFilter.filterValue(\"somekey.encrypted\", \"value\"));\n        Assert.assertEquals(\"**********\", configFilter.filterValueForLog(\"somekey.password\", \"value\"));\n\n        ConfigResolver.addConfigFilter(configFilter);\n\n        Assert.assertEquals(\"shouldGetDecrypted: value\", ConfigResolver.getPropertyValue(\"testkey4.encrypted\"));\n        Assert.assertEquals(\"shouldGetDecrypted: value\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey4.encrypted\"));\n        Assert.assertEquals(\"shouldGetDecrypted: value\", ConfigResolver.getProjectStageAwarePropertyValue(\"testkey4.encrypted\", null));\n        Assert.assertEquals(\"shouldGetDecrypted: value\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey4.encrypted\", \"dbvendor\"));\n        Assert.assertEquals(\"shouldGetDecrypted: value\", ConfigResolver.getPropertyAwarePropertyValue(\"testkey4.encrypted\", \"dbvendor\", null));\n\n        List<String> allPropertyValues = ConfigResolver.getAllPropertyValues(\"testkey4.encrypted\");\n        Assert.assertNotNull(allPropertyValues);\n        Assert.assertEquals(1, allPropertyValues.size());\n        Assert.assertEquals(\"shouldGetDecrypted: value\", allPropertyValues.get(0));\n\n    }\n\n    @Test\n    public void testGetConfigFilter()\n    {\n        // make sure no ConfigFilter is left over from previous tests\n        ConfigResolver.getConfigProvider().releaseConfig(ClassUtils.getClassLoader(null));\n\n        List<ConfigFilter> configFilters = ConfigResolver.getConfigFilters();\n        Assert.assertNotNull(configFilters);\n        Assert.assertEquals(1, configFilters.size());\n        Assert.assertEquals(SecretTestConfigFilter.class, configFilters.get(0).getClass());\n    }\n\n    @Test\n    public void testConfigVariableReplacement()\n    {\n        {\n            String url = ConfigResolver.getPropertyValue(\"deltaspike.test.someapp.soap.endpoint\", \"\", true);\n            Assert.assertEquals(\"http://localhost:12345/someservice/myendpoint\", url);\n        }\n\n        {\n            String url = ConfigResolver.getPropertyValue(\"deltaspike.test.someapp.soap.endpoint\", true);\n            Assert.assertEquals(\"http://localhost:12345/someservice/myendpoint\", url);\n        }\n    }\n\n    @Test\n    public void testConfigVariableReplacementInDefault()\n    {\n        {\n            String url = ConfigResolver.getPropertyValue(\"deltaspike.test.notexisting\",\n                    \"url: ${deltaspike.test.host.url}\", true);\n            Assert.assertEquals(\"url: http://localhost:12345\", url);\n        }\n\n        {\n            String url = ConfigResolver.getPropertyValue(\"deltaspike.test.someapp.soap.endpoint\", true);\n            Assert.assertEquals(\"http://localhost:12345/someservice/myendpoint\", url);\n        }\n    }\n\n    @Test\n    public void testConfigVariableNotExisting()\n    {\n        {\n            String url = ConfigResolver.getPropertyValue(\"deltaspike.test.nonexisting.variable\", \"\", true);\n            Assert.assertEquals(\"${does.not.exist}/someservice/myendpoint\", url);\n        }\n        {\n            String url = ConfigResolver.getPropertyValue(\"deltaspike.test.nonexisting.variable\", true);\n            Assert.assertEquals(\"${does.not.exist}/someservice/myendpoint\", url);\n        }\n    }\n\n    @Test\n    public void testConfigVariableRecursiveDeclaration()\n    {\n        String url = ConfigResolver.getPropertyValue(\"deltaspike.test.recursive.variable1\", \"\", true);\n        Assert.assertEquals(\"pre-crazy-post/ohgosh/crazy\", url);\n\n        ConfigResolver.TypedResolver<String> tr = ConfigResolver.resolve(\"deltaspike.test.recursive.variable1\")\n            .evaluateVariables(true).logChanges(true);\n        Assert.assertEquals(\"pre-crazy-post/ohgosh/crazy\", tr.getValue());\n    }\n\n    @Test\n    public void testTypedResolver_NonExistingValue()\n    {\n        final String key = \"non.existing.key\";\n\n        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(key)\n            .logChanges(true);\n\n        Assert.assertNull(resolver.getValue());\n\n        setTestConfigSourceValue(key, \"somevalue\");\n        Assert.assertEquals(\"somevalue\", resolver.getValue());\n\n        setTestConfigSourceValue(key, null);\n        Assert.assertNull(resolver.getValue());\n    }\n    \n    @Test\n    public void testTypedResolver_OnChange()\n    {\n        final String key = \"non.existing.key\";\n\n        final AtomicInteger valueChanged = new AtomicInteger(0);\n\n        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(key)\n            .logChanges(true)\n            .onChange((k, oldValue, newValue) ->\n            {\n                Assert.assertEquals(key, k);\n                valueChanged.incrementAndGet();\n            });\n\n        Assert.assertNull(resolver.getValue());\n\n        setTestConfigSourceValue(key, \"somevalue\");\n        Assert.assertEquals(\"somevalue\", resolver.getValue());\n        Assert.assertEquals(1, valueChanged.get());\n\n        setTestConfigSourceValue(key, \"newvalue\");\n        Assert.assertEquals(\"newvalue\", resolver.getValue());\n        Assert.assertEquals(2, valueChanged.get());\n\n        // this time we do not change anything\n        Assert.assertEquals(\"newvalue\", resolver.getValue());\n        Assert.assertEquals(2, valueChanged.get());\n\n        // last change\n        setTestConfigSourceValue(key, null);\n        Assert.assertNull(resolver.getValue());\n        Assert.assertEquals(3, valueChanged.get());\n    }\n\n    @Test\n    public void testProjectStageAwarePropertyValueReference_1() {\n        final String expectedFooUrl =\n                \"http://bar-dev/services\";\n\n        final String actualFooUrl =\n                ConfigResolver.getProjectStageAwarePropertyValue(\n                \"foo.url\");\n\n        Assert.assertEquals(expectedFooUrl, actualFooUrl);\n    }\n\n    @Test\n    public void testProjectStageAwarePropertyValueReference_2() {\n        final String expected =\n                \"projectStageAware-exampleEntry-1-is-tomato-UnitTest\";\n\n        final String projectStageAwareExampleEntry1 =\n                ConfigResolver.getProjectStageAwarePropertyValue(\n                \"deltaspike.test.exampleEntry-2\", \n                \"\");\n\n        Assert.assertEquals(expected, projectStageAwareExampleEntry1);\n    }\n\n    @Test\n    public void testConfiguredListValues_WithWhitespace() {\n        List<String> emails = ConfigResolver.resolve(\"test.list.value.emails\").asList().getValue();\n        Assert.assertNotNull(emails);\n        Assert.assertEquals(3, emails.size());\n        Assert.assertTrue(emails.contains(\"test1@apache.org\"));\n        Assert.assertTrue(emails.contains(\"test2@apache.org\"));\n        Assert.assertTrue(emails.contains(\"test3@apache.org\"));\n    }\n\n    @Test\n    public void testConfiguredListValues_WithEscaping() {\n        List<String> escapedValues = ConfigResolver.resolve(\"test.list.value.escaped.list\").asList().getValue();\n        Assert.assertNotNull(escapedValues);\n        Assert.assertEquals(3, escapedValues.size());\n        Assert.assertTrue(escapedValues.contains(\"val,ue1\"));\n        Assert.assertTrue(escapedValues.contains(\"value2\"));\n        Assert.assertTrue(escapedValues.contains(\"val\\\\ue3\"));\n    }\n\n    @Test\n    public void testConfiguredListValues_OtherType() {\n        List<Integer> intValues = ConfigResolver.resolve(\"test.list.intvalues\").as(Integer.class).asList().getValue();\n        Assert.assertNotNull(intValues);\n        Assert.assertEquals(4, intValues.size());\n        Assert.assertTrue(intValues.contains(3));\n        Assert.assertTrue(intValues.contains(7));\n        Assert.assertTrue(intValues.contains(11));\n        Assert.assertTrue(intValues.contains(17));\n    }\n\n    @Test\n    public void testConfiguredListValues_NotExisting() {\n        List<Integer> intValues = ConfigResolver.resolve(\"test.list.not_existing\").as(Integer.class).asList().getValue();\n        Assert.assertNotNull(intValues);\n        Assert.assertEquals(0, intValues.size());\n    }\n\n    @Test\n    public void testConfiguredListValues_WithDefault() {\n        List<Integer> intValues = ConfigResolver.resolve(\"test.list.not_existing\").as(Integer.class).asList().withDefault(Arrays.asList(99, 88, 77)).getValue();\n        Assert.assertNotNull(intValues);\n        Assert.assertEquals(3, intValues.size());\n        Assert.assertTrue(intValues.contains(99));\n        Assert.assertTrue(intValues.contains(88));\n        Assert.assertTrue(intValues.contains(77));\n    }\n\n    private void setTestConfigSourceValue(String key, String value)\n    {\n        ConfigSource[] configSources = ConfigResolver.getConfigSources();\n        for (ConfigSource configSource : configSources)\n        {\n            if (configSource instanceof TestConfigSource)\n            {\n                if (value == null)\n                {\n                    configSource.getProperties().remove(key);\n                }\n                else\n                {\n                    configSource.getProperties().put(key, value);\n                }\n\n                break;\n            }\n        }\n    }\n\n    public static class TestConfigFilter implements ConfigFilter\n    {\n        @Override\n        public String filterValue(String key, String value)\n        {\n            if (key.contains(\"encrypted\"))\n            {\n                return \"shouldGetDecrypted: \" + value;\n            }\n            return value;\n        }\n\n        @Override\n        public String filterValueForLog(String key, String value)\n        {\n            if (key.contains(\"password\"))\n            {\n                return \"**********\";\n            }\n            return value;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigSnapshotTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.apache.deltaspike.core.api.config.Config;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.ConfigSnapshot;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\n\n\npublic class ConfigSnapshotTest\n{\n    private static final String HOST_KEY = \"ds.test.myapp.host\";\n    private static final String PORT1_KEY = \"ds.test.myapp.port1\";\n    private static final String PORT2_KEY = \"ds.test.myapp.port2\";\n\n    private ConfigResolver.TypedResolver<String> hostCfg;\n    private ConfigResolver.TypedResolver<Integer> port1Cfg;\n    private ConfigResolver.TypedResolver<Integer> port2Cfg;\n\n\n    @Test\n    public void testConfigTx()\n    {\n        Config cfg = ConfigResolver.getConfig();\n        ConfigurableTestConfigSource configSource = ConfigurableTestConfigSource.instance();\n        try\n        {\n            Map<String, String> newVals = new HashMap<>();\n            newVals.put(HOST_KEY, \"host1\");\n            newVals.put(PORT1_KEY, \"1\");\n            newVals.put(PORT2_KEY, \"1\");\n            configSource.setValues(newVals);\n\n            hostCfg = cfg.resolve(HOST_KEY);\n            port1Cfg = cfg.resolve(PORT1_KEY).as(Integer.class);\n            port2Cfg = cfg.resolve(PORT2_KEY).as(Integer.class);\n\n            assertEquals(\"host1\", hostCfg.getValue());\n            assertEquals(Integer.valueOf(1), port1Cfg.getValue());\n            assertEquals(Integer.valueOf(1), port2Cfg.getValue());\n\n            ConfigSnapshot configSnapshot = cfg.snapshotFor(hostCfg, port1Cfg, port2Cfg);\n            assertNotNull(configSnapshot);\n\n            assertEquals(\"host1\", hostCfg.getValue(configSnapshot));\n            assertEquals(Integer.valueOf(1), port1Cfg.getValue(configSnapshot));\n            assertEquals(Integer.valueOf(1), port2Cfg.getValue(configSnapshot));\n\n            // and those values don't change, even if we modify the underlying ConfigSource!\n            newVals.clear();\n            newVals.put(HOST_KEY, \"host2\");\n            newVals.put(PORT1_KEY, \"2\");\n            newVals.put(PORT2_KEY, \"2\");\n            configSource.setValues(newVals);\n\n            assertEquals(\"host1\", hostCfg.getValue(configSnapshot));\n            assertEquals(Integer.valueOf(1), port1Cfg.getValue(configSnapshot));\n            assertEquals(Integer.valueOf(1), port2Cfg.getValue(configSnapshot));\n\n            // but the actual config did really change!\n            assertEquals(\"host2\", hostCfg.getValue());\n            assertEquals(Integer.valueOf(2), port1Cfg.getValue());\n            assertEquals(Integer.valueOf(2), port2Cfg.getValue());\n        }\n        finally\n        {\n            configSource.clear();\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigSourceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport java.io.File;\nimport java.io.FileWriter;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.junit.Assert;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.rules.TemporaryFolder;\n\n/**\n * Unit tests for {@link org.apache.deltaspike.core.spi.config.ConfigSource}\n */\npublic class ConfigSourceTest\n{\n    @Rule\n    public TemporaryFolder temporaryFolder = new TemporaryFolder();\n\n    @Test\n    public void testConfigViaSystemProperty()\n    {\n        String key = \"testProperty01\";\n        String value = \"test_value_01\";\n\n        // the value is not yet configured\n        String configuredValue = ConfigResolver.getPropertyValue(key);\n        Assert.assertNull(configuredValue);\n\n        String myDefaultValue = \"theDefaultValueDummy\";\n        configuredValue = ConfigResolver.getPropertyValue(key, myDefaultValue);\n        Assert.assertEquals(myDefaultValue, configuredValue);\n\n        // now we set a value for the config key\n        System.setProperty(key, value);\n        configuredValue = ConfigResolver.getPropertyValue(key);\n        Assert.assertEquals(value, configuredValue);\n\n        System.setProperty(key, \"\");\n        configuredValue = ConfigResolver.getPropertyValue(key);\n        Assert.assertEquals(\"\", configuredValue);\n\n    }\n\n    @Test\n    public void testConfigViaClasspathPropertyFile()\n    {\n        String key = \"testProperty02\";\n        String value = \"test_value_02\";\n\n        String configuredValue = ConfigResolver.getPropertyValue(key);\n        Assert.assertEquals(value, configuredValue);\n    }\n\n    @Test\n    public void testConfigUninitializedDefaultValue()\n    {\n        String key = \"nonexistingProperty01\";\n\n        // passing in null as default value should work fine\n        String configuredValue = ConfigResolver.getPropertyValue(key, null);\n        Assert.assertNull(configuredValue);\n\n        String myDefaultValue = \"theDefaultValueDummy\";\n        configuredValue = ConfigResolver.getPropertyValue(key, myDefaultValue);\n        Assert.assertEquals(myDefaultValue, configuredValue);\n    }\n\n    @Test\n    public void testConfigViaMetaInfPropertyFile()\n    {\n        String key = \"testProperty03\";\n        String value = \"test_value_03\";\n\n        String configuredValue = ConfigResolver.getPropertyValue(key);\n        Assert.assertEquals(value, configuredValue);\n    }\n\n    @Test\n    public void testConfigFilter()\n    {\n        String secretVal = ConfigResolver.getPropertyValue(\"my.very.secret\");\n        Assert.assertNotNull(secretVal);\n        Assert.assertEquals(\"a secret value: onlyIDoKnowIt\", secretVal);\n    }\n\n    @Test\n    public void testEnvProperties() {\n        String javaHome = System.getenv(\"JAVA_HOME\");\n        if (javaHome == null || javaHome.isEmpty())\n        {\n            // weird, should exist. Anyway, in that case we cannot test it.\n            return;\n        }\n\n        // we search for JAVA.HOME which should also give us JAVA_HOME\n        String value = ConfigResolver.getPropertyValue(\"JAVA.HOME\");\n        Assert.assertNotNull(value);\n        Assert.assertEquals(javaHome, value);\n    }\n\n\n    @Test\n    public void testUserHomeConfigProperties() throws Exception {\n        String userHomeKey = \"user.home\";\n        String oldUserHome = System.getProperty(userHomeKey);\n        try\n        {\n            File newUserHomeFolder = temporaryFolder.newFolder();\n            System.setProperty(userHomeKey, newUserHomeFolder.getAbsolutePath());\n\n            File dsHomeConfig = new File(newUserHomeFolder, \".deltaspike/apache-deltaspike.properties\");\n            dsHomeConfig.getParentFile().mkdirs();\n\n            FileWriter fw = new FileWriter(dsHomeConfig);\n            fw.write(\"ds.test.fromHome=withLove\\ndeltaspike_ordinal=123\");\n\n            fw.close();\n\n            // force freshly picking up all ConfigSources for this test\n            ConfigResolver.freeConfigSources();\n\n            Assert.assertEquals(\"withLove\", ConfigResolver.getPropertyValue(\"ds.test.fromHome\"));\n        }\n        finally\n        {\n            System.setProperty(userHomeKey, oldUserHome);\n            ConfigResolver.freeConfigSources();\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigurableTestConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\n\nimport java.util.Arrays;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Consumer;\n\n/**\n * A ConfigSource which is backed by a ThreadLocal.\n * So it can be dynamically configured even for parallel tests.\n *\n * Note that you MUST call the {@link #clear()} method at the end of a method which uses this ConfigSource.\n */\npublic class ConfigurableTestConfigSource implements ConfigSource\n{\n    private static ThreadLocal<Map<String, String>> props = new ThreadLocal<>();\n\n    private Consumer<Set<String>> reportAttributeChange;\n\n    @Override\n    public int getOrdinal()\n    {\n        return 500;\n    }\n\n    public static ConfigurableTestConfigSource instance() {\n        return (ConfigurableTestConfigSource) Arrays.stream(ConfigResolver.getConfig().getConfigSources())\n                .filter(cs -> cs instanceof ConfigurableTestConfigSource)\n                .findFirst()\n                .get();\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        Map<String, String> propMap = props.get();\n        if (propMap == null)\n        {\n            propMap = new ConcurrentHashMap<>();\n            props.set(propMap);\n        }\n        return propMap;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return getProperties().get(key);\n    }\n\n    @Override\n    public String getConfigName()\n    {\n        return this.getClass().getSimpleName();\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n\n    public void clear()\n    {\n        props.set(null);\n        props.remove();\n    }\n\n    public void setValues(Map<String, String> values)\n    {\n        getProperties().putAll(values);\n\n        // now notify our Config that some values got changed\n        reportAttributeChange.accept(values.keySet());\n    }\n\n    @Override\n    public void setOnAttributeChange(Consumer<Set<String>> reportAttributeChange)\n    {\n        this.reportAttributeChange = reportAttributeChange;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/SecretTestConfigFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\n\n/**\n * a test ConfigFilter which decrypts the secret message\n */\npublic class SecretTestConfigFilter implements ConfigFilter\n{\n    @Override\n    public String filterValue(String key, String value)\n    {\n        if (key.contains(\"secret\"))\n        {\n            return \"a secret value: \" + value;\n        }\n        return value;\n    }\n\n    @Override\n    public String filterValueForLog(String key, String value)\n    {\n        if (key.contains(\"secret\"))\n        {\n            return \"**********\";\n        }\n        return value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TestConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.test.util.activation.EditableTestDeactivator;\n\n/**\n * Test ConfigSource\n *\n * It statically returns 'testvalue' for the key 'testkey'\n */\npublic class TestConfigSource implements ConfigSource\n{\n\n    private int ordinal = 700;\n\n    private Map<String, String> props = new HashMap<String, String>();\n\n\n    public TestConfigSource()\n    {\n        // a ProjectStage overloaded value\n        props.put(\"testkey\", \"testvalue\");\n        props.put(\"testkey.UnitTest\", \"unittestvalue\");\n\n        // a value without any overloading\n        props.put(\"testkey2\", \"testvalue\");\n\n        // a value which got ProjectStage overloaded to an empty value\n        props.put(\"testkey3\", \"testvalue\");\n        props.put(\"testkey3.UnitTest\", \"\");\n\n        // now for the PropertyAware tests\n        props.put(\"dbvendor.UnitTest\", \"mysql\");\n        props.put(\"dbvendor\", \"postgresql\");\n\n        props.put(\"dataSource.mysql.Production\", \"java:/comp/env/MyDs\");\n        props.put(\"dataSource.mysql.UnitTest\", \"TestDataSource\");\n        props.put(\"dataSource.postgresql\", \"PostgreDataSource\");\n        props.put(\"dataSource.UnitTest\", \"UnitTestDataSource\");\n        props.put(\"dataSource\", \"DefaultDataSource\");\n\n        // another one\n        props.put(\"dbvendor2.Production\", \"mysql\");\n        props.put(\"dbvendor2\", \"postgresql\");\n\n        props.put(\"dbvendor3\", \"h2\");\n\n        props.put(\"testkey4.encrypted\", \"value\");\n        props.put(\"testkey4.password\", \"mysecretvalue\");\n\n        props.put(\"deltaspike.test.string-value\", \"configured\");\n        props.put(\"deltaspike.test.integer-value\", \"5\");\n        props.put(\"deltaspike.test.long-value\", \"8589934592\");\n        props.put(\"deltaspike.test.float-value\", \"-1.1\");\n        props.put(\"deltaspike.test.double-value\", \"4e40\");\n        props.put(\"deltaspike.test.boolean-value\", Boolean.FALSE.toString());\n        props.put(\"deltaspike.test.class-value\", TestConfigSource.class.getName());\n        props.put(\"deltaspike.test.date-value\", \"2014-12-24\");\n        props.put(\"deltaspike.test.invalid-value\", \"wrong\");\n        props.put(\"org.apache.deltaspike.core.spi.activation.ClassDeactivator\",EditableTestDeactivator.class.getName());\n\n        // test for variable replacement\n        props.put(\"deltaspike.test.host.url\", \"http://localhost:12345\");\n        props.put(\"deltaspike.test.someapp.soap.endpoint\", \"${deltaspike.test.host.url}/someservice/myendpoint\");\n\n        props.put(\"deltaspike.test.nonexisting.variable\", \"${does.not.exist}/someservice/myendpoint\");\n\n        props.put(\"deltaspike.test.recursive.variable1\", \"${deltaspike.test.recursive.variable2}/ohgosh/${deltaspike.test.recursive.variable3}\");\n        props.put(\"deltaspike.test.recursive.variable2\", \"pre-${deltaspike.test.recursive.variable3}-post\");\n        props.put(\"deltaspike.test.recursive.variable3\", \"crazy\");\n\n        props.put(\"deltaspike.test.projectstagefallback.UnitTest\", \"\");\n        props.put(\"deltaspike.test.projectstagefallback\", \"Value without ProjectStage\");\n        \n        // ProjectStage aware property value with resolved reference\n        props.put(\"foo.url\", \"${bar.url}/services\");\n        props.put(\"bar.url\", \"undefined\");\n        props.put(\"bar.url.UnitTest\", \"http://bar-dev\");\n        props.put(\"bar.url.Production\", \"http://bar-prod\");\n\n        props.put(\"deltaspike.test.exampleEntry-1\", \"tomato\");\n        props.put(\"deltaspike.test.exampleEntry-1.UnitTest\", \"tomato-UnitTest\");\n        props.put(\"deltaspike.test.exampleEntry-2\", \"default-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}\");\n        props.put(\"deltaspike.test.exampleEntry-2.UnitTest\", \"projectStageAware-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}\");\n\n        // values for testing the list handling\n        props.put(\"test.list.value.emails\", \"test1@apache.org, test2@apache.org, \\n  test3@apache.org\");\n        props.put(\"test.list.value.escaped.list\",\"val\\\\,ue1,value2, val\\\\\\\\ue3\");\n        props.put(\"test.list.intvalues\",\"3,7, 11 ,\\t 17\\n\");\n    }\n\n    @Override\n    public String getConfigName()\n    {\n        return \"testConfig\";\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return ordinal;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return props.get(key);\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        return props;\n    }\n\n\t@Override\n\tpublic boolean isScannable() {\n\t\treturn true;\n\t}\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TestConfigSourceProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.config.ConfigSourceProvider;\n\n/**\n * ConfigSourceProvider for basic unit-test\n */\npublic class TestConfigSourceProvider implements ConfigSourceProvider\n{\n    @Override\n    public List<ConfigSource> getConfigSources()\n    {\n        return Arrays.asList(new TestConfigSource1(), new TestConfigSource2());\n    }\n\n    private static class TestConfigSource1 implements ConfigSource\n    {\n        @Override\n        public String getPropertyValue(String key)\n        {\n            if (\"test\".equals(key))\n            {\n                return \"test1\";\n            }\n            if (ConfigSource.DELTASPIKE_ORDINAL.equals(key))\n            {\n                return \"1\";\n            }\n            return null;\n        }\n\n        @Override\n        public Map<String, String> getProperties()\n        {\n            Map<String, String> map = new HashMap<String, String>();\n            map.put(\"test\", \"test1\");\n            return map;\n        }\n\n        @Override\n        public String getConfigName()\n        {\n            return TestConfigSourceProvider.class.getName();\n        }\n\n    }\n\n    private static class TestConfigSource2 implements ConfigSource\n    {\n        @Override\n        public int getOrdinal()\n        {\n            return 2;\n        }\n\n        @Override\n        public String getPropertyValue(String key)\n        {\n            if (\"test\".equals(key))\n            {\n                return \"test2\";\n            }\n            return null;\n        }\n\n        @Override\n        public Map<String, String> getProperties()\n        {\n            Map<String, String> map = new HashMap<String, String>();\n            map.put(\"test\", \"test2\");\n            return map;\n        }\n\n        @Override\n        public String getConfigName()\n        {\n            return TestConfigSourceProvider.class.getName();\n        }\n\n\t\t@Override\n\t\tpublic boolean isScannable() {\n\t\t\treturn false;\n\t\t}\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TypedResolverTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.util.Date;\nimport java.util.GregorianCalendar;\nimport java.util.concurrent.TimeUnit;\n\npublic class TypedResolverTest\n{\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void testValidTypes()\n    {\n        Assert.assertEquals(\"configured\", ConfigResolver.resolve(\"deltaspike.test.string-value\").getValue());\n\n        Assert.assertEquals(Boolean.FALSE, ConfigResolver.resolve(\"deltaspike.test.boolean-value\").as(Boolean.class)\n                .getValue());\n\n        Assert.assertEquals(TestConfigSource.class, ConfigResolver.resolve(\"deltaspike.test.class-value\").as(Class\n                .class).getValue());\n\n        Assert.assertEquals(5l, (int) ConfigResolver.resolve(\"deltaspike.test.integer-value\").as(Integer.class)\n                .getValue());\n\n        Assert.assertEquals(8589934592l, (long) ConfigResolver.resolve(\"deltaspike.test.long-value\").as(Long.class)\n                .getValue());\n\n        Assert.assertEquals(-1.1f, (float) ConfigResolver.resolve(\"deltaspike.test.float-value\").as(Float.class)\n                .getValue(), 0);\n\n        Assert.assertEquals(4e40d, (double) ConfigResolver.resolve(\"deltaspike.test.double-value\").as(Double.class)\n                .getValue(), 0);\n    }\n\n    @Test\n    public void testConverter()\n    {\n        Assert.assertEquals(new GregorianCalendar(2014, 12, 24).getTime(),\n                ConfigResolver.resolve(\"deltaspike.test.date-value\")\n                        .as(Date.class, new TestDateConverter()).getValue());\n\n        // test fallback to default\n        Assert.assertEquals(new GregorianCalendar(2015, 01, 01).getTime(),\n                ConfigResolver.resolve(\"deltaspike.test.INVALID-date-value\")\n                        .as(Date.class, new TestDateConverter())\n                        .withDefault(new GregorianCalendar(2015, 01, 01).getTime())\n                        .getValue());\n    }\n\n    @Test\n    public void testProjectStageAware()\n    {\n        Assert.assertEquals(\"unittestvalue\",\n                ConfigResolver.resolve(\"testkey\")\n                        .withCurrentProjectStage(true)\n                        .getValue());\n\n        Assert.assertEquals(\"testvalue\",\n                ConfigResolver.resolve(\"testkey\")\n                        .withCurrentProjectStage(false)\n                        .getValue());\n\n        // property without PS, with PS-aware\n        Assert.assertEquals(\"testvalue\",\n                ConfigResolver.resolve(\"testkey2\")\n                        .withCurrentProjectStage(true)\n                        .getValue());\n    }\n\n    @Test\n    public void testParameterized()\n    {\n        // param OK, ps OK\n        Assert.assertEquals(\"TestDataSource\",\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(true)\n                        .parameterizedBy(\"dbvendor\")\n                        .getValue());\n\n        // param OK, NO ps\n        Assert.assertEquals(\"PostgreDataSource\",\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(false)\n                        .parameterizedBy(\"dbvendor\")\n                        .getValue());\n\n        // param doesn't resolve, ps OK\n        Assert.assertEquals(\"UnitTestDataSource\",\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(true)\n                        .parameterizedBy(\"INVALIDPARAMETER\")\n                        .getValue());\n\n        // param OK, ps OK, NO base.param.ps, NO base.param, fall back to base.ps\n        Assert.assertEquals(\"UnitTestDataSource\",\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(true)\n                        .parameterizedBy(\"dbvendor3\")\n                        .getValue());\n\n        // param OK, NO ps, base.param undefined, fall back to base\n        Assert.assertEquals(\"DefaultDataSource\",\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(false)\n                        .parameterizedBy(\"dbvendor3\")\n                        .getValue());\n    }\n\n    @Test\n    public void testDefault()\n    {\n        Assert.assertEquals(10l,\n                (long) ConfigResolver.resolve(\"INVALIDKEY\")\n                .as(Long.class)\n                .withDefault(10l).getValue());\n\n        // string default\n        Assert.assertEquals(10l,\n                (long) ConfigResolver.resolve(\"INVALIDKEY\")\n                        .as(Long.class)\n                        .withStringDefault(\"10\").getValue());\n    }\n\n    @Test\n    public void testStrict()\n    {\n        Assert.assertEquals(\"TestDataSource\",\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(true)\n                        .parameterizedBy(\"dbvendor\")\n                        .strictly(true)\n                        .getValue());\n\n        // no base.param, no value for base.param.ps\n        Assert.assertEquals(null,\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(true)\n                        .parameterizedBy(\"dbvendor3\")\n                        .strictly(true)\n                        .getValue());\n\n        // valid base.param, but no base.param.ps\n        Assert.assertEquals(null,\n                ConfigResolver.resolve(\"dataSource\")\n                        .withCurrentProjectStage(true)\n                        .parameterizedBy(\"dbvendor2\")\n                        .strictly(true)\n                        .getValue());\n    }\n\n    @Test\n    public void testGets()\n    {\n        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(\"dataSource\")\n                .withCurrentProjectStage(true)\n                .parameterizedBy(\"dbvendor\")\n                .withDefault(\"TESTDEFAULT\");\n\n        Assert.assertEquals(\"TestDataSource\", resolver.getValue());\n        Assert.assertEquals(\"dataSource\", resolver.getKey());\n        Assert.assertEquals(\"TESTDEFAULT\", resolver.getDefaultValue());\n        Assert.assertEquals(\"dataSource.mysql.UnitTest\", resolver.getResolvedKey());\n\n\n        ConfigResolver.TypedResolver<String> resolver2 = ConfigResolver.resolve(\"testkey2\")\n                .withCurrentProjectStage(true)\n                .parameterizedBy(\"INVALIDPARAMETER\");\n\n\n        Assert.assertEquals(\"testvalue\", resolver2.getValue());\n        Assert.assertEquals(\"testkey2\", resolver2.getResolvedKey());\n    }\n\n    @Test\n    public void testWithCacheTime() throws Exception\n    {\n        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(\"dataSource\")\n            .withCurrentProjectStage(true)\n            .parameterizedBy(\"dbvendor\")\n            .cacheFor(TimeUnit.MILLISECONDS, 5)\n            .withDefault(\"TESTDEFAULT\");\n\n        Assert.assertEquals(\"TestDataSource\", resolver.getValue());\n        Assert.assertEquals(\"TestDataSource\", resolver.getValue());\n        Assert.assertEquals(\"dataSource\", resolver.getKey());\n        Assert.assertEquals(\"TESTDEFAULT\", resolver.getDefaultValue());\n        Assert.assertEquals(\"dataSource.mysql.UnitTest\", resolver.getResolvedKey());\n\n        // because the clock steps in certain OS is only 16ms\n        Thread.sleep(35L);\n        Assert.assertEquals(\"TestDataSource\", resolver.getValue());\n    }\n\n    public static class TestDateConverter implements ConfigResolver.Converter<Date> {\n\n        @Override\n        public Date convert(String value)\n        {\n            String[] parts = value.split(\"-\");\n            return new GregorianCalendar(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]),\n                    Integer.valueOf(parts[2])).getTime();\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/beans/ServerEndpointPojoWithCt.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.beans;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\n/**\n * @author <a href=\"mailto:struberg@apache.org\">Mark Struberg</a>\n */\npublic class ServerEndpointPojoWithCt extends ServerEndpointPojoWithFields\n{\n    public ServerEndpointPojoWithCt(@ConfigProperty(name = \"host\") String host,\n                                    @ConfigProperty(name = \"port\") Integer port,\n                                    @ConfigProperty(name = \"path\") String path)\n    {\n        this.host = host;\n        this.port = port;\n        this.path = path;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/beans/ServerEndpointPojoWithFields.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.beans;\n\n/**\n * @author <a href=\"mailto:struberg@apache.org\">Mark Struberg</a>\n */\npublic class ServerEndpointPojoWithFields\n{\n    protected String host;\n    protected Integer port;\n    protected String path;\n\n    @Override\n    public String toString()\n    {\n        StringBuilder sb = new StringBuilder();\n        if (host == null)\n        {\n            return \"unknown\";\n        }\n        sb.append((port != null && port.equals(443)) ? \"https://\" : \"http://\");\n        sb.append(host);\n        sb.append(port == null ? \":80\" : \":\" + port);\n        sb.append(path != null ? path : \"\");\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/CdiFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.api.config.Filter;\nimport org.apache.deltaspike.core.spi.config.ConfigFilter;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@Filter\n@ApplicationScoped\npublic class CdiFilter implements ConfigFilter\n{\n    @Override\n    public String filterValue(final String key, final String value)\n    {\n        return \"custom-source.test\".equals(key) ? new StringBuilder(value).reverse().toString() : value;\n    }\n\n    @Override\n    public String filterValueForLog(final String key, final String value)\n    {\n        return value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/CdiSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.api.config.Source;\nimport org.apache.deltaspike.core.impl.config.MapConfigSource;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Source\n@ApplicationScoped\npublic class CdiSource extends MapConfigSource\n{\n    public CdiSource() {\n        super(create());\n    }\n\n    private static Map<String, String> create() {\n        final Map<String, String> map = new HashMap<String, String>();\n        map.put(\"custom-source.test\", \"eulav\");\n        return map;\n    }\n\n    @Override\n    public String getConfigName() {\n        return \"cdi-test\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/ConfigBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.Configuration;\n\nimport java.net.URL;\nimport java.util.List;\nimport java.util.Set;\n\n@Configuration\npublic interface ConfigBean\n{\n    @ConfigProperty(name = \"configProperty1\")\n    int intProperty1();\n\n    @ConfigProperty(name = \"configProperty1\", defaultValue = \"myDefaultValue\")\n    String stringProperty3Filled();\n\n    @ConfigProperty(name = \"nonexistingProperty\", defaultValue = \"myDefaultValue\")\n    String stringProperty3Defaulted();\n\n    @ConfigProperty(name = \"nonexistingProperty\", defaultValue = \"42\")\n    Integer intProperty4Defaulted();\n\n    @ConfigProperty(name = \"configProperty1\")\n    Boolean booleanPropertyNull();\n\n    @ConfigProperty(name = \"configProperty1\", defaultValue = \"false\")\n    boolean booleanPropertyFalse();\n\n    @ConfigProperty(name = \"configPropertyTrue1\")\n    Boolean booleanPropertyTrue1();\n\n    @ConfigProperty(name = \"configPropertyTrue2\")\n    Boolean booleanPropertyTrue2();\n\n    @ConfigProperty(name = \"configPropertyTrue3\")\n    Boolean booleanPropertyTrue3();\n\n    @ConfigProperty(name = \"configPropertyTrue4\")\n    Boolean booleanPropertyTrue4();\n\n    @ConfigProperty(name = \"configPropertyTrue5\")\n    Boolean booleanPropertyTrue5();\n\n    @ConfigProperty(name = \"configPropertyTrue6\")\n    Boolean booleanPropertyTrue6();\n\n    @ConfigProperty(name = \"configPropertyTrue7\")\n    Boolean booleanPropertyTrue7();\n\n    @ConfigProperty(name = \"configPropertyTrue8\")\n    Boolean booleanPropertyTrue8();\n\n    @ConfigProperty(name = \"testDbConfig\")\n    String dbConfig();\n\n    @ConfigProperty(name = \"defaultList\", defaultValue = \"http://localhost,http://127.0.0.1\")\n    List<String> defaultListHandling();\n\n    @ConfigProperty(name = \"defaultSet\", defaultValue = \"1,2\")\n    Set<Integer> defaultSetHandling();\n\n    @ConfigProperty(name = \"urlList\", converter = SettingsBean.UrlList.class, defaultValue = \"http://localhost,http://127.0.0.1\")\n    List<URL> urlList();\n\n    @ConfigProperty(name = \"urlListFromProperties\", converter = SettingsBean.UrlList.class)\n    List<URL> urlListFromProperties();\n\n    @ConfigProperty(name = \"custom-source.test\")\n    String customSourceValue();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/CustomConfigAnnotationWithMetaData.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ PARAMETER, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n@ConfigProperty(name = \"configProperty2\")\n@Qualifier\npublic @interface CustomConfigAnnotationWithMetaData\n{\n    @Nonbinding\n    boolean inverseConvert() default false;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/CustomConfigAnnotationWithMetaDataProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\n/**\n * Sample producer for {@link CustomConfigAnnotationWithMetaData}\n */\n@ApplicationScoped\npublic class CustomConfigAnnotationWithMetaDataProducer extends BaseConfigPropertyProducer\n{\n    @Produces\n    @Dependent\n    @CustomConfigAnnotationWithMetaData\n    public Integer produceIntegerCustomConfig(InjectionPoint injectionPoint)\n    {\n        String configuredValue = getStringPropertyValue(injectionPoint);\n\n        if (configuredValue == null || configuredValue.length() == 0)\n        {\n            return 0;\n        }\n\n        Integer result = Integer.parseInt(configuredValue);\n\n        CustomConfigAnnotationWithMetaData metaData =\n                getAnnotation(injectionPoint, CustomConfigAnnotationWithMetaData.class);\n\n        if (metaData != null && metaData.inverseConvert())\n        {\n            return result * -1;\n        }\n\n        return result;\n    }\n\n    @Produces\n    @Dependent\n    @CustomConfigAnnotationWithMetaData\n    public Long produceLongCustomConfig(InjectionPoint injectionPoint)\n    {\n        String configuredValue = getStringPropertyValue(injectionPoint);\n\n        if (configuredValue == null || configuredValue.length() == 0)\n        {\n            return 0L;\n        }\n\n        Long result = Long.parseLong(configuredValue);\n\n        CustomConfigAnnotationWithMetaData metaData =\n                getAnnotation(injectionPoint, CustomConfigAnnotationWithMetaData.class);\n\n        if (metaData != null && metaData.inverseConvert())\n        {\n            return result * -1L;\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/InjectableConfigPropertyTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport jakarta.inject.Inject;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.util.HashSet;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Supplier;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.core.api.config.beans.ServerEndpointPojoWithCt;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.apache.deltaspike.test.util.FileUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport org.apache.deltaspike.test.core.api.config.injectable.numberconfig.NumberConfiguredBean;\n\nimport static java.util.Arrays.asList;\nimport static java.util.Collections.singletonList;\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\n\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class) //X TODO this is only SeCategory as there is currently an Arq problem with properties!\npublic class InjectableConfigPropertyTest\n{\n    /**\n     *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        URL fileUrl = InjectableConfigPropertyTest.class.getClassLoader()\n                .getResource(\"META-INF/apache-deltaspike.properties\");\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"injectableConfigPropertyTest.jar\")\n                .addPackage(SettingsBean.class.getPackage())\n                .addPackage(ServerEndpointPojoWithCt.class.getPackage())\n                .addPackage(NumberConfiguredBean.class.getPackage())\n                .addAsManifestResource(FileUtils.getFileForURL(fileUrl.toString()))\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"beanProvider.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @ConfigProperty(name = \"myapp.some.server\", cacheFor = 2, cacheUnit = TimeUnit.SECONDS)\n    private @Inject Supplier<ServerEndpointPojoWithCt> someServer;\n\n    @ConfigProperty(name = \"myapp.other.server\")\n    private @Inject Supplier<ServerEndpointPojoWithCt> otherServer;\n\n\n    @Test\n    public void injectBeanViaProvider() {\n        assertNotNull(someServer);\n        final ServerEndpointPojoWithCt server1 = someServer.get();\n        assertNotNull(server1);\n        Assert.assertEquals(\"http://myserver:80/myapp/endpoint1\", server1.toString());\n\n        // once again\n        final ServerEndpointPojoWithCt server2 = someServer.get();\n        assertNotNull(server2);\n        Assert.assertEquals(\"http://myserver:80/myapp/endpoint1\", server2.toString());\n        Assert.assertTrue(server1 == server2);\n\n        assertNotNull(otherServer.get());\n        Assert.assertEquals(\"https://otherserver:443/otherapp/endpoint2\", otherServer.get().toString());\n    }\n\n    @Test\n    public void injectionViaConfigProperty()\n    {\n        SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);\n\n        assertEquals(14, settingsBean.getProperty1());\n        assertEquals(7L, settingsBean.getProperty2());\n        assertEquals(-7L, settingsBean.getInverseProperty2());\n\n        // also check the ones with defaultValue\n        assertEquals(\"14\", settingsBean.getProperty3Filled());\n\n        assertEquals(\"myDefaultValue\", settingsBean.getProperty3Defaulted());\n        assertEquals(\"myDefaultValue\", settingsBean.getSupplierStringProperty3Defaulted().get());\n\n        assertEquals(42, settingsBean.getProperty4Defaulted());\n        assertEquals(Integer.valueOf(42), settingsBean.getSupplierIntProperty4Defaulted().get());\n\n        assertEquals(\"some setting for prodDB\", settingsBean.getDbConfig());\n    }\n\n    @Test\n    public void testBooleanPropertyInjection()\n    {\n        SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);\n        assertEquals(Boolean.FALSE, settingsBean.getBooleanPropertyFalse());\n\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue1());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue2());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue3());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue4());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue5());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue6());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue7());\n        assertEquals(Boolean.TRUE, settingsBean.getBooleanPropertyTrue8());\n    }\n\n    @Test\n    public void testNumberConfigInjection()\n    {\n        NumberConfiguredBean numberBean = BeanProvider.getContextualReference(NumberConfiguredBean.class, false);\n        assertNull(numberBean.getPropertyNonexisting());\n        assertEquals(Float.valueOf(123.45f), numberBean.getPropertyFromConfig());\n        assertEquals(Float.valueOf(42.42f), numberBean.getPropertyNonexistingDefaulted());\n    }\n\n    @Test\n    public void testProjectStageAwareReplacement()\n    {\n        SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);\n        assertEquals(\"https://myapp/login.xhtml\", settingsBean.getProjectStageAwareVariableValue());\n    }\n\n    @Test\n    public void checkDynamicConvertedInjections() throws MalformedURLException\n    {\n        SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);\n        assertEquals(asList(new URL(\"http://localhost\"), new URL(\"http://127.0.0.1\")), settingsBean.getUrlList());\n        assertEquals(singletonList(new URL(\"http://127.0.0.2\")), settingsBean.getUrlListFromProperties());\n    }\n\n    @Test\n    public void checkCdiSourceFilter() throws MalformedURLException\n    {\n        SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);\n        assertEquals(\"value\", settingsBean.getCustomSourceValue());\n    }\n\n\n    @Test\n    public void proxy() throws MalformedURLException\n    {\n        ConfigBean settingsBean = BeanProvider.getContextualReference(ConfigBean.class);\n\n        assertEquals(14, settingsBean.intProperty1());\n        assertEquals(\"14\", settingsBean.stringProperty3Filled());\n        assertEquals(\"myDefaultValue\", settingsBean.stringProperty3Defaulted());\n        assertEquals(42, settingsBean.intProperty4Defaulted().intValue());\n\n        assertEquals(\"some setting for prodDB\", settingsBean.dbConfig());\n        assertEquals(Boolean.FALSE, settingsBean.booleanPropertyFalse());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue1());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue2());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue3());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue4());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue5());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue6());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue7());\n        assertEquals(Boolean.TRUE, settingsBean.booleanPropertyTrue8());\n        assertEquals(asList(new URL(\"http://localhost\"), new URL(\"http://127.0.0.1\")), settingsBean.urlList());\n        assertEquals(asList(\"http://localhost\", \"http://127.0.0.1\"), settingsBean.defaultListHandling());\n        assertEquals(new HashSet<Integer>(asList(1, 2)), settingsBean.defaultSetHandling());\n        assertEquals(singletonList(new URL(\"http://127.0.0.2\")), settingsBean.urlListFromProperties());\n        assertEquals(\"value\", settingsBean.customSourceValue());\n    }\n\n    @Test\n    public void proxyPrefix() throws MalformedURLException\n    {\n        PrefixedConfigBean settingsBean = BeanProvider.getContextualReference(PrefixedConfigBean.class);\n        assertEquals(\"done\", settingsBean.value());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/PrefixedConfigBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.Configuration;\n\n\n@Configuration(prefix = \"prefix.\")\npublic interface PrefixedConfigBean\n{\n    @ConfigProperty(name = \"suffix\")\n    String value();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/SettingsBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Supplier;\n\n@ApplicationScoped\npublic class SettingsBean\n{\n    final static String PROPERTY_NAME = \"configProperty2\";\n\n    @Inject\n    @ConfigProperty(name = \"configProperty1\")\n    private Integer intProperty1;\n\n    private Long property2;\n\n    @Inject\n    @ConfigProperty(name = \"configProperty1\", defaultValue = \"myDefaultValue\")\n    private String stringProperty3Filled;\n\n    @Inject\n    @ConfigProperty(name = \"nonexistingProperty\", defaultValue = \"myDefaultValue\")\n    private String stringProperty3Defaulted;\n\n    @Inject\n    @ConfigProperty(name = \"nonexistingProperty\", defaultValue = \"42\")\n    private Integer intProperty4Defaulted;\n\n    @Inject\n    @ConfigProperty(name = \"nonexistingProperty\", defaultValue = \"myDefaultValue\", cacheFor = 10, cacheUnit = TimeUnit.MINUTES)\n    private Supplier<String> supplierStringProperty3Defaulted;\n\n    @Inject\n    @ConfigProperty(name = \"nonexistingProperty\", defaultValue = \"42\")\n    private Supplier<Integer> supplierIntProperty4Defaulted;\n\n    private Long inverseProperty2;\n\n    @Inject\n    @ConfigProperty(name = \"configProperty1\")\n    private Boolean booleanPropertyNull;\n\n    @Inject\n    @ConfigProperty(name = \"configProperty1\", defaultValue = \"false\")\n    private Boolean booleanPropertyFalse;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue1\")\n    private Boolean booleanPropertyTrue1;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue2\")\n    private Boolean booleanPropertyTrue2;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue3\")\n    private Boolean booleanPropertyTrue3;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue4\")\n    private Boolean booleanPropertyTrue4;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue5\")\n    private Boolean booleanPropertyTrue5;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue6\")\n    private Boolean booleanPropertyTrue6;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue7\")\n    private Boolean booleanPropertyTrue7;\n\n    @Inject\n    @ConfigProperty(name = \"configPropertyTrue8\")\n    private Boolean booleanPropertyTrue8;\n\n    @Inject\n    @ConfigProperty(name = \"testDbConfig\")\n    private String dbConfig;\n\n    @Inject\n    @ConfigProperty(name = \"urlList\", converter = UrlList.class, defaultValue = \"http://localhost,http://127.0.0.1\")\n    private List<URL> urlList;\n\n    @Inject\n    @ConfigProperty(name = \"urlListFromProperties\", converter = UrlList.class)\n    private List<URL> urlListFromProperties;\n\n    @Inject\n    @ConfigProperty(name = \"custom-source.test\")\n    private String customSourceValue;\n\n    @Inject\n    @ConfigProperty(name = \"myapp.login.url\")\n    private String projectStageAwareVariableValue;\n\n    protected SettingsBean()\n    {\n    }\n\n    @Inject\n    public SettingsBean(@ConfigProperty(name= PROPERTY_NAME) Long property2)\n    {\n        this.property2 = property2;\n    }\n\n    @Inject\n    protected void init(@CustomConfigAnnotationWithMetaData(inverseConvert = true) Long inverseProperty)\n    {\n        inverseProperty2 = inverseProperty;\n    }\n\n    int getProperty1()\n    {\n        return intProperty1;\n    }\n\n    long getProperty2()\n    {\n        return property2;\n    }\n\n    long getInverseProperty2()\n    {\n        return inverseProperty2;\n    }\n\n    public String getProperty3Defaulted()\n    {\n        return stringProperty3Defaulted;\n    }\n\n    public String getProperty3Filled()\n    {\n        return stringProperty3Filled;\n    }\n\n    public int getProperty4Defaulted()\n    {\n        return intProperty4Defaulted;\n    }\n\n    public Supplier<String> getSupplierStringProperty3Defaulted()\n    {\n        return supplierStringProperty3Defaulted;\n    }\n\n    public Supplier<Integer> getSupplierIntProperty4Defaulted()\n    {\n        return supplierIntProperty4Defaulted;\n    }\n\n    public Boolean getBooleanPropertyNull()\n    {\n        return booleanPropertyNull;\n    }\n\n    public boolean getBooleanPropertyFalse()\n    {\n        return booleanPropertyFalse;\n    }\n\n    public Boolean getBooleanPropertyTrue1()\n    {\n        return booleanPropertyTrue1;\n    }\n\n    public Boolean getBooleanPropertyTrue2()\n    {\n        return booleanPropertyTrue2;\n    }\n\n    public Boolean getBooleanPropertyTrue3()\n    {\n        return booleanPropertyTrue3;\n    }\n\n    public Boolean getBooleanPropertyTrue4()\n    {\n        return booleanPropertyTrue4;\n    }\n\n    public Boolean getBooleanPropertyTrue5()\n    {\n        return booleanPropertyTrue5;\n    }\n\n    public Boolean getBooleanPropertyTrue6()\n    {\n        return booleanPropertyTrue6;\n    }\n\n    public Boolean getBooleanPropertyTrue7()\n    {\n        return booleanPropertyTrue7;\n    }\n\n    public Boolean getBooleanPropertyTrue8()\n    {\n        return booleanPropertyTrue8;\n    }\n\n    public String getDbConfig()\n    {\n        return dbConfig;\n    }\n\n    public List<URL> getUrlList() {\n        return urlList;\n    }\n\n    public List<URL> getUrlListFromProperties() {\n        return urlListFromProperties;\n    }\n\n    public String getCustomSourceValue() {\n        return customSourceValue;\n    }\n\n    public String getProjectStageAwareVariableValue()\n    {\n        return projectStageAwareVariableValue;\n    }\n\n    public static class UrlList implements ConfigResolver.Converter<List<URL>>\n    {\n        @Override\n        public List<URL> convert(final String value)\n        {\n            final List<URL> urls = new ArrayList<URL>();\n            if (value != null)\n            {\n                for (final String segment : value.split(\",\"))\n                {\n                    try\n                    {\n                        urls.add(new URL(segment));\n                    }\n                    catch (final MalformedURLException e)\n                    {\n                        throw new IllegalArgumentException(e);\n                    }\n                }\n            }\n            return urls;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/numberconfig/NumberConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable.numberconfig;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ PARAMETER, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n@Qualifier\npublic @interface NumberConfig\n{\n    @Nonbinding\n    String name();\n\n    @Nonbinding\n    String defaultValue() default ConfigProperty.NULL;\n\n    @Nonbinding\n    String pattern() default \"#0.00\";\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/numberconfig/NumberConfigPropertyProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable.numberconfig;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.text.DecimalFormat;\nimport java.text.DecimalFormatSymbols;\nimport java.text.ParseException;\nimport java.util.Locale;\n\nimport org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer;\n\n@ApplicationScoped\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class NumberConfigPropertyProducer extends BaseConfigPropertyProducer\n{\n    @Produces\n    @Dependent\n    @NumberConfig(name = \"unused\")\n    public Float produceNumberProperty(InjectionPoint injectionPoint) throws ParseException\n    {\n        // resolve the annotation\n        NumberConfig metaData = getAnnotation(injectionPoint, NumberConfig.class);\n\n        // get the configured value from the underlying configuration system\n        String configuredValue = getPropertyValue(metaData.name(), metaData.defaultValue());\n        if (configuredValue == null)\n        {\n            return null;\n        }\n\n        // format according to the given pattern\n        DecimalFormat df = new DecimalFormat(metaData.pattern(), new DecimalFormatSymbols(Locale.US));\n        return df.parse(configuredValue).floatValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/injectable/numberconfig/NumberConfiguredBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.injectable.numberconfig;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\n\n@ApplicationScoped\npublic class NumberConfiguredBean\n{\n    @Inject\n    @NumberConfig(name = \"propertyFloat\")\n    private Float propertyFromConfig;\n\n    @Inject\n    @NumberConfig(name = \"propertyNonexisting\")\n    private Float propertyNonexisting;\n\n    @Inject\n    @NumberConfig(name = \"propertyNonexisting\", defaultValue = \"42.42\")\n    private Float propertyNonexistingDefaulted;\n\n\n    protected NumberConfiguredBean()\n    {\n    }\n\n    public Float getPropertyFromConfig()\n    {\n        return propertyFromConfig;\n    }\n\n    public Float getPropertyNonexisting()\n    {\n        return propertyNonexisting;\n    }\n\n    public Float getPropertyNonexistingDefaulted()\n    {\n        return propertyNonexistingDefaulted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/BaseTestConfigProperty.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.util.Collections;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.impl.config.PropertyFileConfigSource;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class BaseTestConfigProperty\n{\n    protected final static String CONFIG_FILE_NAME = \"myconfig.properties\";\n    protected static final String CONFIG_VALUE = \"deltaspike.dynamic.reloadable.config.value\";\n\n\n    @Test\n    public void testDynamicReload() throws Exception\n    {\n        File prop = File.createTempFile(\"deltaspike-test\", \".properties\");\n        try (BufferedWriter bw = new BufferedWriter(new FileWriter(prop)))\n        {\n            bw.write(CONFIG_VALUE + \"=1\\ndeltaspike_reload=1\\n\");\n            bw.flush();\n        }\n        prop.deleteOnExit();\n\n        final PropertyFileConfigSource dynamicReloadConfigSource = new PropertyFileConfigSource(prop.toURI().toURL());\n        ConfigResolver.addConfigSources(Collections.singletonList(dynamicReloadConfigSource));\n\n        Assert.assertEquals(\"1\", ConfigResolver.getPropertyValue(CONFIG_VALUE));\n\n        // we need to take care of file system granularity\n        Thread.sleep(2100L);\n\n        try (BufferedWriter bw = new BufferedWriter(new FileWriter(prop)))\n        {\n            bw.write(CONFIG_VALUE + \"=2\\ndeltaspike_reload=1\\n\");\n            bw.flush();\n        }\n\n        Assert.assertEquals(\"2\", ConfigResolver.getPropertyValue(CONFIG_VALUE));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/ConfigPropertyWARTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ConfigPropertyWARTest extends BaseTestConfigProperty\n{\n    private final static String PROPERTIES =\n        \"org.apache.deltaspike.ProjectStage = UnitTest\\n\" +\n        ConfigResolver.DELTASPIKE_LOG_CONFIG + \" = true\";\n\n    @Deployment\n    public static WebArchive deployEar()\n    {\n        return ShrinkWrap.create(WebArchive.class, \"myPropertyTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addPackage(ConfigPropertyWARTest.class.getPackage())\n                .addAsResource(CONFIG_FILE_NAME)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsWebInfResource(new StringAsset(PROPERTIES),\n                        \"classes/META-INF/apache-deltaspike.properties\");\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/FileConfigSourceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n/**\n * Test for picking up a file system based config\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class FileConfigSourceTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"FileConfigSourceTest.jar\")\n            .addClasses(FileConfigSourceTest.class, FileSystemConfig.class)\n            .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"beanProvider.war\")\n            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n            .addAsLibraries(testJar)\n            .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    public void testConfig() {\n        String val = ConfigResolver.getPropertyValue(\"deltaspike.test.config.from.file\");\n        Assert.assertNotNull(val);\n        Assert.assertEquals(\"it works\", val);\n    }\n\n    public static class FileSystemConfig implements PropertyFileConfig\n    {\n        private final String configFileLocation;\n\n        /**\n         * This ct is actually only a hack to create a temporary file on the target system\n         * With exactly the content we will later look up.\n         */\n        public FileSystemConfig()\n        {\n            try\n            {\n                File tempFile = File.createTempFile(\"deltaspike\", \".properties\");\n                FileWriter fw = new FileWriter(tempFile);\n                fw.write(\"deltaspike.test.config.from.file=it works\");\n                fw.close();\n                configFileLocation = tempFile.toURI().toURL().toExternalForm();\n            }\n            catch (IOException e)\n            {\n                throw new RuntimeException(e);\n            }\n        }\n\n        @Override\n        public String getPropertyFileName()\n        {\n            return configFileLocation;\n        }\n\n        @Override\n        public boolean isOptional()\n        {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomBootTimePropertyFileConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Custom PropertyFileConfig which gets picked up via {@code java.util.ServiceLoader}\n * The values will already be available <em>before</em> the container gets booted!\n */\n@Exclude // this is important to let the ConfigurationExtension know that it should not handle it\npublic class MyCustomBootTimePropertyFileConfig implements PropertyFileConfig\n{\n    @Override\n    public String getPropertyFileName()\n    {\n        return \"myboottimeconfig.properties\";\n    }\n\n    @Override\n    public boolean isOptional()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomEarPropertyFileConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Custom PropertyFileConfig which gets picked up during\n * {@link jakarta.enterprise.inject.spi.ProcessAnnotatedType}.\n * We need to do this hack to avoid\n */\n@Exclude\npublic class MyCustomEarPropertyFileConfig implements PropertyFileConfig\n{\n    @Override\n    public String getPropertyFileName()\n    {\n        return \"myconfig.properties\";\n    }\n\n    @Override\n    public boolean isOptional()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomPropertyFileConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\n\n/**\n * Custom PropertyFileConfig which gets picked up during\n * {@link jakarta.enterprise.inject.spi.ProcessAnnotatedType}.\n * The values will be available <em>after</em> the container got booted!\n */\npublic class MyCustomPropertyFileConfig implements PropertyFileConfig\n{\n    @Override\n    public String getPropertyFileName()\n    {\n        return \"myconfig.properties\";\n    }\n\n    @Override\n    public boolean isOptional()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyNotPickedUpPropertyFileConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Custom PropertyFileConfig which gets picked up via {@code java.util.ServiceLoader}\n * The values will already be available <em>before</em> the container gets booted!\n */\n@Exclude // this is important to let the ConfigurationExtension know that it should not handle it\npublic class MyNotPickedUpPropertyFileConfig implements PropertyFileConfig\n{\n    @Override\n    public String getPropertyFileName()\n    {\n        return \"mynotpickedupconfig.properties\";\n    }\n\n    @Override\n    public boolean isOptional()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/PropertyConfigSourceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.config.propertyconfigsource;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class) //X TODO this is only SeCategory as there is currently an Arq problem with properties!\npublic class PropertyConfigSourceTest\n{\n    private final static String CONFIG_FILE_NAME = \"myconfig.properties\";\n    private final static String BOOTCONFIG_FILE_NAME = \"myboottimeconfig.properties\";\n    private final static String NOT_PICKED_UP_CONFIG_FILE_NAME = \"mynotpickedupconfig.properties\";\n\n    /**\n     *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment(name = \"tomee\")\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"PropertyConfigSourceTest.jar\")\n                .addPackage(PropertyConfigSourceTest.class.getPackage())\n                .addAsResource(CONFIG_FILE_NAME)\n                .addAsResource(BOOTCONFIG_FILE_NAME)\n                .addAsResource(NOT_PICKED_UP_CONFIG_FILE_NAME)\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"beanProvider.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    public void testCustomPropertyConfigSources() throws Exception\n    {\n        Assert.assertTrue(\n                Thread.currentThread().getContextClassLoader().getResources(CONFIG_FILE_NAME).hasMoreElements());\n\n        String value = ConfigResolver.getPropertyValue(\"some.propertykey\");\n        Assert.assertNotNull(value);\n        Assert.assertEquals(\"somevalue\", value);\n\n        String bootTimeValue = ConfigResolver.getPropertyValue(\"some.boottimekey\");\n        Assert.assertNotNull(bootTimeValue);\n        Assert.assertEquals(\"correctvalue\", bootTimeValue);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/AlwaysActiveBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n * Class which is always active\n */\n@Dependent\npublic class AlwaysActiveBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/CustomExpressionBasedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Bean won't be excluded\n */\n@Exclude(onExpression = \"a eq b\", interpretedBy = SimpleTestExpressionInterpreter.class)\npublic class CustomExpressionBasedBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/CustomExpressionBasedNoBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Bean wil be excluded\n */\n@Exclude(onExpression = \"true eq true\", interpretedBy = SimpleTestExpressionInterpreter.class)\npublic class CustomExpressionBasedNoBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/DevBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\n/**\n * Class which gets only included in case of project-stage development\n */\n@Exclude(exceptIfProjectStage = ProjectStage.Development.class)\npublic class DevBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/DevDbBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Class which gets excluded if the configured value for 'db' is 'prodDB'\n */\n@Exclude(onExpression = \"db==prodDB\")\npublic class DevDbBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude}\n */\npublic abstract class ExcludeTest\n{\n    /**\n     * check if this package is included at all\n     */\n    @Test\n    public void simpleCheckOfBeansInPackage()\n    {\n        AlwaysActiveBean testBean = BeanProvider.getContextualReference(AlwaysActiveBean.class, true);\n\n        Assert.assertNotNull(testBean);\n    }\n\n    /**\n     * bean is excluded in any case\n     */\n    @Test\n    public void excludeWithoutCondition()\n    {\n        NoBean noBean = BeanProvider.getContextualReference(NoBean.class, true);\n\n        Assert.assertNull(noBean);\n    }\n\n    /**\n     * bean included in case of project-stage development\n     */\n    @Test\n    public void includeInCaseOfProjectStageProduction()\n    {\n        StdBean stdBean = BeanProvider.getContextualReference(StdBean.class, true);\n\n        Assert.assertNotNull(stdBean);\n    }\n\n    /**\n     * bean excluded in case of project-stage development\n     */\n    @Test\n    public void excludedInCaseOfProjectStageProduction()\n    {\n        DevBean devBean = BeanProvider.getContextualReference(DevBean.class, true);\n\n        Assert.assertNull(devBean);\n    }\n\n    /**\n     * beans de-/activated via expressions\n     */\n    @Test\n    public void excludedIfExpressionMatch()\n    {\n        ProdDbBean prodDbBean = BeanProvider.getContextualReference(ProdDbBean.class, true);\n\n        Assert.assertNotNull(prodDbBean);\n\n        DevDbBean devDbBean = BeanProvider.getContextualReference(DevDbBean.class, true);\n\n        Assert.assertNull(devDbBean);\n    }\n\n    /**\n     * bean excluded based on a custom expression syntax\n     */\n    @Test\n    public void excludedBasedOnCustomExpressionSyntax()\n    {\n        CustomExpressionBasedNoBean noBean =\n                BeanProvider.getContextualReference(CustomExpressionBasedNoBean.class, true);\n\n        Assert.assertNull(noBean);\n    }\n\n    /**\n     * bean included based on a custom expression syntax\n     */\n    @Test\n    public void includedBasedOnCustomExpressionSyntax()\n    {\n        CustomExpressionBasedBean bean =\n                BeanProvider.getContextualReference(CustomExpressionBasedBean.class, true);\n\n        Assert.assertNotNull(bean);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude}\n */\npublic abstract class ExcludeTestProjectStageDevelopment\n{\n    /**\n     * bean included in case of project-stage development\n     */\n    @Test\n    public void includeInCaseOfProjectStageDevelopment()\n    {\n        DevBean devBean = BeanProvider.getContextualReference(DevBean.class, true);\n\n        Assert.assertNotNull(devBean);\n    }\n\n    /**\n     * bean excluded in case of project-stage development\n     */\n    @Test\n    public void excludedInCaseOfProjectStageDevelopment()\n    {\n        StdBean stdBean = BeanProvider.getContextualReference(StdBean.class, true);\n\n        Assert.assertNull(stdBean);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageEarFileDevelopment.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude}\n */\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class ExcludeTestProjectStageEarFileDevelopment extends ExcludeTestProjectStageDevelopment\n{\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = ExcludeTestProjectStageWarFileDevelopment.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(ExcludeTestProjectStageWarFileDevelopment.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageWarFileDevelopment.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.AfterClass;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude}\n */\n@RunWith(Arquillian.class)\npublic class ExcludeTestProjectStageWarFileDevelopment extends ExcludeTestProjectStageDevelopment\n{\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ExcludeTestProjectStageWarFileDevelopment.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        // in case the Arquillian adapter doesn't properly handle resources on the classpath\n        ProjectStageProducer.setProjectStage(ProjectStage.Development);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"excludeTestProjectStageDevelopmentTest.jar\")\n                .addPackage(ExcludeTestProjectStageWarFileDevelopment.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsResource(new StringAsset(\"org.apache.deltaspike.ProjectStage = Development\"),\n                    \"apache-deltaspike.properties\"); // when deployed on some remote container\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @AfterClass\n    public static void resetProjectStage() {\n        ProjectStageProducer.setProjectStage(null);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.test.core.impl.activation.TestClassDeactivator;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.apache.deltaspike.test.util.FileUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.AfterClass;\nimport org.junit.runner.RunWith;\n\nimport java.io.IOException;\nimport java.net.URL;\nimport java.nio.charset.StandardCharsets;\nimport java.nio.file.Files;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude}\n */\n@RunWith(Arquillian.class)\npublic class ExcludeWarFileTest extends ExcludeTest\n{\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy() throws IOException\n    {\n        String simpleName = ExcludeWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        // in case the Arquillian adapter doesn't properly handle resources on the classpath\n        ProjectStageProducer.setProjectStage(ProjectStage.Production);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"excludeTest.jar\")\n                .addPackage(ExcludeWarFileTest.class.getPackage())\n                .addPackage(TestClassDeactivator.class.getPackage())\n                .addAsManifestResource(new StringAsset(getConfigContent()),\n                    \"apache-deltaspike.properties\") // when deployed on some remote container;\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class, ExcludeExtension.class);\n    }\n\n    public static String getConfigContent() throws IOException\n    {\n        URL deltaspikeProps = ExcludeWarFileTest.class.getClassLoader().getResource(\"META-INF/apache-deltaspike.properties\");\n        if (deltaspikeProps != null) {\n\t\t\tbyte[] configContent = Files.readAllBytes(FileUtils.getFileForURL(deltaspikeProps.toString()).toPath());\n\t        return (new String(configContent, StandardCharsets.UTF_8) +\n\t            \"\\norg.apache.deltaspike.ProjectStage = Production\")\n\t                .replace(\"deltaspike.interdyn.enabled=true\", \"deltaspike.interdyn.enabled=false\");\n        } else {\n\t        return (\"\\norg.apache.deltaspike.ProjectStage = Production\"+\n\t\t                \"\\ndeltaspike.interdyn.enabled=false\");\n        }\n    }\n\n    @AfterClass\n    public static void resetProjectStage() {\n        ProjectStageProducer.setProjectStage(null);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/NoBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Class which gets excluded in any case\n */\n@Exclude\npublic class NoBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ProdDbBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * Class which gets excluded if there is a configured value for the key called 'db' and\n * the value is not 'prodDB'\n */\n@Exclude(onExpression = \"db!=prodDB;db==*\")\npublic class ProdDbBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/SimpleTestExpressionInterpreter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.interpreter.ExpressionInterpreter;\n\n/**\n * Very simple interpreter for the custom test expressions\n */\npublic class SimpleTestExpressionInterpreter implements ExpressionInterpreter<String, Boolean>\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Boolean evaluate(String expression)\n    {\n        if(expression.contains(\" eq \"))\n        {\n            String[] parts = expression.split(\" eq \");\n\n            if(parts.length == 2 && parts[0].equals(parts[1]))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/StdBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\n/**\n * Class which gets excluded in case of project-stage development\n */\n@Exclude(ifProjectStage = {ProjectStage.Development.class, ProjectStage.IntegrationTest.class})\npublic class StdBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/BaseEntity1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\npublic abstract class BaseEntity1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/BaseEntity2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n@Exclude\npublic abstract class BaseEntity2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/BaseEntity3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n@Exclude\npublic class BaseEntity3\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/Entity1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\npublic class Entity1 extends BaseEntity1\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/Entity2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\npublic class Entity2 extends BaseEntity2\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/Entity3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\npublic class Entity3 extends BaseEntity3\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/uc001/EntityExcludeTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.exclude.uc001;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class EntityExcludeTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = EntityExcludeTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        // in case the Arquillian adapter doesn't properly handle resources on the classpath\n        ProjectStageProducer.setProjectStage(ProjectStage.Development);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(EntityExcludeTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsResource(new StringAsset(\"org.apache.deltaspike.ProjectStage = Development\"),\n                    \"apache-deltaspike.properties\"); // when deployed on some remote container;\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @AfterClass\n    public static void resetProjectStage() {\n        ProjectStageProducer.setProjectStage(null);\n    }\n\n    @Test\n    public void entityWithoutExclusion()\n    {\n        Entity1 entity1 = BeanProvider.getContextualReference(Entity1.class, true);\n        Assert.assertNotNull(entity1);\n    }\n\n    @Test\n    public void excludedEntity()\n    {\n        Entity2 entity2 = BeanProvider.getContextualReference(Entity2.class, true);\n        Assert.assertNull(entity2);\n    }\n\n    //TODO discuss it - if we don't need it, we can use @Inherited\n    @Test\n    public void excludedBaseClassWithoutInheritance()\n    {\n        BaseEntity3 baseEntity3 = BeanProvider.getContextualReference(BaseEntity3.class, true);\n        Assert.assertTrue(baseEntity3 instanceof Entity3);\n\n        Entity3 entity3 = BeanProvider.getContextualReference(Entity3.class, true);\n        Assert.assertNotNull(entity3);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/interpreter/PropertyExpressionInterpreterTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.interpreter;\n\nimport org.apache.deltaspike.core.api.interpreter.ExpressionInterpreter;\nimport org.apache.deltaspike.core.impl.interpreter.PropertyExpressionInterpreter;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.impl.interpreter.PropertyExpressionInterpreter}\n */\npublic class PropertyExpressionInterpreterTest\n{\n    @Test\n    public void testSimplePropertyExpressions()\n    {\n        ExpressionInterpreter<String, Boolean> interpreter = new PropertyExpressionInterpreter(){};\n\n        System.setProperty(\"k.1\", \"v1\");\n        Assert.assertEquals(interpreter.evaluate(\"k.1==v1\"), Boolean.TRUE);\n        Assert.assertEquals(interpreter.evaluate(\"k.1==v2\"), Boolean.FALSE);\n\n        Assert.assertEquals(interpreter.evaluate(\"k.1!=v1\"), Boolean.FALSE);\n        Assert.assertEquals(interpreter.evaluate(\"k.1!=v2\"), Boolean.TRUE);\n\n        try\n        {\n            Assert.assertEquals(interpreter.evaluate(\"k.1=v1\"), Boolean.TRUE);\n        }\n        catch (IllegalStateException e)\n        {\n            return;\n        }\n\n        Assert.fail();\n    }\n\n    @Test\n    public void testSimpleAndRequiredPropertyExpressions()\n    {\n        ExpressionInterpreter<String, Boolean> interpreter = new PropertyExpressionInterpreter(){};\n\n        System.setProperty(\"k.1\", \"v1\");\n        Assert.assertEquals(interpreter.evaluate(\"k.1==v1;k.1==*\"), Boolean.TRUE);\n        Assert.assertEquals(interpreter.evaluate(\"ik.1==*\"), Boolean.FALSE);\n\n        Assert.assertEquals(interpreter.evaluate(\"k.1!=v2;k.1==*\"), Boolean.TRUE);\n        Assert.assertEquals(interpreter.evaluate(\"ik.1!=v2;ik.1==*\"), Boolean.FALSE);\n    }\n\n    @Test\n    public void testMultiplePropertyExpressions()\n    {\n        ExpressionInterpreter<String, Boolean> interpreter = new PropertyExpressionInterpreter(){};\n\n        System.setProperty(\"k.1\", \"v1\");\n        System.setProperty(\"k.2\", \"v2\");\n        Assert.assertEquals(interpreter.evaluate(\"k.1==v1;k.2==v2\"), Boolean.TRUE);\n        Assert.assertEquals(interpreter.evaluate(\"k.1==v1;k.2==v1\"), Boolean.FALSE);\n        Assert.assertEquals(interpreter.evaluate(\"k.1==v2;k.2==v2\"), Boolean.FALSE);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/CustomMinimalMessages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\n\n@MessageBundle\n@MessageContextConfig(\n    localeResolver = FixedEnglishLocalResolver.class,\n    messageSource = \"customMinimalMessage\")\npublic interface CustomMinimalMessages\n{\n    String sayHello(String name);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/ElPickedUpMessages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport jakarta.inject.Named;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\n\n@Named\n@MessageBundle\n@MessageContextConfig(\n    localeResolver = FixedEnglishLocalResolver.class,\n    messageSource = \"customMinimalMessage\")\npublic interface ElPickedUpMessages\n{\n    String sayHello(String name);\n    String text();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/FixedEnglishLocalResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.Locale;\n\n@ApplicationScoped\n@TestConfiguration\npublic class FixedEnglishLocalResolver implements LocaleResolver\n{\n    private static final long serialVersionUID = 6947516315363672494L;\n\n    @Override\n    public Locale getLocale()\n    {\n        return Locale.ENGLISH;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/FixedGermanLocaleResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.util.Locale;\n\n@Vetoed\nclass FixedGermanLocaleResolver implements LocaleResolver\n{\n    private static final long serialVersionUID = 1927000487639667775L;\n\n    @Override\n    public Locale getLocale()\n    {\n        return Locale.GERMAN;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/Jay.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport jakarta.inject.Inject;\n\npublic class Jay\n{\n    @Inject\n    private TestMessages messages;\n\n    String getMessage()\n    {\n        return messages.numberOfJaysSpotted(8);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MessageContextTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport java.io.Serializable;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.utils.Serializer;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Assume;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n/**\n * Tests for {@link MessageContext}\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class MessageContextTest\n{\n\n    @Inject\n    private SimpleMessage  simpleMessage;\n\n    @Inject\n    private MessageContext messageContext;\n\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        final JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"messageContextTest.jar\")\n                .addPackage(MessageContextTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"messageContextTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class,\n                        MessageBundleExtension.class);\n    }\n\n    @Test\n    public void testSimpleMessage()\n    {\n        Assert.assertEquals(\"Welcome to DeltaSpike\",\n                this.simpleMessage.welcomeTo(this.messageContext, \"DeltaSpike\").toString());\n    }\n\n    /**\n     * We test that a non-existing category will fallback on the default message\n     */\n    @Test\n    public void testSimpleMessageCategory()\n    {\n        Assert.assertEquals(\"Welcome to DeltaSpike\",\n                this.simpleMessage.welcomeTo(this.messageContext, \"DeltaSpike\").toString(\"notexisting\"));\n    }\n\n    @Test\n    public void resolveTextTest()\n    {\n        final LocaleResolver localeResolver = new FixedEnglishLocalResolver();\n\n        final String messageText = this.messageContext\n                .localeResolver(localeResolver)\n                .messageResolver(new TestMessageResolver())\n                .message().template(\"{hello}\").argument(\"hans\").toString();\n\n        Assert.assertEquals(\"test message to hans\", messageText);\n    }\n\n    @Test\n    public void ignoreNullArguments()\n    {\n        final LocaleResolver localeResolver = new FixedEnglishLocalResolver();\n\n        final String messageText = this.messageContext\n                .localeResolver(localeResolver)\n                .messageResolver(new TestMessageResolver())\n                .message().template(\"{hello}\").argument((Serializable[])null).toString();\n\n        Assert.assertEquals(\"test message to %s\", messageText);\n    }\n\n    @Test\n    public void resolveGermanMessageTextTest()\n    {\n        final LocaleResolver localeResolver = new FixedGermanLocaleResolver();\n        final String messageText = this.messageContext\n                .localeResolver(localeResolver)\n                .messageResolver(new TestMessageResolver())\n                .message().template(\"{hello}\").argument(\"hans\").toString();\n\n        Assert.assertEquals(\"Test Nachricht an hans\", messageText);\n    }\n\n    @Test\n    public void testArbitraryMessageContextRendering()\n    {\n        final LocaleResolver localeResolver = new FixedGermanLocaleResolver();\n        final Message message = this.messageContext\n                .localeResolver(localeResolver)\n                .messageResolver(new TestMessageResolver())\n                .message().template(\"{hello}\").argument(\"hans\");\n        Assert.assertEquals(\"Test Nachricht an hans\", message.toString());\n\n        final MessageContext messageContext2 = this.messageContext.clone().localeResolver(\n                new FixedEnglishLocalResolver());\n        Assert.assertEquals(\"test message to hans\", message.toString(messageContext2));\n    }\n\n    @Test\n    public void createInvalidMessageTest()\n    {\n        String messageText = this.messageContext.message().template(\"{xyz123}\").toString();\n        Assert.assertEquals(\"???xyz123???\", messageText);\n\n        messageText = this.messageContext\n                .messageSource(\"nonexistingbundle.properties\")\n                .message()\n                .template(\"{xyz123}\")\n                .toString();\n        Assert.assertEquals(\"???xyz123???\", messageText);\n    }\n\n    @Test\n    public void createInvalidMessageWithArgumentsTest()\n    {\n        final String messageText = this.messageContext.message().template(\"{xyz123}\").\n                argument(\"123\").argument(\"456\").argument(\"789\").toString();\n\n        Assert.assertEquals(\"???xyz123??? [123, 456, 789]\", messageText);\n    }\n\n    @Test\n    public void testMessageEquals()\n    {\n        final Message m1 = this.messageContext.message();\n        final Message m2 = this.messageContext.message();\n        final Message m3 = this.messageContext.messageResolver(new TestMessageResolver()).message();\n\n        Assert.assertEquals(m1, m1);\n        Assert.assertEquals(m1, m2);\n        Assert.assertEquals(m1, m3);\n        Assert.assertEquals(m3, m1);\n        Assert.assertEquals(m2, m3);\n\n        m1.template(\"dumdidum\").argument(\"nonono\");\n        m2.template(\"dumdidum\").argument(\"nonono\");\n        Assert.assertEquals(m1, m2);\n\n        Assert.assertEquals(m1.hashCode(), m2.hashCode());\n\n        m2.argument(\"toomuch\");\n        Assert.assertFalse(m1.equals(m2));\n        Assert.assertFalse(m2.equals(m1));\n    }\n\n    /**\n     * Added check for System Property org.apache.deltaspike.weld.pre_1.1.10=true\n     * If this exists then we will skip this test as it fails on WELD version < 1.1.10.Final\n     * See DELTASPIKE-260\n     */\n    @Test\n    public void testSerialization()\n    {\n        Assume.assumeTrue(System.getProperty(\"org.apache.deltaspike.weld.pre_1.1.10\") == null);\n        final Serializer<Message> messageSerializer = new Serializer<Message>();\n\n        final LocaleResolver localeResolver = new FixedGermanLocaleResolver();\n        final Message message = this.messageContext\n                .localeResolver(localeResolver)\n                .messageResolver(new TestMessageResolver())\n                .message().template(\"{hello}\").argument(\"hans\");\n        Assert.assertEquals(\"Test Nachricht an hans\", message.toString());\n\n        final Message messageClone = messageSerializer.roundTrip(message);\n\n        Assert.assertEquals(message, messageClone);\n        Assert.assertEquals(\"Test Nachricht an hans\", messageClone.toString());\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MessageFormattedMessage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport java.util.Date;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\n\n/**\n * This is a test {@link MessageBundle} which uses the\n * Alternative {@link org.apache.deltaspike.core.impl.message.MessageFormatMessageInterpolator}\n * for formatting\n */\n@MessageBundle\npublic interface MessageFormattedMessage\n{\n\n    String welcomeTo(String name);\n\n    String incomeSinceDays(int days, float income);\n\n    String commitsInProject(Date date, String projectName, int commits);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MessageFormattedMessageTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\nimport org.apache.deltaspike.core.impl.message.MessageFormatMessageInterpolator;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\n\n/**\n * Test for {@link MessageFormatMessageInterpolator}\n * formatted messages.\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class MessageFormattedMessageTest\n{\n    @Inject\n    private MessageFormattedMessage message;\n\n\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        Asset beansXml = new StringAsset(\n                \"<beans><alternatives>\" +\n                        \"<class>\" + MessageFormatMessageInterpolator.class.getName() + \"</class>\" +\n                        \"</alternatives></beans>\"\n        );\n        JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"messageFormattedMessageTest.jar\")\n                .addPackage(MessageFormattedMessageTest.class.getPackage())\n                .addAsManifestResource(beansXml, \"beans.xml\");\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"messageFormattedMessageTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class,\n                        MessageBundleExtension.class);\n    }\n\n    @Test\n    public void testSimpleMessage()\n    {\n        assertEquals(\"Welcome to DeltaSpike\", message.welcomeTo(\"DeltaSpike\"));\n        assertEquals(\"The income since 42 days is 12.34\", message.incomeSinceDays(42, 12.34f));\n    }\n\n    @Test\n    public void testNullMessage()\n    {\n        assertEquals(\"Welcome to null\", message.welcomeTo(null));\n    }\n\n    @Test\n    public void testComplexMessageWithNull()\n    {\n        assertEquals(\"At null on null, project deltaspike had 10 commits.\", message.commitsInProject(null, \"deltaspike\", 10));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MessageTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.message;\r\n\r\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\r\nimport org.apache.deltaspike.test.category.SeCategory;\r\nimport org.apache.deltaspike.test.util.ArchiveUtils;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\nimport org.junit.runner.RunWith;\r\n\r\nimport jakarta.enterprise.inject.spi.Extension;\r\nimport jakarta.inject.Inject;\r\n\r\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\r\nimport static org.junit.Assert.assertEquals;\r\nimport static org.junit.Assert.assertNotNull;\r\n\r\n/**\r\n * Tests for {@link org.apache.deltaspike.core.api.message.MessageTemplate}\r\n */\r\n@RunWith(Arquillian.class)\r\n@Category(SeCategory.class)\r\npublic class MessageTest\r\n{\r\n    @Inject\r\n    private TestMessages messages;\r\n\r\n    /**\r\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\r\n     * cannot contain other archives.\r\n     */\r\n    @Deployment\r\n    public static WebArchive deploy()\r\n    {\r\n        JavaArchive testJar = ShrinkWrap\r\n                .create(JavaArchive.class, \"messageTest.jar\")\r\n                .addPackage(MessageTest.class.getPackage())\r\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\r\n\r\n        return ShrinkWrap\r\n                .create(WebArchive.class, \"messageTest.war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\r\n                .addAsServiceProvider(Extension.class,\r\n                        MessageBundleExtension.class);\r\n    }\r\n\r\n    @Test\r\n    public void testMessageBundleInjection(Jay jay)\r\n    {\r\n        assertEquals(TestMessageInterpolator.SPECIALFORMATTED + \"Spotted 8 jays\", jay.getMessage());\r\n    }\r\n\r\n    @Test\r\n    public void testInternationalizedMessage()\r\n    {\r\n        assertEquals(TestMessageInterpolator.SPECIALFORMATTED + \"Welcome to DeltaSpike\", messages.welcomeToDeltaSpike());\r\n    }\r\n\r\n    @Test\r\n    public void testInternationalizedParametrizedMessage()\r\n    {\r\n        assertEquals(TestMessageInterpolator.SPECIALFORMATTED + \"Welcome to Apache DeltaSpike\", messages.welcomeTo(\"Apache DeltaSpike\"));\r\n    }\r\n\r\n    @Test\r\n    public void testMessageCategory()\r\n    {\r\n        assertEquals(TestMessageInterpolator.SPECIALFORMATTED + \"Value good was set\"\r\n            , messages.messageWithCategory(\"good\").toString());\r\n\r\n        assertEquals(TestMessageInterpolator.SPECIALFORMATTED + \"The value of the property has been set to good.\"\r\n            , messages.messageWithCategory(\"good\").toString(\"longText\"));\r\n\r\n        assertEquals(TestMessageInterpolator.SPECIALFORMATTED + \"Value good was set\"\r\n                , messages.messageWithCategory(\"good\").toString(\"notExistingCategory\"));\r\n    }\r\n\r\n\r\n    @Test\r\n    public void testObjectMethods()\r\n    {\r\n        messages.hashCode();\r\n        assertNotNull(messages.toString());\r\n        assertNotNull(messages.getClass());\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MessageUser.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\nimport java.io.Serializable;\n\n/**\n * A SessionScoped (passivating!) user which uses a DeltaSpike message\n */\n@SessionScoped\npublic class MessageUser implements Serializable\n{\n    @Inject\n    private SimpleMessage msg;\n\n    public SimpleMessage getMsg() {\n        return msg;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MinimalMessages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\n\n@MessageBundle\n@MessageContextConfig(localeResolver = FixedEnglishLocalResolver.class)\npublic interface MinimalMessages\n{\n    String sayHello(String name);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/MinimalMessagesTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Filters;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n/**\n * Tests for type-safe messages without {@link org.apache.deltaspike.core.api.message.MessageTemplate}\n */\n@RunWith(Arquillian.class)\npublic class MinimalMessagesTest\n{\n    @Inject\n    private MinimalMessages minimalMessages;\n\n    @Inject\n    private CustomMinimalMessages customMinimalMessages;\n\n    @Inject\n    private ElPickedUpMessages injectedElPickedUpMessages;\n\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"minimalMessageTest.jar\")\n                .addPackages(false, Filters.exclude(MessageContextTest.class),\n                        MinimalMessagesTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"minimalMessageTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsResource(\"customMinimalMessage_en.properties\")\n                .addAsResource(\"org/apache/deltaspike/test/core/api/message/MinimalMessages_en.properties\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class,\n                        MessageBundleExtension.class);\n    }\n\n    @Test\n    public void testMinimalMessage()\n    {\n        Assert.assertEquals(\"Hello DeltaSpike\", minimalMessages.sayHello(\"DeltaSpike\"));\n    }\n\n    @Test\n    public void testCustomMinimalMessage()\n    {\n        Assert.assertEquals(\"Hello DeltaSpike\", customMinimalMessages.sayHello(\"DeltaSpike\"));\n    }\n\n    @Test\n    public void testExpressionLanguageIntegration()\n    {\n        ElPickedUpMessages elMessage =\n                (ElPickedUpMessages) BeanProvider.getContextualReference(\"elPickedUpMessages\");\n        Assert.assertNotNull(elMessage);\n        Assert.assertEquals(\"Hello DeltaSpike\", elMessage.sayHello(\"DeltaSpike\"));\n        Assert.assertEquals(\"Hello null\", elMessage.sayHello(null));\n        Assert.assertEquals(\"Text\", elMessage.text());\n    }\n\n    @Test\n    public void testExpressionLanguageIntegrationWithCustomName()\n    {\n        TypedMessageWithCustomName elMessage =\n                (TypedMessageWithCustomName) BeanProvider.getContextualReference(\"namedTypedMessages\");\n        Assert.assertNotNull(elMessage);\n        Assert.assertEquals(\"Hello DeltaSpike\", elMessage.sayHello(\"DeltaSpike\"));\n        Assert.assertEquals(\"Hello null\", elMessage.sayHello(null));\n        Assert.assertEquals(\"Text\", elMessage.text());\n    }\n\n    @Test\n    public void testInjectionOfNamedMessageBundle()\n    {\n\n        ElPickedUpMessages injectedElMessage = this.injectedElPickedUpMessages;\n        Assert.assertNotNull(injectedElMessage);\n        Assert.assertEquals(\"Hello DeltaSpike\", injectedElMessage.sayHello(\"DeltaSpike\"));\n        Assert.assertEquals(\"Hello null\", injectedElMessage.sayHello(null));\n        Assert.assertEquals(\"Text\", injectedElMessage.text());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/SimpleMessage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\n\n@MessageBundle\npublic interface SimpleMessage\n{\n    @MessageTemplate(\"Welcome to DeltaSpike\")\n    String welcomeToDeltaSpike();\n\n    @MessageTemplate(\"Welcome to %s\")\n    Message welcomeTo(MessageContext messageContext, String name);\n\n    @MessageTemplate(\"Welcome to %s\")\n    String welcomeWithStringVariable(String name);\n\n    @MessageTemplate(\"Welcome to %f\")\n    String welcomeWithFloatVariable(Float value);\n\n    @MessageTemplate(\"Counter: %04d\")\n    String counter(Integer value);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/SimpleMessageTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.utils.Serializer;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.message.MessageTemplate}\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class SimpleMessageTest\n{\n    @Inject\n    private SimpleMessage simpleMessage;\n\n    @Inject\n    private LocaleResolver localeResolver;\n\n    @Inject\n    private MessageUser messageUser;\n\n\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"simpleMessageTest.jar\")\n                .addPackage(SimpleMessageTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"simpleMessageTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class,\n                        MessageBundleExtension.class);\n    }\n\n    @Test\n    public void testSimpleMessage()\n    {\n        assertEquals(\"Welcome to DeltaSpike\", simpleMessage.welcomeToDeltaSpike());\n        assertEquals(\"Welcome to DeltaSpike\", simpleMessage.welcomeWithStringVariable(\"DeltaSpike\"));\n    }\n\n    /**\n     * This test checks if the {@link org.apache.deltaspike.core.api.message.LocaleResolver}\n     * gets properly invoked.\n     */\n    @Test\n    public void testDefaultLocaleInMessage()\n    {\n        float f = 123.45f;\n\n        String expectedResult = \"Welcome to \" + String.format(this.localeResolver.getLocale(), \"%f\", f);\n        String result = simpleMessage.welcomeWithFloatVariable(f);\n        assertEquals(expectedResult, result);\n    }\n\n    @Test\n    public void testNullMessage()\n    {\n        String expectedResult = \"Welcome to null\";\n        String result = simpleMessage.welcomeWithStringVariable(null);\n        assertEquals(expectedResult, result);\n    }\n\n    @Test\n    public void testPaddingWithNullMessage()\n    {\n        String expectedResult = \"Counter: null\";\n        String result = simpleMessage.counter(null);\n        assertEquals(expectedResult, result);\n    }\n\n    @Test\n    public void testMessageSerialisation()\n    {\n        Serializer<SimpleMessage> simpleMessageSerializer = new Serializer<SimpleMessage>();\n\n        SimpleMessage sm2 = simpleMessageSerializer.roundTrip(simpleMessage);\n        assertNotNull(sm2);\n    }\n\n    @Test\n    public void testPassivationCapability()\n    {\n        assertEquals(\"Welcome to DeltaSpike\", messageUser.getMsg().welcomeToDeltaSpike());\n        assertEquals(\"Welcome to DeltaSpike\", messageUser.getMsg().welcomeWithStringVariable(\"DeltaSpike\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/TestConfiguration.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * <p>Qualifier for marking beans which provide other configuration.</p>\n */\n@Target({ TYPE, PARAMETER, FIELD, METHOD, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n@Qualifier\npublic @interface TestConfiguration\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/TestLocalResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.impl.message.DefaultLocaleResolver;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Specializes;\nimport java.util.Locale;\n\n@ApplicationScoped\n@Specializes\npublic class TestLocalResolver extends DefaultLocaleResolver\n{\n    private static final long serialVersionUID = 4947516315363672494L;\n\n    @Override\n    public Locale getLocale()\n    {\n        return Locale.ENGLISH;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/TestMessageInterpolator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.io.Serializable;\nimport java.util.Locale;\n\n@ApplicationScoped\n@TestConfiguration\npublic class TestMessageInterpolator implements MessageInterpolator\n{\n    private static final long serialVersionUID = 5636914399691923602L;\n    public static final String SPECIALFORMATTED = \"specialformatted \";\n\n    @Override\n    public String interpolate(String messageTemplate, Serializable[] arguments, Locale locale)\n    {\n        return SPECIALFORMATTED + String.format(locale, messageTemplate, arguments);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/TestMessageResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageResolver;\nimport org.apache.deltaspike.core.util.PropertyFileUtils;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.util.MissingResourceException;\nimport java.util.ResourceBundle;\n\n@Vetoed\npublic class TestMessageResolver implements MessageResolver\n{\n    private static final long serialVersionUID = -7977480064291950923L;\n\n    protected TestMessageResolver()\n    {\n    }\n\n    @Override\n    public String getMessage(MessageContext messageContext, String messageTemplate, String category)\n    {\n        if ( messageTemplate.startsWith(\"{\") && messageTemplate.endsWith(\"}\"))\n        {\n            String resourceKey = messageTemplate.substring(1, messageTemplate.length() - 1);\n            try\n            {\n                ResourceBundle messageBundle = PropertyFileUtils\n                        .getResourceBundle(TestMessages.class.getName(), messageContext.getLocale());\n                String value = null;\n                if (category != null && category.length() > 0)\n                {\n                    value = messageBundle.getString(resourceKey + \".\" + category);\n                }\n                if (value == null)\n                {\n                    value = messageBundle.getString(resourceKey);\n                }\n                return value;\n            }\n            catch (MissingResourceException e)\n            {\n                return resourceKey;\n            }\n        }\n\n        return messageTemplate;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/TestMessages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\n\n@MessageBundle\n@MessageContextConfig(\n        messageInterpolator = TestMessageInterpolator.class,\n        localeResolver = FixedEnglishLocalResolver.class\n)\npublic interface TestMessages\n{\n    @MessageTemplate(\"Spotted %s jays\")\n    String numberOfJaysSpotted(int number);\n\n    @MessageTemplate(\"{categoryMessage}\")\n    Message messageWithCategory(String value);\n\n\n    @MessageTemplate(\"{welcome_to_deltaspike}\")\n    String welcomeToDeltaSpike();\n\n    @MessageTemplate(\"{welcome_to}\")\n    String welcomeTo(String name);\n\n    @MessageTemplate(\"{welcome_to}\")\n    String welcomeTo(MessageContext messageContext, String name);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/TypedMessageWithCustomName.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\n\nimport jakarta.inject.Named;\n\n@Named(\"namedTypedMessages\")\n@MessageBundle\n@MessageContextConfig(\n    localeResolver = FixedEnglishLocalResolver.class,\n    messageSource = \"customMinimalMessage\")\npublic interface TypedMessageWithCustomName\n{\n    String sayHello(String name);\n    String text();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/broken/BrokenMessageBundleClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message.broken;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\n\n/**\n * This class is broken, as MessageBundle must only be used on Interfaces\n */\n@MessageBundle\npublic class BrokenMessageBundleClass\n{\n    @MessageTemplate(\"Welcome to DeltaSpike\")\n    String welcomeToDeltaSpike()\n    {\n        return null;\n    }\n\n    @MessageTemplate(\"Welcome to %s\")\n    Message welcomeTo(MessageContext messageContext, String name)\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/broken/BrokenMessageBundleOnClassTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message.broken;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.ShouldThrowException;\n//X import org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.experimental.categories.Category;\n//X import org.junit.Test;\n//X import org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\n\n/**\n * Tests for broken MessageBundle definition\n *\n * This is currently disabled due to a few problems with DeploymentException validation:\n * a.) some containers wrap the internally thrown IllegalStateException into another Exception\n * b.) some arquillian container adapters throw up with a NPE\n *\n * TODO: fix the container and arquillian setup!\n */\n//X @RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class BrokenMessageBundleOnClassTest\n{\n    @Inject\n    private BrokenMessageBundleClass messageBundle;\n\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    @ShouldThrowException(Exception.class)\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"invalidMessageBundleTest.jar\")\n                .addPackage(BrokenMessageBundleClass.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"invalidMessageBundleTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class,\n                        MessageBundleExtension.class);\n    }\n\n    //X     @Test\n    public void testSimpleMessage()\n    {\n        assertEquals(\"Welcome to DeltaSpike\", messageBundle.welcomeToDeltaSpike());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/locale/ConfigurableLocaleMessageTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message.locale;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\nimport java.util.Date;\nimport java.util.Locale;\n\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.impl.message.MessageBundleExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\n\n/**\n * Tests for {@link org.apache.deltaspike.core.api.message.MessageTemplate}\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ConfigurableLocaleMessageTest\n{\n    private static final String BEANS_XML_CONTENT =\n            \"<beans bean-discovery-mode=\\\"all\\\"><alternatives><class>\" +\n            ConfigurableLocaleResolver.class.getName() +\n            \"</class></alternatives></beans>\";\n\n    @Inject\n    private MessageWithLocale localizedMessage;\n\n    @Inject\n    private ConfigurableLocaleResolver localeResolver;\n\n    @Inject\n    private MessageContext messageContext;\n\n\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"localeMessageTest.jar\")\n                .addPackage(ConfigurableLocaleMessageTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"localeMessageTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(new StringAsset(BEANS_XML_CONTENT), \"beans.xml\")\n                .addAsServiceProvider(Extension.class,\n                        MessageBundleExtension.class);\n    }\n\n    @Test\n    public void testSimpleMessage()\n    {\n        assertEquals(\"Welcome to DeltaSpike\", localizedMessage.welcomeToDeltaSpike());\n        assertEquals(\"Welcome to DeltaSpike\", localizedMessage.welcomeWithStringVariable(\"DeltaSpike\"));\n    }\n\n    /**\n     * This test checks if the {@link org.apache.deltaspike.core.api.message.LocaleResolver}\n     * gets properly invoked.\n     */\n    @Test\n    public void testDefaultLocaleInMessage()\n    {\n        internalTestLocales(Locale.GERMANY);\n        internalTestLocales(Locale.US);\n        internalTestLocales(Locale.FRANCE);\n    }\n\n    private void internalTestLocales(Locale locale)\n    {\n\n        localeResolver.setLocale(locale);\n\n        float f = 123.45f;\n        String expectedResult = \"Welcome \" + String.format(locale, \"%f\", f);\n        String result = localizedMessage.welcomeWithFloatVariable(f);\n        assertEquals(expectedResult, result);\n\n        Date dt = new Date();\n        expectedResult = \"Welcome \" + String.format(locale, \"%1$tB %1$te,%1$tY\", dt);\n        result = localizedMessage.welcomeWithDateVariable(dt);\n        assertEquals(expectedResult, result);\n\n        result = messageContext.message().template(\"Welcome at %tB\").argument(dt).toString();\n        assertEquals(\"Welcome at \" + String.format(locale, \"%1$tB\", dt), result);\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/locale/ConfigurableLocaleResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message.locale;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\nimport java.util.Locale;\n\nimport org.apache.deltaspike.core.api.message.LocaleResolver;\n\n/**\n * This alternative LocaleResolver replaces the DefaultLocaleResolver.\n * It allows us to set the Locale to different ones to test\n * variations. This is needed to avoid having test which by accident\n * only run in a single timezone/locale.\n */\n@ApplicationScoped\n@Alternative\npublic class ConfigurableLocaleResolver implements LocaleResolver\n{\n    private static final long serialVersionUID = 1927000487639667775L;\n    private Locale locale;\n\n    @PostConstruct\n    public void init()\n    {\n        locale = Locale.getDefault();\n    }\n\n    @Override\n    public Locale getLocale()\n    {\n        return locale;\n    }\n\n    public void setLocale(Locale locale)\n    {\n        this.locale = locale;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/message/locale/MessageWithLocale.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.message.locale;\n\nimport java.util.Date;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\n\n@MessageBundle\npublic interface MessageWithLocale\n{\n    @MessageTemplate(\"Welcome to DeltaSpike\")\n    String welcomeToDeltaSpike();\n\n    @MessageTemplate(\"Welcome to %s\")\n    Message welcomeTo(MessageContext messageContext, String name);\n\n    @MessageTemplate(\"Welcome to %s\")\n    String welcomeWithStringVariable(String name);\n\n    @MessageTemplate(\"Welcome %f\")\n    String welcomeWithFloatVariable(Float floatValue);\n\n    @MessageTemplate(\"Welcome %1$tB %1$te,%1$tY\")\n    String welcomeWithDateVariable(Date dateValue);\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageProducerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.projectstage;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n *\n */\npublic class ProjectStageProducerTest\n{\n    /**\n     * Test a ProjectStage which got set by the <i>jakarta.faces.ProjectStage</i>\n     */\n    @Test\n    public void testProjectStageSetByEnvironment()\n    {\n        String[] oldEnvVals = new String[ProjectStageProducer.CONFIG_SETTING_KEYS.length];\n        for (int i = 0; i < ProjectStageProducer.CONFIG_SETTING_KEYS.length; i++)\n        {\n            String envName = ProjectStageProducer.CONFIG_SETTING_KEYS[i];\n            oldEnvVals[i] = \"\" + System.getProperty(envName);\n\n            // and also clean them now\n            System.setProperty(ProjectStageProducer.CONFIG_SETTING_KEYS[i], \"\");\n        }\n\n        try\n        {\n            for (int i = 0; i < ProjectStageProducer.CONFIG_SETTING_KEYS.length; i++)\n            {\n                String envName = ProjectStageProducer.CONFIG_SETTING_KEYS[i];\n\n                System.setProperty(envName, \"SystemTest\");\n\n                ProjectStageProducer psp = ProjectStageProducer.getInstance();\n                Assert.assertNotNull(psp);\n\n                ProjectStageProducer.setProjectStage(null);\n\n                ProjectStage ps = psp.getProjectStage();\n                Assert.assertNotNull(ps);\n                Assert.assertEquals(ps, ProjectStage.SystemTest);\n                Assert.assertTrue(ps == ProjectStage.SystemTest);\n\n                ProjectStageProducer.setProjectStage(null);\n                System.setProperty(envName, \"IntegrationTest\");\n\n                ps = psp.getProjectStage();\n                Assert.assertNotNull(ps);\n                Assert.assertEquals(ps, ProjectStage.IntegrationTest);\n                Assert.assertTrue(ps == ProjectStage.IntegrationTest);\n\n                System.setProperty(envName, \"\");\n            }\n        }\n        finally\n        {\n            // restore the old env values\n            for (int i = 0; i < ProjectStageProducer.CONFIG_SETTING_KEYS.length; i++)\n            {\n                System.setProperty(ProjectStageProducer.CONFIG_SETTING_KEYS[i], oldEnvVals[i]);\n            }\n\n            // also reset the ProjectStageProducer again\n            ProjectStageProducer.setProjectStage(null);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.projectstage;\n\n\nimport org.junit.Test;\nimport org.junit.Assert;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\n/**\n * Test for {@link ProjectStage}\n */\npublic class ProjectStageTest {\n\n    @Test\n    public void testProjectStages() throws Exception\n    {\n        ProjectStage ps = ProjectStage.Development;\n        Assert.assertNotNull(ps);\n\n        ProjectStage psOther = ProjectStage.valueOf(\"CustomProjectStage\");\n        Assert.assertNotNull(psOther);\n\n        psOther = TestProjectStages.CustomProjectStage;\n        Assert.assertNotNull(psOther);\n\n        ProjectStage psProd = ProjectStage.valueOf(\"Production\");\n        Assert.assertNotNull(psProd);\n\n        ProjectStage[] values = ProjectStage.values();\n        Assert.assertNotNull(values);\n        Assert.assertTrue(values.length == 7);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/TestProjectStages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.projectstage;\n\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStageHolder;\n\n/**\n * This is a test ProjectStage. It demonstrates how to add custom ProjectStages.\n * This TestProjectStage must get registered via the {@link java.util.ServiceLoader}\n * mechanism. Please see the file\n * <pre>\n *     META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder\n * </pre>\n */\npublic class TestProjectStages implements ProjectStageHolder\n{\n    public static final class CustomProjectStage extends ProjectStage\n    {\n        private static final long serialVersionUID = 1029095387976167179L;\n    }\n\n    public static final CustomProjectStage CustomProjectStage = new CustomProjectStage();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\n\npublic abstract class BeanManagerProviderTest\n{\n    @Test\n    public void testBeanManagerProvider() throws Exception\n    {\n        BeanManagerProvider bmp = BeanManagerProvider.getInstance();\n        Assert.assertNotNull(bmp);\n\n        BeanManager bm = bmp.getBeanManager();\n        Assert.assertNotNull(bm);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class BeanManagerProviderWarFileTest extends BeanManagerProviderTest\n{\n    /**\n     *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = BeanManagerProviderWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addPackage(BeanManagerProviderWarFileTest.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.Serializer;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport java.util.List;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class BeanProviderTest\n{\n\n    /**\n     *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"beanProviderTest.jar\")\n                .addPackage(BeanProviderTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"beanProvider.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    /**\n     * lookup by type\n     */\n    @Test\n    public void simpleBeanLookupByType()\n    {\n        TestBean testBean = BeanProvider.getContextualReference(TestBean.class, false);\n\n        Assert.assertNotNull(testBean);\n    }\n\n    /**\n     * lookup by name with expected type\n     */\n    @Test\n    public void simpleBeanLookupByName()\n    {\n        TestBean testBean = BeanProvider.getContextualReference(\"extraNameBean\", false, TestBean.class);\n\n        Assert.assertNotNull(testBean);\n    }\n\n    /**\n     * lookup by name without type\n     */\n    @Test\n    public void simpleBeanLookupByNameWithoutType()\n    {\n        {\n            // test with the convenient operator (optional=false implied)\n            Object testBean = BeanProvider.getContextualReference(\"extraNameBean\");\n            Assert.assertNotNull(testBean);\n            Assert.assertTrue(testBean instanceof TestBean);\n            TestBean tb = (TestBean) testBean;\n            Assert.assertEquals(4711, tb.getI());\n        }\n\n        {\n            // test with the 'optional' flag set to false\n            Object testBean = BeanProvider.getContextualReference(\"extraNameBean\", false);\n            Assert.assertNotNull(testBean);\n            Assert.assertTrue(testBean instanceof TestBean);\n            TestBean tb = (TestBean) testBean;\n            Assert.assertEquals(4711, tb.getI());\n        }\n\n        {\n            // test by name lookup with the 'optional' flag set to false\n            try\n            {\n                Object testBean = BeanProvider.getContextualReference(\"thisBeanDoesNotExist\");\n                Assert.fail(\"BeanProvider#getContextualReference should have blown up with a non-existing bean!\");\n            }\n            catch(IllegalStateException ise)\n            {\n                // all is well, this is exactly what should happen!\n            }\n        }\n\n        {\n            // test by type lookup with the 'optional' flag set to false\n            try\n            {\n                // guess we can safely assume that there is no producer for a ConcurrentHashMap in the system...\n                ConcurrentHashMap chm = BeanProvider.getContextualReference(ConcurrentHashMap.class);\n                Assert.fail(\"BeanProvider#getContextualReference should have blown up with a non-existing bean!\");\n            }\n            catch(IllegalStateException ise)\n            {\n                // all is well, this is exactly what should happen!\n            }\n        }\n\n\n    }\n\n    /*\n     * lookup without result\n     */\n    @Test\n    public void optionalBeanLookup()\n    {\n        NoBean result = BeanProvider.getContextualReference(NoBean.class, true);\n\n        Assert.assertNull(result);\n    }\n\n    /*\n     * lookup of all beans of a given type\n     */\n    @Test\n    public void multiBeanLookupWithDependentBean() throws Exception\n    {\n        List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false);\n\n        Assert.assertNotNull(result);\n\n        Assert.assertEquals(2, result.size());\n    }\n\n    /*\n     * lookup of all beans of a given type which aren't dependent scoped\n     */\n    @Test\n    public void multiBeanLookupWithoutDependentBean() throws Exception\n    {\n        List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false, false);\n\n        Assert.assertNotNull(result);\n\n        Assert.assertEquals(1, result.size());\n    }\n\n    /*\n     * create a manual instance, inject dependencies, set values of the dependencies and check the referenced cdi bean\n     */\n    @Test\n    public void injectBeansInNonManagedInstance() throws Exception\n    {\n        ManualBean manualBean = new ManualBean();\n\n        Assert.assertNull(manualBean.getTestBean());\n\n        BeanProvider.injectFields(manualBean);\n\n        Assert.assertNotNull(manualBean.getTestBean());\n\n        Assert.assertEquals(4711, manualBean.getTestBean().getI());\n\n        int newValue = 14;\n\n        manualBean.getTestBean().setI(newValue);\n\n        Assert.assertEquals(newValue, manualBean.getTestBean().getI());\n\n        TestBean testBean = BeanProvider.getContextualReference(TestBean.class);\n\n        Assert.assertEquals(newValue, testBean.getI());\n\n        testBean.setI(4711); // reset the value if this test is executed first\n    }\n\n    @Test\n    public void testDependentBeanResolving() throws Exception\n    {\n        DependentProvider<DependentTestBean> dependentTestBeanProvider = BeanProvider.getDependent(DependentTestBean.class);\n        checkDependentProvider(dependentTestBeanProvider);\n    }\n\n    @Test\n    public void testNamedDependentBeanResolving() throws Exception\n    {\n        DependentProvider<DependentTestBean> dependentTestBeanProvider = BeanProvider.getDependent(\"dependentTestBean\");\n        checkDependentProvider(dependentTestBeanProvider);\n    }\n\n    @Test\n    public void testDependentBeanSerialization() throws Exception\n    {\n        DependentProvider<DependentTestBean> dependentTestBeanProvider = BeanProvider.getDependent(DependentTestBean.class);\n\n        Serializer<DependentProvider<DependentTestBean>> serializer = new Serializer<DependentProvider<DependentTestBean>>();\n        DependentProvider<DependentTestBean> provider2 = serializer.roundTrip(dependentTestBeanProvider);\n        Assert.assertNotNull(provider2);\n    }\n\n    private void checkDependentProvider(DependentProvider<DependentTestBean> dependentTestBeanProvider)\n    {\n        Assert.assertNotNull(dependentTestBeanProvider);\n\n        DependentTestBean instance = dependentTestBeanProvider.get();\n        Assert.assertNotNull(instance);\n\n        Assert.assertEquals(42, instance.getI());\n        instance.setI(21);\n        Assert.assertEquals(21, instance.getI());\n\n        Assert.assertFalse(instance.isDestroyed());\n        dependentTestBeanProvider.destroy();\n        Assert.assertTrue(instance.isDestroyed());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/DependentTestBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\n@Dependent\n@Named\npublic class DependentTestBean implements Serializable\n{\n    private int i = 42;\n    private boolean destroyed = false;\n\n    public int getI()\n    {\n        return i;\n    }\n\n    public void setI(int i)\n    {\n        this.i = i;\n    }\n\n    public boolean isDestroyed()\n    {\n        return destroyed;\n    }\n\n    @PreDestroy\n    public void cleanUp() {\n        destroyed = true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean01.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n/**\n * Impl #1\n */\n@ApplicationScoped\npublic class MBean01 implements MultiBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean02.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport jakarta.enterprise.context.Dependent;\n\n/**\n * Impl #2\n */\n@Dependent\npublic class MBean02 implements MultiBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/ManualBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.inject.Inject;\n\n@Vetoed\nclass ManualBean\n{\n    @Inject\n    private TestBean testBean;\n\n    TestBean getTestBean()\n    {\n        return testBean;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MultiBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\n/**\n * Interface for multiple beans\n */\npublic interface MultiBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/NoBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\n/**\n * Interface without implementation\n */\npublic interface NoBean\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/TestBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.provider;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Named;\n\n@Named(\"extraNameBean\")\n@ApplicationScoped\npublic class TestBean\n{\n    private int i = 4711;\n\n    public int getI()\n    {\n        return i;\n    }\n\n    public void setI(int i)\n    {\n        this.i = i;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/grouped/explicit/ExplicitTestGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.grouped.explicit;\n\npublic interface ExplicitTestGroup\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/grouped/explicit/ExplicitlyGroupedBeanX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.grouped.explicit;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversation;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\n\nimport jakarta.inject.Inject;\nimport java.io.Serializable;\n\n@GroupedConversationScoped\n@ConversationGroup(ExplicitTestGroup.class)\npublic class ExplicitlyGroupedBeanX implements Serializable\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n\n    private String value;\n\n    @Inject\n    private GroupedConversation conversation;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public void done()\n    {\n        this.conversation.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/grouped/explicit/ExplicitlyGroupedBeanY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.grouped.explicit;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversation;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\n\nimport jakarta.inject.Inject;\nimport java.io.Serializable;\n\n@GroupedConversationScoped\n@ConversationGroup(ExplicitTestGroup.class)\npublic class ExplicitlyGroupedBeanY implements Serializable\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n\n    private String value;\n\n    @Inject\n    private GroupedConversation conversation;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public void done()\n    {\n        this.conversation.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/grouped/explicit/ExplicitlyGroupedConversationsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.grouped.explicit;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ExplicitlyGroupedConversationsTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ExplicitlyGroupedConversationsTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(ExplicitlyGroupedConversationsTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    @ConversationGroup(ExplicitTestGroup.class)\n    private ExplicitlyGroupedBeanX explicitlyGroupedBeanX;\n\n    @Inject\n    @ConversationGroup(ExplicitTestGroup.class)\n    private ExplicitlyGroupedBeanY explicitlyGroupedBeanY;\n\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    @Test\n    public void parallelConversationsTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        explicitlyGroupedBeanX.setValue(\"x1\");\n        explicitlyGroupedBeanY.setValue(\"x2\");\n        Assert.assertEquals(\"x1\", explicitlyGroupedBeanX.getValue());\n        Assert.assertEquals(\"x2\", explicitlyGroupedBeanY.getValue());\n\n        windowContext.activateWindow(\"w2\");\n\n        Assert.assertNull(explicitlyGroupedBeanX.getValue());\n        Assert.assertNull(explicitlyGroupedBeanY.getValue());\n\n        explicitlyGroupedBeanX.setValue(\"y1\");\n        explicitlyGroupedBeanY.setValue(\"y2\");\n        Assert.assertEquals(\"y1\", explicitlyGroupedBeanX.getValue());\n        Assert.assertEquals(\"y2\", explicitlyGroupedBeanY.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        explicitlyGroupedBeanX.setValue(\"x1\");\n        explicitlyGroupedBeanY.setValue(\"x2\");\n        Assert.assertEquals(\"x1\", explicitlyGroupedBeanX.getValue());\n        Assert.assertEquals(\"x2\", explicitlyGroupedBeanY.getValue());\n\n        explicitlyGroupedBeanX.done();\n\n        Assert.assertNull(explicitlyGroupedBeanX.getValue());\n        Assert.assertNull(explicitlyGroupedBeanY.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationViaConversationManagerTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        explicitlyGroupedBeanX.setValue(\"x1\");\n        explicitlyGroupedBeanY.setValue(\"x2\");\n        Assert.assertEquals(\"x1\", explicitlyGroupedBeanX.getValue());\n        Assert.assertEquals(\"x2\", explicitlyGroupedBeanY.getValue());\n\n        this.conversationManager.closeConversationGroup(ExplicitTestGroup.class);\n\n        Assert.assertNull(explicitlyGroupedBeanX.getValue());\n        Assert.assertNull(explicitlyGroupedBeanY.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationsTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        explicitlyGroupedBeanX.setValue(\"x1\");\n        explicitlyGroupedBeanY.setValue(\"x2\");\n        Assert.assertEquals(\"x1\", explicitlyGroupedBeanX.getValue());\n        Assert.assertEquals(\"x2\", explicitlyGroupedBeanY.getValue());\n\n        this.conversationManager.closeConversations();\n\n        Assert.assertNull(explicitlyGroupedBeanX.getValue());\n        Assert.assertNull(explicitlyGroupedBeanY.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationsViaWindowContextTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        explicitlyGroupedBeanX.setValue(\"x1\");\n        explicitlyGroupedBeanY.setValue(\"x2\");\n        Assert.assertEquals(\"x1\", explicitlyGroupedBeanX.getValue());\n        Assert.assertEquals(\"x2\", explicitlyGroupedBeanY.getValue());\n\n        Assert.assertTrue(this.windowContext.closeWindow(\"w1\"));\n        windowContext.activateWindow(\"w1\");\n\n        Assert.assertNull(explicitlyGroupedBeanX.getValue());\n        Assert.assertNull(explicitlyGroupedBeanY.getValue());\n    }\n\n    @Test(expected = ContextNotActiveException.class)\n    public void noWindowTest()\n    {\n        try\n        {\n            windowContext.activateWindow(\"w1\");\n\n            explicitlyGroupedBeanX.setValue(\"x1\");\n            explicitlyGroupedBeanY.setValue(\"x2\");\n            Assert.assertEquals(\"x1\", explicitlyGroupedBeanX.getValue());\n            Assert.assertEquals(\"x2\", explicitlyGroupedBeanY.getValue());\n\n            this.windowContext.closeWindow(\"w1\");\n        }\n        catch (ContextNotActiveException e)\n        {\n            Assert.fail();\n        }\n\n        explicitlyGroupedBeanX.getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/grouped/implicit/ImplicitlyGroupedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.grouped.implicit;\n\nimport org.apache.deltaspike.core.api.scope.GroupedConversation;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\n\nimport jakarta.inject.Inject;\nimport java.io.Serializable;\n\n@GroupedConversationScoped\npublic class ImplicitlyGroupedBean implements Serializable\n{\n    private static final long serialVersionUID = -4722854711870629520L;\n\n    private String value;\n\n    @Inject\n    private GroupedConversation conversation;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public void done()\n    {\n        this.conversation.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/grouped/implicit/ImplicitlyGroupedConversationsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.grouped.implicit;\n\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ImplicitlyGroupedConversationsTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ImplicitlyGroupedConversationsTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(ImplicitlyGroupedConversationsTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    private ImplicitlyGroupedBean implicitlyGroupedBean;\n\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    @Test\n    public void parallelConversationsTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        implicitlyGroupedBean.setValue(\"x\");\n        Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n\n        windowContext.activateWindow(\"w2\");\n\n        Assert.assertNull(implicitlyGroupedBean.getValue());\n\n        implicitlyGroupedBean.setValue(\"y\");\n        Assert.assertEquals(\"y\", implicitlyGroupedBean.getValue());\n\n        windowContext.activateWindow(\"w1\");\n        Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        implicitlyGroupedBean.setValue(\"x\");\n        Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n\n        implicitlyGroupedBean.done();\n\n        Assert.assertNull(implicitlyGroupedBean.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationViaConversationManagerTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        implicitlyGroupedBean.setValue(\"x\");\n        Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n\n        this.conversationManager.closeConversation(ImplicitlyGroupedBean.class);\n\n        Assert.assertNull(implicitlyGroupedBean.getValue());\n\n\n        implicitlyGroupedBean.setValue(\"y\");\n        Assert.assertEquals(\"y\", implicitlyGroupedBean.getValue());\n\n        this.conversationManager.closeConversationGroup(ImplicitlyGroupedBean.class);\n\n        Assert.assertNull(implicitlyGroupedBean.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationsTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        implicitlyGroupedBean.setValue(\"x\");\n        Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n\n        this.conversationManager.closeConversations();\n\n        Assert.assertNull(implicitlyGroupedBean.getValue());\n    }\n\n    @Test\n    public void immediatelyClosedConversationsViaWindowContextTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        implicitlyGroupedBean.setValue(\"x\");\n        Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n\n        Assert.assertTrue(this.windowContext.closeWindow(\"w1\"));\n        windowContext.activateWindow(\"w1\");\n\n        Assert.assertNull(implicitlyGroupedBean.getValue());\n    }\n\n    @Test(expected = ContextNotActiveException.class)\n    public void noWindowTest()\n    {\n        try\n        {\n            windowContext.activateWindow(\"w1\");\n\n            implicitlyGroupedBean.setValue(\"x\");\n            Assert.assertEquals(\"x\", implicitlyGroupedBean.getValue());\n\n            this.windowContext.closeWindow(\"w1\");\n        }\n        catch (ContextNotActiveException e)\n        {\n            Assert.fail();\n        }\n\n        implicitlyGroupedBean.getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/shared/TestBaseBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared;\n\nimport org.apache.deltaspike.core.api.scope.GroupedConversation;\n\nimport jakarta.inject.Inject;\nimport java.io.Serializable;\n\npublic abstract class TestBaseBean implements Serializable\n{\n    private String value;\n\n    @Inject\n    private GroupedConversation conversation;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public void done()\n    {\n        this.conversation.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/shared/TestBeanA.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\n\n@GroupedConversationScoped\n@ConversationGroup(TestGroup.class)\npublic class TestBeanA extends TestBaseBean\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/shared/TestBeanB.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\n\n@GroupedConversationScoped\n@ConversationGroup(TestGroup.class)\npublic class TestBeanB extends TestBaseBean\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/shared/TestBeanC.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\n\n@GroupedConversationScoped\n@ConversationGroup(TestGroup.class)\npublic class TestBeanC extends TestBaseBean\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/shared/TestGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared;\n\npublic interface TestGroup\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc001/GroupedConversationSubGroupTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc001;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.*;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class GroupedConversationSubGroupTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = GroupedConversationSubGroupTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(GroupedConversationSubGroupTest.class.getPackage())\n                .addPackage(TestBaseBean.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanA testBeanA;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanB testBeanB;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanC testBeanC;\n\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    @Test\n    public void closedSubGroupTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        testBeanA.setValue(\"x1\");\n        testBeanB.setValue(\"x2\");\n        testBeanC.setValue(\"x3\");\n        Assert.assertEquals(\"x1\", testBeanA.getValue());\n        Assert.assertEquals(\"x2\", testBeanB.getValue());\n        Assert.assertEquals(\"x3\", testBeanC.getValue());\n\n        this.conversationManager.closeConversationGroup(TestSubGroup.class);\n\n        Assert.assertNull(testBeanA.getValue());\n        Assert.assertEquals(\"x2\", testBeanB.getValue()); //not part of the sub-group\n        Assert.assertNull(testBeanC.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc001/TestSubGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc001;\n\nimport org.apache.deltaspike.core.api.scope.ConversationSubGroup;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanA;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanC;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\n\n@ConversationSubGroup(of = TestGroup.class, subGroup = {TestBeanA.class, TestBeanC.class})\npublic interface TestSubGroup\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc002/GroupedConversationSubGroupTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc002;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBaseBean;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanA;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanB;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanC;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class GroupedConversationSubGroupTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = GroupedConversationSubGroupTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(GroupedConversationSubGroupTest.class.getPackage())\n                .addPackage(TestBaseBean.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanA testBeanA;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanB testBeanB;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanC testBeanC;\n\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    @Test\n    public void closedSubGroupTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        testBeanA.setValue(\"x1\");\n        testBeanB.setValue(\"x2\");\n        testBeanC.setValue(\"x3\");\n        Assert.assertEquals(\"x1\", testBeanA.getValue());\n        Assert.assertEquals(\"x2\", testBeanB.getValue());\n        Assert.assertEquals(\"x3\", testBeanC.getValue());\n\n        this.conversationManager.closeConversationGroup(TestSubGroup.class);\n\n        Assert.assertNull(testBeanA.getValue());\n        Assert.assertEquals(\"x2\", testBeanB.getValue()); //not part of the sub-group\n        Assert.assertNull(testBeanC.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc002/TestSubGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc002;\n\nimport org.apache.deltaspike.core.api.scope.ConversationSubGroup;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanA;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBeanC;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\n\n@ConversationSubGroup(subGroup = {TestBeanA.class, TestBeanC.class})\npublic interface TestSubGroup extends TestGroup\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc003/GroupedConversationSubGroupTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc003;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.spi.scope.conversation.GroupedConversationManager;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBaseBean;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class GroupedConversationSubGroupTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = GroupedConversationSubGroupTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(GroupedConversationSubGroupTest.class.getPackage())\n                .addPackage(TestBaseBean.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanX testBeanX;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanY testBeanY;\n\n    @Inject\n    @ConversationGroup(TestGroup.class)\n    private TestBeanZ testBeanZ;\n\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    @Test\n    public void closedSubGroupTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        testBeanX.setValue(\"x1\");\n        testBeanY.setValue(\"x2\");\n        testBeanZ.setValue(\"x3\");\n        Assert.assertEquals(\"x1\", testBeanX.getValue());\n        Assert.assertEquals(\"x2\", testBeanY.getValue());\n        Assert.assertEquals(\"x3\", testBeanZ.getValue());\n\n        this.conversationManager.closeConversationGroup(TestImplicitSubGroup.class);\n\n        Assert.assertNull(testBeanX.getValue());\n        Assert.assertEquals(\"x2\", testBeanY.getValue()); //not part of the sub-group\n        Assert.assertNull(testBeanZ.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc003/TestBeanX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc003;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBaseBean;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\n\n@GroupedConversationScoped\n@ConversationGroup(TestGroup.class)\npublic class TestBeanX extends TestBaseBean implements TestSubGroupContract\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc003/TestBeanY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc003;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBaseBean;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\n\n@GroupedConversationScoped\n@ConversationGroup(TestGroup.class)\npublic class TestBeanY extends TestBaseBean\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc003/TestBeanZ.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc003;\n\nimport org.apache.deltaspike.core.api.scope.ConversationGroup;\nimport org.apache.deltaspike.core.api.scope.GroupedConversationScoped;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestBaseBean;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\n\n@GroupedConversationScoped\n@ConversationGroup(TestGroup.class)\npublic class TestBeanZ extends TestBaseBean implements TestSubGroupContract\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc003/TestImplicitSubGroup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc003;\n\nimport org.apache.deltaspike.core.api.scope.ConversationSubGroup;\nimport org.apache.deltaspike.test.core.api.scope.conversation.subgroup.shared.TestGroup;\n\n@ConversationSubGroup(of = TestGroup.class, subGroup = {TestSubGroupContract.class})\npublic interface TestImplicitSubGroup\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/subgroup/uc003/TestSubGroupContract.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.conversation.subgroup.uc003;\n\npublic interface TestSubGroupContract\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/viewaccess/ViewAccessScopedBeanX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.viewaccess;\n\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\n\nimport java.io.Serializable;\n\n@ViewAccessScoped\npublic class ViewAccessScopedBeanX implements Serializable\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n\n    private String value;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/viewaccess/ViewAccessScopedBeanY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.viewaccess;\n\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\n\nimport java.io.Serializable;\n\n@ViewAccessScoped\npublic class ViewAccessScopedBeanY implements Serializable\n{\n    private static final long serialVersionUID = -1291355584482007178L;\n\n    private String value;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/viewaccess/ViewAccessScopedTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.scope.viewaccess;\n\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ViewAccessScopedTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ViewAccessScopedTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(ViewAccessScopedTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    private ViewAccessScopedBeanX viewAccessScopedBeanX;\n\n    @Inject\n    private ViewAccessScopedBeanY viewAccessScopedBeanY;\n\n    @Inject\n    private DeltaSpikeContextExtension contextExtension;\n\n    @Test\n    public void usageOnOnePageTest()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        viewAccessScopedBeanY.setValue(\"y1\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        //no access\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n\n        windowContext.activateWindow(\"w2\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n        windowContext.closeWindow(\"w2\");\n    }\n\n    @Test\n    public void usageOnOnePageTestAndNavigationAfterwards()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        viewAccessScopedBeanY.setValue(\"y1\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewB\");\n\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n    }\n\n    @Test\n    public void usageOnTwoPagesTest1()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        viewAccessScopedBeanY.setValue(\"y1\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewB\");\n\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n\n        windowContext.activateWindow(\"w2\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n        windowContext.closeWindow(\"w2\");\n    }\n\n    @Test\n    public void usageOnTwoPagesTest2()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        viewAccessScopedBeanY.setValue(\"y1\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewB\");\n\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n\n        windowContext.activateWindow(\"w2\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n        windowContext.closeWindow(\"w2\");\n    }\n\n    @Test\n    public void usageOnOnePageDifferentRequests()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n\n        viewAccessScopedBeanY.setValue(\"y1\");\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        //no access\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n\n        windowContext.activateWindow(\"w2\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n        windowContext.closeWindow(\"w2\");\n    }\n\n    @Test\n    public void usageOnOnePageDifferentRequestsAndNavigationAfterwards1()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n\n        viewAccessScopedBeanY.setValue(\"y1\");\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewB\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n\n        windowContext.activateWindow(\"w2\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n        windowContext.closeWindow(\"w2\");\n    }\n\n    @Test\n    public void usageOnOnePageDifferentRequestsAndNavigationAfterwards2()\n    {\n        windowContext.activateWindow(\"w1\");\n\n        viewAccessScopedBeanX.setValue(\"x1\");\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"x1\", viewAccessScopedBeanX.getValue());\n\n        viewAccessScopedBeanY.setValue(\"y1\");\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewA\");\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        contextExtension.getViewAccessScopedContext().onProcessingViewFinished(\"viewB\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertEquals(\"y1\", viewAccessScopedBeanY.getValue());\n\n        windowContext.closeWindow(\"w1\");\n\n        windowContext.activateWindow(\"w2\");\n        Assert.assertNull(viewAccessScopedBeanX.getValue());\n        Assert.assertNull(viewAccessScopedBeanY.getValue());\n        windowContext.closeWindow(\"w2\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/MyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util;\n\n\npublic class MyBean\n{\n\n \n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/MyInterface.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util;\n\npublic interface MyInterface\n{\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/MyInterfaceImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class MyInterfaceImpl implements MyInterface\n{\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/ProxyUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util;\n\nimport jakarta.inject.Inject;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Proxy;\nimport java.util.List;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class ProxyUtilsTest\n{\n\n    @Inject\n    private MyBean myDependentScopedBean;\n\n    @Inject\n    private MyInterface myInterface;\n\n    @Deployment\n    public static Archive<?> createTestArchive()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"proxyUtil.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n                .addClasses(ProxyUtilsTest.class, MyBean.class, MyInterface.class,\n                        MyInterfaceImpl.class);\n    }\n\n    @Test\n    public void testIsIntefaceProxy()\n    {\n        Object proxy = Proxy.newProxyInstance(myDependentScopedBean.getClass().getClassLoader(),\n                new Class[] { MyInterface.class }, new InvocationHandler()\n                {\n\n                    @Override\n                    public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable\n                    {\n                        return null;\n                    }\n                });\n        Assert.assertTrue(ProxyUtils.isInterfaceProxy(proxy.getClass()));\n    }\n\n    @Test\n    public void testIsNotIntefaceProxy()\n    {\n        Assert.assertFalse(ProxyUtils.isInterfaceProxy(myDependentScopedBean.getClass()));\n    }\n\n    @Test\n    public void testIsProxiedClass()\n    {\n        Assert.assertTrue(ProxyUtils.isProxiedClass(myInterface.getClass()));\n    }\n\n    @Test\n    public void testIsNotProxiedClass()\n    {\n        Assert.assertFalse(ProxyUtils.isProxiedClass(myDependentScopedBean.getClass()));\n    }\n\n    @Test\n    public void testGetUnproxiedClass()\n    {\n        Class clazz = ProxyUtils.getUnproxiedClass(myInterface.getClass());\n        Assert.assertEquals(clazz, MyInterfaceImpl.class);\n    }\n\n    @Test\n    public void testGetProxyAndBaseTypes()\n    {\n        List<Class<?>> list = ProxyUtils.getProxyAndBaseTypes(myInterface.getClass());\n        Assert.assertEquals(list.size(), 2);\n        Assert.assertTrue(ProxyUtils.isProxiedClass(list.get(0)));\n        Assert.assertEquals(MyInterfaceImpl.class, list.get(1));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/AbstractContextTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util.context;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n/**\n * We test the AbstractContext by implementing a simple dummy context.\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class AbstractContextTest\n{\n    /**\n     * X TODO creating a WebArchive is only a workaround because JavaArchive\n     * cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap\n                .create(JavaArchive.class, \"abstractContextTest.jar\")\n                .addClass(AbstractContextTest.class)\n                .addClass(DummyBean.class)\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsServiceProvider(Extension.class, DummyScopeExtension.class);\n\n        return ShrinkWrap\n                .create(WebArchive.class, \"abstractContextTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    // This test is a hack yet due to a bug in the owb-arquillian and weld-arquillian containers\n    // which needs to get fixed first. All tested containers so far do NOT respect the Extensions\n    // from the ShrinkWrap archive but only the ones from the classpath.\n    // Thus we had to add the Extension on the test-classpath. This means it will also\n    // be available for all other tests (but only for 'embedded' containers.\n    @Test\n    public void testDummyContext()\n    {\n        DummyBean dummyBean = BeanProvider.getContextualReference(DummyBean.class);\n\n        Assert.assertEquals(4711, dummyBean.getI());\n\n        dummyBean.setI(4712);\n\n        DummyBean dummyBean2 = BeanProvider.getContextualReference(DummyBean.class);\n        Assert.assertEquals(4712, dummyBean.getI());\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util.context;\n\nimport java.io.Serializable;\n\n/**\n */\n@DummyScoped\npublic class DummyBean implements Serializable\n{\n    private int i = 4711;\n\n    public int getI()\n    {\n        return i;\n    }\n\n    public void setI(int i)\n    {\n        this.i = i;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util.context;\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\n\nimport org.apache.deltaspike.core.util.context.AbstractContext;\nimport org.apache.deltaspike.core.util.context.ContextualStorage;\n\n/**\n * Non passivating scoped test context\n */\npublic class DummyContext extends AbstractContext\n{\n    private boolean active = true;\n    private boolean concurrent;\n    private ContextualStorage storage = null;\n    private BeanManager beanManager;\n\n    public DummyContext(BeanManager beanManager, boolean concurrent)\n    {\n        super(beanManager);\n        this.concurrent = concurrent;\n        this.beanManager = beanManager;\n    }\n\n    @Override\n    protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExists)\n    {\n        if (storage == null && createIfNotExists)\n        {\n            storage = new ContextualStorage(beanManager, concurrent, isPassivatingScope());\n        }\n\n        return storage;\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope()\n    {\n        return DummyScoped.class;\n    }\n\n    @Override\n    public boolean isActive()\n    {\n        return active;\n    }\n\n\n    public void setActive(boolean active)\n    {\n        this.active = active;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScopeExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util.context;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.Extension;\n\n/**\n * Registers the {@link DummyContext}\n */\npublic class DummyScopeExtension implements Extension\n{\n    private DummyContext context;\n\n    public void registerDummyContext(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)\n    {\n        context = new DummyContext(beanManager, true);\n        afterBeanDiscovery.addContext(context);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScoped.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.util.context;\n\nimport jakarta.enterprise.context.NormalScope;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n\n/**\n * Just a dummy test scope\n */\n@Target( { TYPE, METHOD, FIELD })\n@Retention(RUNTIME)\n@Documented\n@NormalScope(passivating = true)\n@Inherited\npublic @interface DummyScoped\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ActivatedClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\n/**\n * Class which isn't deactivated\n */\npublic class ActivatedClass implements Deactivatable\n{\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * Test for {@link org.apache.deltaspike.core.spi.activation.ClassDeactivator}\n */\npublic abstract class ClassDeactivationTest\n{\n    /**\n     * Tests if a class of the added package is active\n     */\n    @Test\n    public void testActivatedClass()\n    {\n        Assert.assertTrue(ClassDeactivationUtils.isActivated(ActivatedClass.class));\n    }\n\n    /**\n     * Tests if the class deactivated by {@link TestClassDeactivator} is recognized as such\n     */\n    @Test\n    public void testDeactivatedClass()\n    {\n        Assert.assertFalse(ClassDeactivationUtils.isActivated(DeactivatedClass.class));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\nimport org.apache.deltaspike.test.category.DeltaSpikeTest;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.apache.deltaspike.test.util.FileUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class ClassDeactivationWarFileTest extends ClassDeactivationTest\n{\n    /**\n     * NOTE: creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.\n     */\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ClassDeactivationWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        URL fileUrl = ClassDeactivationWarFileTest.class.getClassLoader()\n                .getResource(DeltaSpikeTest.DELTASPIKE_PROPERTIES);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"testClassDeactivationTest.jar\")\n                .addPackage(ClassDeactivationWarFileTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsResource(FileUtils.getFileForURL(fileUrl.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DeactivatedClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\n/**\n * Class which is deactivated\n */\npublic class DeactivatedClass implements Deactivatable\n{\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/DefaultClassDeactivatorTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\nimport org.apache.deltaspike.core.impl.activation.DefaultClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.test.category.DeltaSpikeTest;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\n\n@RunWith(Arquillian.class)\npublic class DefaultClassDeactivatorTest extends ClassDeactivationTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = DefaultClassDeactivatorTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        StringBuilder dsPropsBuilder = new StringBuilder();\n        dsPropsBuilder.append(ClassDeactivator.class.getName()).append(\"=\")\n                .append(DefaultClassDeactivator.class.getName()).append(\"\\n\")\n                // this gets picked up on app servers, not when using an embedded impl\n                .append(DefaultClassDeactivator.KEY_PREFIX).append(DeactivatedClass.class.getName()).append(\"=true\").append(\"\\n\");\n\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"testClassDeactivationTest.jar\")\n                .addPackage(ClassDeactivationWarFileTest.class.getPackage())\n                .addClass(DefaultClassDeactivator.class)\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsResource(new StringAsset(dsPropsBuilder.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    public void testViaInstantiatedCopyTheyAreDeactivated()\n    {\n        DefaultClassDeactivator defaultClassDeactivator = new DefaultClassDeactivator();\n        Boolean activated = defaultClassDeactivator.isActivated(ActivatedClass.class);\n        assertNull(activated);\n\n        Boolean deactivated = defaultClassDeactivator.isActivated(DeactivatedClass.class);\n        assertFalse(deactivated);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.activation;\n\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\n/**\n * Test {@link org.apache.deltaspike.core.spi.activation.ClassDeactivator}\n * which is needed to test {@link org.apache.deltaspike.core.util.ClassDeactivationUtils}\n */\npublic class TestClassDeactivator implements ClassDeactivator\n{\n    private static final long serialVersionUID = -3403907272881821406L;\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        if (targetClass.equals(DeactivatedClass.class))\n        {\n            return Boolean.FALSE;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/cipher/DefaultCipherServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.cipher;\n\nimport org.apache.deltaspike.core.impl.crypto.DefaultCipherService;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * Internal test for the DefaultCipherService.\n * Not intended to be a TCK for other CipherServices nor integration.\n */\npublic class DefaultCipherServiceTest\n{\n\n    @Test\n    public void testMasterPwdEncryption() throws Exception\n    {\n        DefaultCipherService cipherService = new DefaultCipherService();\n\n        String masterSalt = \"deltaspike-test-salt\";\n        cipherService.setMasterHash(\"newMasterPwd\", masterSalt, true);\n\n        String cleartext = \"my cleartext sentence\";\n        String encrypted = cipherService.encrypt(cleartext, masterSalt);\n\n        String decrypted = cipherService.decrypt(encrypted, masterSalt);\n        Assert.assertEquals(cleartext, decrypted);\n    }\n\n    @Test\n    public void testMasterKeyOverwrite() throws Exception {\n        DefaultCipherService cipherService = new DefaultCipherService();\n        String masterSalt = \"deltaspike-test-salt\";\n        cipherService.setMasterHash(\"newMasterPwd\", masterSalt, true);\n        try {\n            cipherService.setMasterHash(\"newMasterPwd\", masterSalt, false);\n            Assert.fail();\n        }\n        catch (Exception e) {\n            // todo: how to log exception properly\n            // System.out.println(\"expected: \" + e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.custom.spi;\n\npublic class MyImpl implements MyInterface\n{\n    @Override\n    public String getValue()\n    {\n        return \"test\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyInterface.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.custom.spi;\n\npublic interface MyInterface\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.custom.spi;\n\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic abstract class ServiceUtilsTest\n{\n    @Test\n    public void lookupOfSpiImplementations()\n    {\n        Assert.assertTrue(ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().hasNext());\n\n        Assert.assertNotNull(ServiceUtils.loadServiceImplementations(MyInterface.class));\n        Assert.assertFalse(ServiceUtils.loadServiceImplementations(MyInterface.class).isEmpty());\n        Assert.assertEquals(1, ServiceUtils.loadServiceImplementations(MyInterface.class).size());\n\n        Assert.assertEquals(\n            \"test\", ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().next().getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.custom.spi;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class ServiceUtilsWarFileTest extends ServiceUtilsTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ServiceUtilsWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(ServiceUtilsWarFileTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                //due to an issue with arquillian we can just add it to the web-archive (and not the jar)\n                .addAsServiceProvider(MyInterface.class, MyImpl.class)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/future/FutureableTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.future;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\n\nimport org.apache.deltaspike.core.impl.future.FutureableInterceptor;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.descriptor.api.Descriptors;\nimport org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor;\n\n@RunWith(Arquillian.class)\npublic class FutureableTest {\n    @Deployment\n    public static WebArchive deploy()\n    {\n        // create beans.xml with added interceptor\n        BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);\n        beans.getOrCreateInterceptors().clazz(FutureableInterceptor.class.getName());\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"FutureableTest.jar\")\n                .addPackage(Service.class.getPackage().getName())\n                .addAsManifestResource(new StringAsset(beans.exportAsString()), \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"FutureableTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private Service service;\n    \n    @Test\n    public void voidTest()\n    {\n        CountDownLatch latch = new CountDownLatch(1);\n        service.thatSLong(1000, latch);\n        try\n        {\n            if (!latch.await(2000, TimeUnit.MILLISECONDS)) {\n                fail(\"Asynchronous call should have terminated\");\n            }\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n    }\n\n    @Test\n    public void future()\n    {\n        final Future<String> future = service.thatSLong(1000);\n        int count = 0;\n        for (int i = 0; i < 1000; i++)\n        {\n            if (future.isDone())\n            {\n                break;\n            }\n            count++;\n        }\n        try\n        {\n            assertEquals(\"done\", future.get());\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n        catch (final ExecutionException e)\n        {\n            fail(e.getMessage());\n        }\n        assertEquals(1000, count);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/future/Service.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.future;\n\nimport org.apache.deltaspike.core.api.future.Futureable;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.TimeoutException;\n\n@ApplicationScoped\npublic class Service\n{\n\n    @Futureable\n    public void thatSLong(final long sleep, CountDownLatch latch) {\n    \ttry\n        {\n            Thread.sleep(sleep);\n            latch.countDown();\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            throw new IllegalStateException(e);\n        }\n    }\n\n    @Futureable // or CompletableFuture<String>\n    public Future<String> thatSLong(final long sleep)\n    {\n        try\n        {\n            Thread.sleep(sleep);\n            // return CompletableFuture.completedFuture(\"done\");\n            return new Future<String>()  // EE will have AsyncFuture but more designed for j8 ^^\n            {\n                @Override\n                public boolean cancel(final boolean mayInterruptIfRunning)\n                {\n                    return false;\n                }\n\n                @Override\n                public boolean isCancelled()\n                {\n                    return false;\n                }\n\n                @Override\n                public boolean isDone()\n                {\n                    return true;\n                }\n\n                @Override\n                public String get() throws InterruptedException, ExecutionException\n                {\n                    return \"done\";\n                }\n\n                @Override\n                public String get(final long timeout, final TimeUnit unit)\n                        throws InterruptedException, ExecutionException, TimeoutException\n                {\n                    return \"done\";\n                }\n            };\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            throw new IllegalStateException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/future/ThreadPoolManagerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.future;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.impl.config.PropertiesConfigSource;\nimport org.apache.deltaspike.core.impl.future.ThreadPoolManager;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport java.util.Collections;\nimport java.util.Properties;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.ThreadPoolExecutor;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertSame;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\n\n@RunWith(Arquillian.class)\npublic class ThreadPoolManagerTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap.create(WebArchive.class, \"ThreadPoolManagerTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private ThreadPoolManager manager;\n\n    @Test\n    public void defaultPool() throws ExecutionException, InterruptedException\n    {\n        final ExecutorService auto = manager.find(\"auto\");\n        assertEquals(auto, auto);\n        assertSame(auto, auto);\n        assertEquals(Runtime.getRuntime().availableProcessors(), ThreadPoolExecutor.class.cast(auto).getCorePoolSize());\n        assertUsable(auto);\n    }\n\n    @Test // this test validates we read the config properly but also it is lazy\n    public void configuredPool() throws ExecutionException, InterruptedException\n    {\n        ConfigResolver.addConfigSources(Collections.<ConfigSource>singletonList(new PropertiesConfigSource(new Properties()\n        {{\n            setProperty(\"futureable.pool.custom.coreSize\", \"5\");\n        }})\n        {\n            @Override\n            public String getConfigName()\n            {\n                return \"configuredPool\";\n            }\n        }));\n        final ExecutorService custom = manager.find(\"custom\");\n        assertEquals(custom, custom);\n        assertSame(custom, custom);\n        assertEquals(5, ThreadPoolExecutor.class.cast(custom).getCorePoolSize());\n        assertUsable(custom);\n    }\n\n    private void assertUsable(final ExecutorService pool) throws InterruptedException, ExecutionException\n    {\n        assertEquals(\"ok\", pool.submit(new Callable<String>()\n        {\n            @Override\n            public String call() throws Exception\n            {\n                return \"ok\";\n            }\n        }).get());\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/interdyn/InterDynTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.interdyn;\n\nimport org.apache.deltaspike.core.impl.monitoring.InvocationMonitorInterceptor;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class InterDynTest {\n    /**\n     * We need to configure this in META-INF/apache-deltaspike.properties in the test classpath\n     * for in-process Arquillian containers like OWB and Weld,\n     * and additionally via @Deployment for container based Arquillians\n     */\n    private final static String CONFIG =\n            \"# InterDynTest\\n\" +\n            \"deltaspike.interdyn.enabled=true\\n\" +\n            \"deltaspike.interdyn.rule.1.match=org\\\\\\\\.apache\\\\\\\\.deltaspike\\\\\\\\.test\\\\\\\\.core\\\\\\\\.impl\\\\\\\\.interdyn\\\\\\\\.Some.*Service\\n\" +\n            \"deltaspike.interdyn.rule.1.annotation=org.apache.deltaspike.core.api.monitoring.InvocationMonitored\\n\";\n\n    private final static String BEANS_XML =\n            \"<beans><interceptors><class>\" +\n            InvocationMonitorInterceptor.class.getName() +\n            \"</class></interceptors></beans>\";\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"InterDynTest.jar\")\n                .addPackage(SomeTestService.class.getPackage().getName())\n                .addAsManifestResource(new StringAsset(BEANS_XML), \"beans.xml\")\n                .addAsManifestResource(new StringAsset(CONFIG), \"apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(WebArchive.class, \"InterDynTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private SomeTestService service;\n\n    @Test\n    public void invokeServiceMethods()\n    {\n        service.enableChecking();\n\n        service.pingA();\n        service.pingB();\n        service.pingA();\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/interdyn/SomeTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.interdyn;\n\nimport org.apache.deltaspike.core.api.monitoring.MonitorResultEvent;\nimport org.junit.Assert;\n\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Observes;\n\n@ApplicationScoped\npublic class SomeTestService\n{\n\n    private boolean check = false;\n    private MonitorResultEvent mre;\n\n    public String pingA()\n    {\n        return \"a\";\n    }\n\n    public String pingB()\n    {\n        try\n        {\n            Thread.sleep(30L);\n        }\n        catch (InterruptedException e) {\n            // all fine\n        }\n        return \"b\";\n    }\n\n    public void enableChecking()\n    {\n        this.check = true;\n    }\n\n    public MonitorResultEvent getMonitorResultEvent()\n    {\n        return mre;\n    }\n\n    public void observer(@Observes MonitorResultEvent mre)\n    {\n        this.mre = mre;\n        if (check)\n        {\n            Assert.assertTrue(mre.getClassInvocations().keySet().contains(SomeTestService.class.getName()));\n            check = false;\n        }\n    }\n\n    @PreDestroy\n    public void verifyMonitorResultEvent()\n    {\n        Assert.assertNotNull(mre);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/CustomProperties.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.jmx.JmxManaged;\nimport org.apache.deltaspike.core.api.jmx.MBean;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@MBean(category = \"cat\", type = \"and\", name = \"\", properties = \"foo=bar,dummy=empty\")\npublic class CustomProperties\n{\n    @JmxManaged\n    private int counter;\n\n    public int getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(final int counter)\n    {\n        this.counter = counter;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/CustomProperties2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.jmx.JmxManaged;\nimport org.apache.deltaspike.core.api.jmx.MBean;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@MBean(category = \"cat\", type = \"and\", name = \"nom\", properties = \"foo=bar,dummy=empty\")\npublic class CustomProperties2\n{\n    @JmxManaged\n    private int counter;\n\n    public int getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(final int counter)\n    {\n        this.counter = counter;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/CustomPropertiesTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport javax.management.ObjectName;\nimport java.lang.management.ManagementFactory;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\npublic class CustomPropertiesTest\n{\n    @Deployment\n    public static Archive<?> war()\n    {\n        return ShrinkWrap.create(WebArchive.class, \"CustomPropertiesTest.war\")\n            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n            .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n            .addClasses(CustomProperties.class, CustomProperties2.class);\n    }\n\n    @Inject\n    private CustomProperties myMBean;\n\n    @Test\n    public void checkMBean() throws Exception\n    {\n        assertTrue(ManagementFactory.getPlatformMBeanServer().isRegistered(\n            new ObjectName(\"cat:type=and,foo=bar,dummy=empty\")));\n        assertTrue(ManagementFactory.getPlatformMBeanServer().isRegistered(\n            new ObjectName(\"cat:type=and,name=nom,foo=bar,dummy=empty\")));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/CustomType.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.jmx.JmxManaged;\nimport org.apache.deltaspike.core.api.jmx.MBean;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@MBean(category = \"cat\", type = \"and\", name = \"fish\")\npublic class CustomType\n{\n    @JmxManaged\n    private int counter;\n\n    public int getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(final int counter)\n    {\n        this.counter = counter;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/CustomTypeTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport javax.management.MBeanServer;\nimport javax.management.ObjectName;\nimport java.lang.management.ManagementFactory;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(Arquillian.class)\npublic class CustomTypeTest {\n    @Deployment\n    public static Archive<?> war()\n    {\n        return ShrinkWrap.create(WebArchive.class, \"CustomTypeTest.war\")\n            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n            .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\")\n            .addClasses(CustomType.class);\n    }\n\n    @Inject\n    private CustomType myMBean;\n\n    @Test\n    public void checkMBean() throws Exception\n    {\n        final MBeanServer server = ManagementFactory.getPlatformMBeanServer();\n        myMBean.setCounter(0);\n        assertEquals(0, myMBean.getCounter());\n        myMBean.setCounter(2);\n        final ObjectName on = new ObjectName(\"cat:type=and,name=fish\");\n        assertTrue(server.isRegistered(on));\n        assertEquals(2, server.getAttribute(on, \"counter\"));\n        myMBean.setCounter(5);\n        assertEquals(5, server.getAttribute(on, \"counter\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/MyMBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.core.api.jmx.JmxBroadcaster;\nimport org.apache.deltaspike.core.api.jmx.JmxManaged;\nimport org.apache.deltaspike.core.api.jmx.JmxParameter;\nimport org.apache.deltaspike.core.api.jmx.MBean;\nimport org.apache.deltaspike.core.api.jmx.Table;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport javax.management.Notification;\nimport java.util.HashMap;\nimport java.util.Map;\n\n@ApplicationScoped\n@MBean(description = \"my mbean\")\npublic class MyMBean\n{\n    @JmxManaged(description = \"get counter\")\n    private int counter = 0;\n\n    @Inject\n    private JmxBroadcaster broadcaster;\n\n    @JmxManaged\n    private Map<String, String> table;\n\n    @JmxManaged // just a marker to expose it as an attribute, will call the getter\n    private Table table2;\n\n    public Map<String, String> getTable() {\n        return table != null ? table : (table = new HashMap<String, String>() {{\n            put(\"key1\", \"value1\");\n            put(\"key2\", \"value2\");\n        }});\n    }\n\n    @JmxManaged\n    public Table getTable2() {\n        return new Table().withColumns(\"a\", \"b\", \"c\").withLine(\"1\", \"2\", \"3\").withLine(\"alpha\", \"beta\", \"gamma\");\n    }\n\n    public int getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(final int v)\n    {\n        counter = v;\n    }\n\n    public void resetTo(final int value)\n    {\n        counter = value;\n    }\n\n    @JmxManaged(description = \"multiply counter\")\n    public int multiply(@JmxParameter(name = \"multiplier\", description = \"the multiplier\") final int n)\n    {\n        return counter * n;\n    }\n\n    public void broadcast()\n    {\n        broadcaster.send(new Notification(String.class.getName(), this, 10L));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport jakarta.inject.Inject;\nimport javax.management.Attribute;\nimport javax.management.MBeanInfo;\nimport javax.management.MBeanOperationInfo;\nimport javax.management.MBeanParameterInfo;\nimport javax.management.MBeanServer;\nimport javax.management.Notification;\nimport javax.management.NotificationListener;\nimport javax.management.ObjectName;\nimport javax.management.openmbean.CompositeData;\nimport javax.management.openmbean.TabularData;\nimport java.lang.management.ManagementFactory;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Iterator;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic abstract class SimpleRegistrationTest {\n    private static MBeanServer server = ManagementFactory.getPlatformMBeanServer();\n\n    @Inject\n    private MyMBean myMBean;\n\n    @Test\n    public void checkMBean() throws Exception {\n        assertEquals(0, myMBean.getCounter());\n        myMBean.resetTo(2);\n        final ObjectName on = new ObjectName(\"org.apache.deltaspike:type=MBeans,name=\" + MyMBean.class.getName());\n        assertTrue(server.isRegistered(on));\n\n        assertEquals(2, server.getAttribute(on, \"counter\"));\n        assertEquals(6, server.invoke(on, \"multiply\", new Object[]{3}, new String[0]));\n\n        myMBean.resetTo(5);\n\n        assertEquals(5, server.getAttribute(on, \"counter\"));\n        assertEquals(20, server.invoke(on, \"multiply\", new Object[]{4}, new String[0]));\n\n        server.setAttribute(on, new Attribute(\"counter\", 10));\n        assertEquals(10, myMBean.getCounter());\n\n        final Collection<Notification> notifications = new ArrayList<Notification>();\n        server.addNotificationListener(on, new NotificationListener() {\n            @Override\n            public void handleNotification(final Notification notification, final Object handback) {\n                notifications.add(notification);\n            }\n        }, null, null);\n        myMBean.broadcast();\n        assertEquals(1, notifications.size());\n        assertEquals(10L, notifications.iterator().next().getSequenceNumber());\n\n        MBeanInfo mBeanInfo = server.getMBeanInfo(on);\n        Assert.assertNotNull(mBeanInfo);\n        MBeanOperationInfo[] operations = mBeanInfo.getOperations();\n        Assert.assertNotNull(operations);\n        Assert.assertTrue(operations.length > 0);\n        Assert.assertTrue(\"Empty Signature on operation: \" + operations[1], operations[1].getSignature().length > 0);\n        MBeanParameterInfo parameterInfo = operations[1].getSignature()[0];\n        assertEquals(\"multiplier\", parameterInfo.getName());\n        assertEquals(\"the multiplier\", parameterInfo.getDescription());\n\n        { // table support - through map\n            Object table = server.getAttribute(on, \"table\");\n            assertTrue(TabularData.class.isInstance(table));\n            final TabularData data = TabularData.class.cast(table);\n            assertEquals(1, data.size());\n            final CompositeData compositeData = CompositeData.class.cast(data.values().iterator().next());\n            assertEquals(2, compositeData.values().size());\n            assertEquals(\"value1\", compositeData.get(\"key1\"));\n            assertEquals(\"value2\", compositeData.get(\"key2\"));\n        }\n\n        { // table support - through Table\n            Object table = server.getAttribute(on, \"table2\");\n            assertTrue(TabularData.class.isInstance(table));\n            final TabularData data = TabularData.class.cast(table);\n            assertEquals(2, data.size());\n            final Iterator<?> iterator = data.values().iterator();\n            {\n                final CompositeData compositeData = CompositeData.class.cast(iterator.next());\n                assertEquals(3, compositeData.values().size());\n                assertEquals(\"1\", compositeData.get(\"a\"));\n                assertEquals(\"2\", compositeData.get(\"b\"));\n                assertEquals(\"3\", compositeData.get(\"c\"));\n            }\n            {\n                final CompositeData compositeData = CompositeData.class.cast(iterator.next());\n                assertEquals(3, compositeData.values().size());\n                assertEquals(\"alpha\", compositeData.get(\"a\"));\n                assertEquals(\"beta\", compositeData.get(\"b\"));\n                assertEquals(\"gamma\", compositeData.get(\"c\"));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.jmx;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class SimpleRegistrationWarFileTest extends SimpleRegistrationTest\n{\n    @Deployment\n    public static WebArchive deploy() {\n        String simpleName = SimpleRegistrationWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"simpleRegistrationTest.jar\")\n                .addPackage(SimpleRegistrationWarFileTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/lock/LockedTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.lock;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.atomic.AtomicReference;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\n\nimport org.apache.deltaspike.core.impl.lock.LockedInterceptor;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.descriptor.api.Descriptors;\nimport org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor;\n\n@RunWith(Arquillian.class)\npublic class LockedTest {\n    @Deployment\n    public static WebArchive deploy()\n    {\n        // create beans.xml with added interceptor\n        BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);\n        beans.getOrCreateInterceptors().clazz(LockedInterceptor.class.getName());\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"LockedTest.jar\")\n                .addPackage(Service.class.getPackage().getName())\n                .addAsManifestResource(new StringAsset(beans.exportAsString()), \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"LockedTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(new StringAsset(beans.exportAsString()), \"beans.xml\");\n    }\n\n    @Inject\n    private Service service;\n\n    @Test\n    public void simpleNotConcurrent()\n    {\n        final CountDownLatch synchro = new CountDownLatch(1);\n        final Thread writer = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                service.write(\"test\", \"value\");\n                synchro.countDown();\n            }\n        };\n\n        final CountDownLatch end = new CountDownLatch(1);\n        final AtomicReference<String> val = new AtomicReference<String>();\n        final Thread reader = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                try\n                {\n                    synchro.await(1, TimeUnit.MINUTES);\n                }\n                catch (final InterruptedException e)\n                {\n                    Thread.interrupted();\n                    fail();\n                }\n                val.set(service.read(\"test\"));\n                end.countDown();\n            }\n        };\n\n        reader.start();\n        writer.start();\n        try\n        {\n            end.await(1, TimeUnit.MINUTES);\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n        assertEquals(\"value\", val.get());\n    }\n\n    @Test\n    public void concurrentTimeout()\n    {\n        final AtomicBoolean doAgain = new AtomicBoolean(true);\n        final CountDownLatch endWriter = new CountDownLatch(1);\n        final Thread writer = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                while (doAgain.get())\n                {\n                    service.write(\"test\", \"value\");\n                    service.force();\n                }\n                endWriter.countDown();\n            }\n        };\n\n        final CountDownLatch endReader = new CountDownLatch(1);\n        final Thread reader = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                while (doAgain.get())\n                {\n                    try\n                    {\n                        service.read(\"test\");\n                    }\n                    catch (final IllegalStateException e)\n                    {\n                        doAgain.set(false);\n                    }\n                }\n                endReader.countDown();\n            }\n        };\n\n        reader.start();\n        writer.start();\n        try\n        {\n            endReader.await(1, TimeUnit.MINUTES);\n            endWriter.await(1, TimeUnit.MINUTES);\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n        assertEquals(\"value\", service.read(\"test\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/lock/Service.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.lock;\n\nimport org.apache.deltaspike.core.api.lock.Locked;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.TimeUnit;\n\nimport static org.apache.deltaspike.core.api.lock.Locked.Operation.WRITE;\nimport static org.junit.Assert.fail;\n\n@ApplicationScoped\npublic class Service {\n    private final Map<String, String> entries = new HashMap<String, String>();\n\n    @Locked(timeout = 1, timeoutUnit = TimeUnit.SECONDS)\n    public String read(final String k) {\n        return entries.get(k);\n    }\n\n    @Locked(timeout = 1, timeoutUnit = TimeUnit.SECONDS, operation = WRITE)\n    public void write(final String k, final String v) {\n        entries.put(k, v);\n    }\n\n    @Locked(operation = WRITE)\n    public void force() {\n        try {\n            Thread.sleep(TimeUnit.SECONDS.toMillis(5));\n        } catch (final InterruptedException e) {\n            Thread.interrupted();\n            fail();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/scope/window/DefaultWindowContextTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.scope.window;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.junit.Assert;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class DefaultWindowContextTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"defaultWindowContextTest.jar\")\n                .addPackage(DefaultWindowContextTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"defaultWindowContextTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Inject\n    private WindowContext windowContext;\n\n    @Inject\n    private SomeWindowScopedBean someWindowScopedBean;\n\n    /**\n     * Tests {@link org.apache.deltaspike.core.impl.util.JndiUtils#lookup(String, Class)} by looking up the {@link jakarta.enterprise.inject.spi.BeanManager}\n     */\n    @Test\n    public void testWindowScoedBean()\n    {\n        Assert.assertNotNull(windowContext);\n        Assert.assertNotNull(someWindowScopedBean);\n\n        {\n            windowContext.activateWindow(\"window1\");\n            someWindowScopedBean.setValue(\"Hans\");\n            Assert.assertEquals(\"Hans\", someWindowScopedBean.getValue());\n        }\n\n        // now we switch it away to another 'window'\n        {\n            windowContext.activateWindow(\"window2\");\n            Assert.assertNull(someWindowScopedBean.getValue());\n            someWindowScopedBean.setValue(\"Karl\");\n            Assert.assertEquals(\"Karl\", someWindowScopedBean.getValue());\n        }\n\n        // and now back to the first window\n        {\n            windowContext.activateWindow(\"window1\");\n\n            // which must still contain the old value\n            Assert.assertEquals(\"Hans\", someWindowScopedBean.getValue());\n        }\n\n        // and again back to the second window\n        {\n            windowContext.activateWindow(\"window2\");\n\n            // which must still contain the old value of the 2nd window\n            Assert.assertEquals(\"Karl\", someWindowScopedBean.getValue());\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/scope/window/SomeWindowScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.scope.window;\n\nimport java.io.Serializable;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\n\n/**\n * example bean for &#064;WindowScoped\n */\n@WindowScoped\npublic class SomeWindowScopedBean implements Serializable\n{\n    private String value;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/throttling/Service.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.throttling;\n\nimport org.apache.deltaspike.core.api.throttling.Throttled;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.TimeUnit;\n\nimport static org.junit.Assert.fail;\n\n@ApplicationScoped\npublic class Service\n{\n    private final Map<String, String> entries = new HashMap<String, String>();\n\n    @Throttled(timeout = 1, timeoutUnit = TimeUnit.SECONDS)\n    public String read(final String k)\n    {\n        return entries.get(k);\n    }\n\n    @Throttled(timeout = 1, timeoutUnit = TimeUnit.SECONDS)\n    public void write(final String k, final String v)\n    {\n        entries.put(k, v);\n    }\n\n    @Throttled\n    public void force()\n    {\n        try\n        {\n            Thread.sleep(TimeUnit.SECONDS.toMillis(5));\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/throttling/Service2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.throttling;\n\nimport org.apache.deltaspike.core.api.throttling.Throttled;\nimport org.apache.deltaspike.core.api.throttling.Throttling;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.ArrayList;\nimport java.util.Collection;\n\n@Throttling(permits = 2)\n@ApplicationScoped\npublic class Service2\n{\n    private final Collection<String> called = new ArrayList<String>();\n\n    @Throttled(timeout = 750)\n    public void call(final String k)\n    {\n        synchronized (called)\n        {\n            called.add(k);\n        }\n        try\n        {\n            Thread.sleep(1000);\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n        }\n    }\n\n    @Throttled(weight = 2)\n    public void heavy(final Runnable inTask)\n    {\n        inTask.run();\n        try\n        {\n            Thread.sleep(5000);\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n        }\n    }\n\n    public Collection<String> getCalled()\n    {\n        return called;\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/throttling/ThrottledTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.throttling;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport java.util.HashSet;\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.atomic.AtomicReference;\n\nimport static java.util.Arrays.asList;\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\nimport static org.hamcrest.CoreMatchers.instanceOf;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertThat;\nimport static org.junit.Assert.fail;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ThrottledTest {\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"ThrottledTest.jar\")\n                .addPackage(Service.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, \"ThrottledTest.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Inject\n    private Service service;\n\n    @Inject\n    private Service2 service2;\n\n    @Test\n    public void permits()\n    {\n        {// failling case now\n            final AtomicReference<Exception> failed = new AtomicReference<Exception>();\n            final CountDownLatch latch = new CountDownLatch(2);\n            final Thread[] concurrents = new Thread[]\n                    {\n                    new Thread()\n                    {\n                        @Override\n                        public void run()\n                        {\n                            service2.heavy(new Runnable()\n                            {\n                                @Override\n                                public void run()\n                                {\n                                    latch.countDown();\n                                }\n                            });\n                        }\n                    },\n                    new Thread()\n                    {\n                        @Override\n                        public void run()\n                        {\n                            try\n                            {\n                                latch.await();\n                            }\n                            catch (final InterruptedException e)\n                            {\n                                Thread.interrupted();\n                                fail();\n                            }\n                            try\n                            {\n                                service2.call(\"failed\");\n                                fail();\n                            }\n                            catch (final IllegalStateException ise)\n                            {\n                                failed.set(ise);\n                            }\n                        }\n                    }\n            };\n            for (final Thread t : concurrents)\n            {\n                t.start();\n            }\n            latch.countDown();\n            waitForThreads(concurrents);\n            assertNotNull(failed.get());\n            assertThat(failed.get(), instanceOf(IllegalStateException.class));\n        }\n        { // passing\n            final CountDownLatch latch = new CountDownLatch(1);\n            final Thread[] concurrents = new Thread[]\n                    {\n                    new Thread()\n                    {\n                        @Override\n                        public void run()\n                        {\n                            try\n                            {\n                                latch.await();\n                            }\n                            catch (final InterruptedException e)\n                            {\n                                Thread.interrupted();\n                                fail();\n                            }\n                            service2.call(\"1\");\n                        }\n                    },\n                    new Thread()\n                    {\n                        @Override\n                        public void run()\n                        {\n                            try\n                            {\n                                latch.await();\n                            }\n                            catch (final InterruptedException e)\n                            {\n                                Thread.interrupted();\n                                fail();\n                            }\n                            service2.call(\"2\");\n                        }\n                    }\n            };\n            for (final Thread t : concurrents)\n            {\n                t.start();\n            }\n            latch.countDown();\n            waitForThreads(concurrents);\n            assertEquals(new HashSet<String>(asList(\"1\", \"2\")), new HashSet<String>(service2.getCalled()));\n        }\n    }\n\n    private void waitForThreads(final Thread[] concurrents)\n    {\n        for (final Thread t : concurrents)\n        {\n            try\n            {\n                t.join();\n            }\n            catch (final InterruptedException e)\n            {\n                Thread.interrupted();\n                fail();\n            }\n        }\n    }\n\n    @Test\n    public void simpleNotConcurrent()\n    { // ~lock case\n        final CountDownLatch synchro = new CountDownLatch(1);\n        final Thread writer = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                service.write(\"test\", \"value\");\n                synchro.countDown();\n            }\n        };\n\n        final CountDownLatch end = new CountDownLatch(1);\n        final AtomicReference<String> val = new AtomicReference<String>();\n        final Thread reader = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                try\n                {\n                    synchro.await(1, TimeUnit.MINUTES);\n                }\n                catch (final InterruptedException e)\n                {\n                    Thread.interrupted();\n                    fail();\n                }\n                val.set(service.read(\"test\"));\n                end.countDown();\n            }\n        };\n\n        reader.start();\n        writer.start();\n        try\n        {\n            end.await(1, TimeUnit.MINUTES);\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n        assertEquals(\"value\", val.get());\n    }\n\n    @Test\n    public void concurrentTimeout()\n    {\n        final AtomicBoolean doAgain = new AtomicBoolean(true);\n        final CountDownLatch endWriter = new CountDownLatch(1);\n        final Thread writer = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                while (doAgain.get())\n                {\n                    service.write(\"test\", \"value\");\n                    service.force();\n                }\n                endWriter.countDown();\n            }\n        };\n\n        final CountDownLatch endReader = new CountDownLatch(1);\n        final Thread reader = new Thread()\n        {\n            @Override\n            public void run()\n            {\n                while (doAgain.get())\n                {\n                    try\n                    {\n                        service.read(\"test\");\n                    }\n                    catch (final IllegalStateException e)\n                    {\n                        doAgain.set(false);\n                    }\n                }\n                endReader.countDown();\n            }\n        };\n\n        reader.start();\n        writer.start();\n        try\n        {\n            endReader.await(1, TimeUnit.MINUTES);\n            endWriter.await(1, TimeUnit.MINUTES);\n        }\n        catch (final InterruptedException e)\n        {\n            Thread.interrupted();\n            fail();\n        }\n        assertEquals(\"value\", service.read(\"test\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.util;\n\nimport org.apache.deltaspike.core.impl.util.JndiUtils;\nimport org.junit.Test;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.util.Map;\n\nimport static org.junit.Assert.assertNotNull;\n\npublic abstract class JndiUtilsTest\n{\n    /**\n     * Tests {@link JndiUtils#lookup(String, Class)} by looking up the {@link BeanManager}\n     */\n    @Test\n    public void testLookup()\n    {\n        BeanManager beanManager = JndiUtils.lookup(\"java:comp/BeanManager\", BeanManager.class);\n        assertNotNull(\"JNDI lookup failed\", beanManager);\n    }\n\n    /**\n     * Tests {@link JndiUtils#list(String, Class)} by digging in java:comp namespace\n     */\n    @Test\n    public void testList()\n    {\n        Map<String, BeanManager> beanManager = JndiUtils.list(\"java:comp\", BeanManager.class);\n        assertNotNull(\"JNDI lookup failed\", beanManager);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.impl.util;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class JndiUtilsWarFileTest extends JndiUtilsTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = JndiUtilsWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"jndiTest.jar\")\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addPackage(JndiUtilsWarFileTest.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.util;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.core.api.util.context.DummyContext;\nimport org.apache.deltaspike.test.core.api.util.context.DummyScopeExtension;\nimport org.apache.deltaspike.test.core.api.util.context.DummyScoped;\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\n/**\n * This class contains helpers for building frequently used archives\n */\npublic class ArchiveUtils\n{\n    public static JavaArchive[] getDeltaSpikeCoreArchive()\n    {\n        return getDeltaSpikeCoreArchive(null);\n    }\n\n    public static JavaArchive[] getDeltaSpikeCoreArchive(String[] excludedPackagesOrFiles)\n    {\n        // we also need quite some internal Arquillian classes on the client side\n        // this JAR has NO beans.xml to prevent class scanning!\n        JavaArchive extensionsJar = ShrinkWrap\n                .create(JavaArchive.class, \"testExtensions.jar\")\n                .addClass(ArchiveUtils.class)\n                .addClass(DummyScopeExtension.class)\n                .addClass(DummyScoped.class)\n                .addClass(DummyContext.class)\n                .addPackage(WebProfileCategory.class.getPackage());\n\n        JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null,\n                \"META-INF/beans.xml\",\n                new String[]{\"org.apache.deltaspike.core\", \"org.apache.deltaspike.test.category\"},\n                excludedPackagesOrFiles,\n                \"ds-core\");\n\n        List<JavaArchive> archives = new ArrayList<JavaArchive>(Arrays.asList(coreArchives));\n        archives.add(extensionsJar);\n        return archives.toArray(new JavaArchive[archives.size()]);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/FileUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.util;\n\nimport java.io.File;\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\n/**\n * Some basic utils\n */\npublic class FileUtils\n{\n    private FileUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * @param url the target URL\n     * @return a file created based on the given URL\n     */\n    public static File getFileForURL(String url)\n    {\n        //fix for wls\n        if(!url.startsWith(\"file:/\")) {\n            url = \"file:/\" + url;\n        }\n\n        url = url.replaceAll(\"%20\", \" \");\n\n        try\n        {\n            return new File( (new URL(url)).getFile());\n        }\n        catch (MalformedURLException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/activation/EditableTestDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.util.activation;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class EditableTestDeactivator implements ClassDeactivator\n{\n    private static Map<Class<? extends Deactivatable>, Boolean> result = new HashMap<Class<? extends Deactivatable>, Boolean>();\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        return result.get(targetClass);\n    }\n\n    public static void activate(Class<? extends Deactivatable> classToActivate)\n    {\n        result.put(classToActivate, true);\n    }\n\n    public static void deactivate(Class<? extends Deactivatable> classToActivate)\n    {\n        result.put(classToActivate, false);\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/activation/ProjectStageDependentClassDeactivationTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.util.activation;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class ProjectStageDependentClassDeactivationTest\n{\n    @Test\n    public void deactivationResultInProjectStageUnitTest()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n\n        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;\n        EditableTestDeactivator.activate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));\n\n        EditableTestDeactivator.deactivate(classToCheck);\n        Assert.assertEquals(false, ClassDeactivationUtils.isActivated(classToCheck));\n    }\n\n    @Test\n    public void deactivationResultInProjectStageDevelopment()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.Development);\n\n        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;\n        EditableTestDeactivator.activate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));\n\n        EditableTestDeactivator.deactivate(classToCheck);\n        Assert.assertEquals(false, ClassDeactivationUtils.isActivated(classToCheck));\n    }\n\n    @Test\n    public void deactivationResultInProjectStageProduction()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.Production);\n\n        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;\n        EditableTestDeactivator.activate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));\n\n        EditableTestDeactivator.deactivate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result\n    }\n\n    @Test\n    public void deactivationResultInProjectStageIntegrationTest()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.IntegrationTest);\n\n        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;\n        EditableTestDeactivator.activate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));\n\n        EditableTestDeactivator.deactivate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result\n    }\n\n    @Test\n    public void deactivationResultInProjectStageStaging()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.Staging);\n\n        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;\n        EditableTestDeactivator.activate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));\n\n        EditableTestDeactivator.deactivate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result\n    }\n\n    @Test\n    public void deactivationResultInProjectStageSystemTest()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.SystemTest);\n\n        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;\n        EditableTestDeactivator.activate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));\n\n        EditableTestDeactivator.deactivate(classToCheck);\n        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result\n    }\n\n    private static class TestDeactivatable implements Deactivatable\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# by providing an application name we trigger the JMX registration!\ndeltaspike.application.name=ds-config-core-impl-tests\n\ntestProperty03=test_value_03\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.test.core.impl.activation.TestClassDeactivator\ntestProperty02=test_value_02\ndb=prodDB\n\ntestDbConfig=some setting for ${db}\n\nglobalAlternatives.org.apache.deltaspike.test.core.api.alternative.global.BaseBean1=org.apache.deltaspike.test.core.api.alternative.global.SubBaseBean2\nglobalAlternatives.org.apache.deltaspike.test.core.api.alternative.global.BaseInterface1=org.apache.deltaspike.test.core.api.alternative.global.BaseInterface1AlternativeImplementation\n\nglobalAlternatives.org.apache.deltaspike.test.core.api.alternative.global.qualifier.BaseInterface=org.apache.deltaspike.test.core.api.alternative.global.qualifier.AlternativeBaseBeanB\n\nconfigProperty1=14\nconfigProperty2=7\n\nconfigPropertyTrue1=Yes\nconfigPropertyTrue2=yes\nconfigPropertyTrue3=YES\nconfigPropertyTrue4=Y\nconfigPropertyTrue5=JA\nconfigPropertyTrue6=OUI\nconfigPropertyTrue7=True\nconfigPropertyTrue8=1\n\n# NumberConfig\npropertyFloat=123.45\n\n\nmy.very.secret=onlyIDoKnowIt\n\ndeactivate.org.apache.deltaspike.test.core.impl.activation.DeactivatedClass=true\n\nurlListFromProperties = http://127.0.0.2\n\nprefix.suffix = done\n\n# test project stage aware replacement mechanism\n# Attention: Depending on whether another test did already run we might get\n# ProjectStage Production or UnitTest. So we set the same value for both now\nmyapp.login.hostname=http://myapp\nmyapp.login.hostname.Production=https://myapp\nmyapp.login.hostname.UnitTest=https://myapp\nmyapp.login.url=${myapp.login.hostname}/login.xhtml\n\n# tree based configuration\nmyapp.some.server.host=myserver\nmyapp.some.server.port=80\nmyapp.some.server.path=/myapp/endpoint1\nmyapp.other.server.host=otherserver\nmyapp.other.server.port=443\nmyapp.other.server.path=/otherapp/endpoint2\n\n# for InterDynTest\n# We need to configure this here for in-process Arquillian containers like OWB and Weld,\n# and additionally via @Deployment for container based Arquillians\ndeltaspike.interdyn.enabled=true\ndeltaspike.interdyn.rule.1.match=org\\\\.apache\\\\.deltaspike\\\\.test\\\\.core\\\\.impl\\\\.interdyn\\\\.Some.*Service\ndeltaspike.interdyn.rule.1.annotation=org.apache.deltaspike.core.api.monitoring.InvocationMonitored\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# registers the DummyScope for the AbstractContextTest\norg.apache.deltaspike.test.core.api.util.context.DummyScopeExtension\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.config.PropertyFileConfig",
    "content": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\n\n# dummy PropertyFileConfig which gets picked up at boot time\norg.apache.deltaspike.test.core.api.config.propertyconfigsource.MyCustomBootTimePropertyFileConfig"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# Test file to register a test ProjectStageHolder which contains\n# a few additional ProjectStages\norg.apache.deltaspike.test.core.api.projectstage.TestProjectStages\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigFilter",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.core.api.config.SecretTestConfigFilter"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource",
    "content": "#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n\norg.apache.deltaspike.test.core.api.config.TestConfigSource\norg.apache.deltaspike.test.core.api.config.ConfigurableTestConfigSource"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.core.api.config.TestConfigSourceProvider\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/application.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<application xmlns=\"http://java.sun.com/xml/ns/javaee\"\n             xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n             xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd\"\n             version=\"6\">\n    <module>\n        <ejb>ejb-jar.jar</ejb>\n    </module>\n    <module>\n        <web>\n            <web-uri>test.war</web-uri>\n            <context-root>test</context-root>\n        </web>\n    </module>\n    <library-directory>lib</library-directory>\n</application>"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/customMinimalMessage_en.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nsayHello=Hello %s\ntext=Text\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/myboottimeconfig.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# a user defined property file which is available during container boot already\n\ndeltaspike_ordinal = 120\n\nsome.boottimekey = correctvalue\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/myconfig.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# a user defined property file\n\nsome.propertykey = somevalue\n\nsome.boottimekey = wrongvalue\n\nconfigproperty.test.string = stringValue\nconfigproperty.test.string.UnitTest = psAwareStringValue\nconfigproperty.test.string.paramvalue.UnitTest = parameterizedPsAwareStringValue\nconfigproperty.test.param = paramvalue\nconfigproperty.test.boolean = false\nconfigproperty.test.class = org.apache.deltaspike.test.core.api.config.propertyconfigsource.MyBean\nconfigproperty.test.int = 5\nconfigproperty.test.long = 8589934592\nconfigproperty.test.float = -1.1\nconfigproperty.test.double = 4e40\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/mynotpickedupconfig.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# a user defined property file which is not being activated at all\n\ndeltaspike_ordinal = 130\n\nsome.boottimekey = this value should not get picked up at all!\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/org/apache/deltaspike/test/core/api/message/MessageFormattedMessage.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nwelcomeTo = Welcome to {0}\nincomeSinceDays = The income since {0} days is {1}\ncommitsInProject = At {0,time} on {0,date}, project {1} had {2,number,integer} commits.\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/org/apache/deltaspike/test/core/api/message/MinimalMessages_en.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nsayHello=Hello %s\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/org/apache/deltaspike/test/core/api/message/TestMessages_de.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nhello=Test Nachricht an %s\n"
  },
  {
    "path": "deltaspike/core/impl/src/test/resources/org/apache/deltaspike/test/core/api/message/TestMessages_en.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nwelcome_to=Welcome to %s\nwelcome_to_deltaspike=Welcome to DeltaSpike\n\nhello=test message to %s\n\ncategoryMessage=Value %s was set\ncategoryMessage_longText=The value of the property has been set to %s.\n"
  },
  {
    "path": "deltaspike/core/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>parent-code</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../parent/code/pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.core</groupId>\n    <artifactId>core-project</artifactId>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Core</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n\n</project>\n\n"
  },
  {
    "path": "deltaspike/dist/bom/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.distribution</groupId>\n        <artifactId>distributions-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.distribution</groupId>\n    <artifactId>distributions-bom</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Distribution Bill of Materials</name>\n\n    <properties>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n        <maven.compiler.source>11</maven.compiler.source>\n        <maven.compiler.target>11</maven.compiler.target>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>org.apache.deltaspike.core</groupId>\n                <artifactId>deltaspike-core-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.core</groupId>\n                <artifactId>deltaspike-core-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-security-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-security-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jpa-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jpa-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jsf-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jsf-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-data-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-data-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <!-- Dependencies for Java-SE -->\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-owb</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-weld</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-openejb</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-partial-bean-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-partial-bean-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-test-control-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-test-control-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-scheduler-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-scheduler-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-proxy-module-api</artifactId>\n                <version>${project.version}</version>\n                <scope>compile</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-proxy-module-impl-asm</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n</project>\n"
  },
  {
    "path": "deltaspike/dist/full/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.distribution</groupId>\n        <artifactId>distributions-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>distribution-full</artifactId>\n    <packaging>pom</packaging>\n    <name>Apache DeltaSpike Full Distribution</name>\n\n    <properties>\n        <noAssembly>true</noAssembly>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-data-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-data-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <!-- Dependencies for Java-SE -->\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-owb</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-weld</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-openejb</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-partial-bean-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-partial-bean-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-test-control-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-test-control-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-scheduler-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-scheduler-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-proxy-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-proxy-module-impl-asm</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n    </dependencies>\n\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-assembly-plugin</artifactId>\n                <version>3.2.0</version>\n                <executions>\n                    <execution>\n                        <id>assemble</id>\n                        <phase>package</phase>\n                        <goals>\n                            <goal>single</goal>\n                        </goals>\n                        <configuration>\n                            <skipAssembly>${noAssembly}</skipAssembly>\n                            <descriptors>\n                                <descriptor>src/main/distribution/assembly.xml</descriptor>\n                            </descriptors>\n                            <appendAssemblyId>false</appendAssemblyId>\n                            <finalName>deltaspike-full-${project.version}</finalName>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n\n    <profiles>\n        <profile>\n            <!-- for quickly building a local distrbution package -->\n            <id>distribution</id>\n            <properties>\n                <noAssembly>false</noAssembly>\n            </properties>\n        </profile>\n\n        <profile>\n            <id>apache-release</id>\n            <properties>\n                <noAssembly>false</noAssembly>\n            </properties>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-install-plugin</artifactId>\n                        <configuration>\n                            <createChecksum>true</createChecksum>\n                        </configuration>\n                    </plugin>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-gpg-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>sign-artifacts</id>\n                                <phase>verify</phase>\n                                <goals>\n                                    <goal>sign</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n    </profiles>\n\n\n</project>\n"
  },
  {
    "path": "deltaspike/dist/full/src/main/distribution/assembly.xml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<assembly xmlns=\"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2\"\n          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n          xsi:schemaLocation=\"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd\">\n  <id>distribution</id>\n  <formats>\n    <format>zip</format>\n    <format>tar.gz</format>\n  </formats>\n  <fileSets>\n    <fileSet>\n      <directory>${project.basedir}/../..</directory>\n      <includes>\n        <include>README*</include>\n        <include>LICENSE*</include>\n        <include>NOTICE*</include>\n      </includes>\n      <outputDirectory>.</outputDirectory>\n      <useDefaultExcludes>true</useDefaultExcludes>\n    </fileSet>\n  </fileSets>\n    <dependencySets>\n        <dependencySet>\n            <includes>\n                <include>org.apache.deltaspike.modules:*</include>\n            </includes>\n            <outputFileNameMapping>${artifact.artifactId}-${project.version}.${artifact.extension}</outputFileNameMapping>\n            <outputDirectory>modules</outputDirectory>\n        </dependencySet>\n        <dependencySet>\n            <includes>\n                <include>org.apache.deltaspike.core:*</include>\n            </includes>\n            <outputFileNameMapping>${artifact.artifactId}-${project.version}.${artifact.extension}</outputFileNameMapping>\n            <outputDirectory>core</outputDirectory>\n        </dependencySet>\n        <dependencySet>\n            <includes>\n                <include>org.apache.deltaspike.cdictrl:*</include>\n            </includes>\n            <outputFileNameMapping>${artifact.artifactId}-${project.version}.${artifact.extension}</outputFileNameMapping>\n            <outputDirectory>cdictrl</outputDirectory>\n        </dependencySet>\n    </dependencySets>\n    <files>\n        <file>\n            <source>src/main/distribution/core-module.xml</source>\n            <outputDirectory>core</outputDirectory>\n            <destName>module.xml</destName>\n            <filtered>true</filtered>\n        </file>\n        <file>\n            <source>src/main/distribution/cdictrl-module.xml</source>\n            <outputDirectory>cdictrl</outputDirectory>\n            <destName>module.xml</destName>\n            <filtered>true</filtered>\n        </file>\n        <file>\n            <source>src/main/distribution/modules-module.xml</source>\n            <outputDirectory>modules</outputDirectory>\n            <destName>module.xml</destName>\n            <filtered>true</filtered>\n        </file>\n    </files>\n</assembly>\n"
  },
  {
    "path": "deltaspike/dist/full/src/main/distribution/cdictrl-module.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<module xmlns=\"urn:jboss:module:1.1\" name=\"org.apache.deltaspike.cdictrl\">\n    <resources>\n        <resource-root path=\"deltaspike-cdictrl-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-cdictrl-weld-${project.version}.jar\"/>\n    </resources>\n\n    <dependencies>\n        <module name=\"org.apache.deltaspike.core\"/>\n        <module name=\"javaee.api\"/>\n        <module name=\"javax.api\"/>\n    </dependencies>\n</module>\n\n"
  },
  {
    "path": "deltaspike/dist/full/src/main/distribution/core-module.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<module xmlns=\"urn:jboss:module:1.1\" name=\"org.apache.deltaspike.core\">\n    <resources>\n        <resource-root path=\"deltaspike-core-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-core-impl-${project.version}.jar\"/>\n    </resources>\n\n    <dependencies>\n        <module name=\"javaee.api\"/>\n        <module name=\"javax.api\"/>\n    </dependencies>\n</module>\n\n"
  },
  {
    "path": "deltaspike/dist/full/src/main/distribution/modules-module.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<module xmlns=\"urn:jboss:module:1.1\" name=\"org.apache.deltaspike.modules\">\n    <resources>\n        <resource-root path=\"deltaspike-bean-validation-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-bean-validation-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-data-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-data-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-jpa-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-jpa-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-jsf-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-jsf-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-jsf-module-impl-ee6-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-partial-bean-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-partial-bean-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-proxy-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-proxy-module-impl-asm-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-security-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-security-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-servlet-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-servlet-module-impl-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-scheduler-module-api-${project.version}.jar\"/>\n        <resource-root path=\"deltaspike-scheduler-module-impl-${project.version}.jar\"/>\n    </resources>\n\n    <dependencies>\n        <module name=\"org.apache.deltaspike.core\"/>\n        <module name=\"javaee.api\"/>\n        <module name=\"javax.api\"/>\n    </dependencies>\n</module>\n\n"
  },
  {
    "path": "deltaspike/dist/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>deltaspike-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.distribution</groupId>\n    <artifactId>distributions-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Distribution</name>\n\n\n    <modules>\n        <module>bom</module>\n        <module>full</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/examples/data-examples/README.md",
    "content": "Notice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n           \nData Module for DeltaSpike\n==========================\nThis example shows:\n\n1, how to use JPA in deltaspike;\n2, how to use the Data module for repositories;\n3, the function of @Transactional, how @Transactional save entity automatically. \n"
  },
  {
    "path": "deltaspike/examples/data-examples/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-data-examples</artifactId>\n\n    <name>Apache DeltaSpike Data Examples</name>\n\n    <packaging>war</packaging>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n    </properties>\n\n    <dependencies>\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-data-module-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-data-module-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.tomee</groupId>\n            <artifactId>jakartaee-api</artifactId>\n        </dependency>\n        \n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n        \n    </dependencies>\n\n    <build>\n        <finalName>${project.artifactId}</finalName>\n    </build>\n</project>\n\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/Article.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport java.io.Serializable;\nimport java.util.Date;\nimport jakarta.persistence.Column;\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.Table;\nimport jakarta.persistence.Temporal;\nimport jakarta.persistence.TemporalType;\n\n@Entity\n@Table(name = \"articles\")\npublic class Article implements Serializable\n{\n\n    private static final long serialVersionUID = 1L;\n\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    private String title;\n    private String content;\n\n    @Temporal(TemporalType.TIMESTAMP)\n    @Column(name = \"time_created\")\n    private Date date;\n\n    // A must have!\n    public Article()\n    {\n        // this form used by Hibernate\n    }\n\n    public Article(String title, Date date)\n    {\n        // for application use, to create new articles\n        this.title = title;\n        this.date = date;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    private void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public Date getDate()\n    {\n        return date;\n    }\n\n    public void setDate(Date date)\n    {\n        this.date = date;\n    }\n\n    public String getTitle()\n    {\n        return title;\n    }\n\n    public void setTitle(String title)\n    {\n        this.title = title;\n    }\n\n    public String getContent()\n    {\n        return content;\n    }\n\n    public void setContent(String content)\n    {\n        this.content = content;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"Article{\" + \"id=\" + id + \", title=\" + title + \", content=\" + content + \", date=\" + date + '}';\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/ArticleController.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport java.io.Serializable;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.logging.Logger;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.view.ViewScoped;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\nimport jakarta.transaction.Transactional;\n\n@Named\n@ViewScoped\n@Transactional\npublic class ArticleController implements Serializable\n{\n\n    private Article article = new Article();\n\n    @Inject\n    private Logger log;\n\n    @Inject\n    private ArticleRepository articleRepository;\n    \n    @Inject\n    private FacesContext facesContext;\n    \n    @HttpParam(\"aid\") \n    @Inject\n    private String aid; // article id\n\n    public Article getArticle()\n    {\n        return article;\n    }\n\n    public void setArticle(Article article)\n    {\n        this.article = article;\n    }\n\n    public Article findArticleById(Long id)\n    {\n        article = articleRepository.findBy(id);\n        return article;\n    }\n\n    \n    public String persist()\n    {\n        article.setDate(new Date());\n        articleRepository.save(this.article);\n        facesContext.addMessage(null, new FacesMessage(\"article:\" + article.getTitle() + \" persisted\"));\n        return \"persisted\";\n    }\n\n    public String delete(Article article)\n    {\n        articleRepository.remove(article);\n        facesContext.addMessage(null, new FacesMessage(\"article:\" + article.getTitle() + \" deleted\"));\n        return \"deleted\";\n    }\n\n    public List<Article> getAllArticles()\n    {\n        return articleRepository.findAll();\n    }\n    \n    public void loadArticle() \n    {\n        if (aid != null)\n        {\n            this.article = findArticleById(Long.valueOf(aid));\n        }\n    }\n    \n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/ArticleRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.example;\n\nimport org.apache.deltaspike.data.api.EntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\n\n@Repository\npublic interface ArticleRepository extends EntityRepository<Article, Long>\n{\n\n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/HttpParam.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({ METHOD, FIELD, PARAMETER, TYPE })\npublic @interface HttpParam \n{\n    @Nonbinding String value();\n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/HttpParams.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.servlet.ServletRequest;\n\npublic class HttpParams\n{\n\n    @Produces\n    @HttpParam(\"\")\n    String getParamValue(InjectionPoint ip)\n    {\n        ServletRequest request = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();\n        return request.getParameter(ip.getAnnotated().getAnnotation(HttpParam.class).value());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/LogProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport java.util.logging.Logger;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\npublic class LogProducer\n{\n\n    @Produces\n    Logger createLogger(final InjectionPoint ip)\n    {\n        return Logger.getLogger(ip.getMember().getDeclaringClass().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/java/org/apache/deltaspike/example/Resources.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.faces.context.FacesContext;\n\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.PersistenceUnit;\n\n@ApplicationScoped\npublic class Resources\n{\n\n    @PersistenceUnit\n    private EntityManagerFactory entityManagerFactory;\n\n    @Produces\n    @Default\n    @RequestScoped\n    public EntityManager create()\n    {\n        return this.entityManagerFactory.createEntityManager();\n    }\n\n    public void dispose(@Disposes @Default EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n\n    @Produces\n    @RequestScoped\n    public FacesContext produceFacesContext()\n    {\n        return FacesContext.getCurrentInstance();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nglobalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/resources/META-INF/persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\"\n             xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n             xsi:schemaLocation=\"\n        http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"primary\" transaction-type=\"JTA\">\n        <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>\n        <class>org.apache.deltaspike.example.Article</class>\n\n        <properties>\n            <property name=\"hibernate.hbm2ddl.auto\" value=\"create\" />\n            <property name=\"hibernate.show_sql\" value=\"true\" />\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/webapp/WEB-INF/faces-config.xml",
    "content": "<?xml version='1.0' encoding='UTF-8'?>\n<!--\n~ Licensed to the Apache Software Foundation (ASF) under one\n~ or more contributor license agreements. See the NOTICE file\n~ distributed with this work for additional information\n~ regarding copyright ownership. The ASF licenses this file\n~ to you under the Apache License, Version 2.0 (the\n~ \"License\"); you may not use this file except in compliance\n~ with the License. You may obtain a copy of the License at\n~\n~ http://www.apache.org/licenses/LICENSE-2.0\n~\n~ Unless required by applicable law or agreed to in writing,\n~ software distributed under the License is distributed on an\n~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n~ KIND, either express or implied. See the License for the\n~ specific language governing permissions and limitations\n~ under the License.\n-->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n    <navigation-rule>\n        <from-view-id>/add.xhtml</from-view-id>\n        <navigation-case>\n            <from-outcome>persisted</from-outcome>\n            <to-view-id>/list.xhtml</to-view-id>\n            <redirect />\n        </navigation-case>\n    </navigation-rule>    \n\n    <navigation-rule>\n        <from-view-id>/list.xhtml</from-view-id>\n        <navigation-case>\n            <from-outcome>deleted</from-outcome>\n            <to-view-id>/list.xhtml</to-view-id>\n        </navigation-case>\n    </navigation-rule>    \n\n</faces-config>"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <context-param>\n        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>\n        <param-value>.xhtml</param-value>\n    </context-param>\n\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n\n    <welcome-file-list>\n        <welcome-file>index.xhtml</welcome-file>\n    </welcome-file-list>\n</web-app>"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/webapp/add.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n-->\n<!DOCTYPE html\n    PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://xmlns.jcp.org/jsf/core\">\n    <f:metadata>\n        <f:viewAction action=\"#{articleController.loadArticle}\"/>\n    </f:metadata>\n\n    <h:head>\n        <title>Simple JPA  page</title>\n    </h:head>\n\n    <h:body>\n        <h1>#{empty(articleController.article.id) ? 'Add New ' : 'Edit '}Article</h1>\n        <h:form>\n            <h:panelGrid columns=\"2\">\n                <h:outputLabel value=\"title:\" for=\"title\"/>\n                <h:inputText id=\"title\" value=\"#{articleController.article.title}\" size=\"20\"/>\n\n                <h:outputLabel value=\"content:\" for=\"content\"/>\n                <h:inputTextarea id=\"content\" value=\"#{articleController.article.content}\" cols=\"20\" rows=\"5\"/>\n\n                <h:commandButton value=\"#{empty(articleController.article.id) ? 'Add New ' : 'Edit '}Article\" \n                                 action=\"#{articleController.persist}\"/>\n            </h:panelGrid>\n        </h:form>\n\n    </h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/webapp/index.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n-->\n<!DOCTYPE html\n    PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n\n    <h:head>\n        <title>Simple Data Module page</title>\n    </h:head>\n\n    <h:body>\n        <h1>Deltaspike Data module examples</h1>\n        <h:link value=\">>Add new article\" outcome=\"add.xhtml\" />\n        <br />\n        <h:link value=\">>article list\" outcome=\"list.xhtml\" />\n        <br />\n    </h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/data-examples/src/main/webapp/list.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n-->\n<!DOCTYPE html\n    PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n\n    <h:head>\n        <title>Simple JPA  page</title>\n    </h:head>\n\n    <h:body>\n        <h1>Article List</h1>\n        <h:messages style=\"color:red\"/>\n\n        <h:form>\n            <h:dataTable value=\"#{articleController.allArticles}\" var=\"article\" border=\"1\">\n                <h:column>\n                    <f:facet name=\"header\">ID</f:facet>\n                    <h:outputText value=\"#{article.id}\"/>\n                </h:column>\n                <h:column>\n                    <f:facet name=\"header\">title</f:facet>\n                    <h:outputText value=\"#{article.title}\"/>\n                </h:column>\n                <h:column>\n                    <f:facet name=\"header\">date</f:facet>\n                    <h:outputText value=\"#{article.date}\"/>\n                </h:column>\n                <h:column>\n                    <f:facet name=\"header\">operation</f:facet>\n                    <h:link value=\"edit\" outcome=\"add.xhtml\">\n                        <f:param name=\"aid\" value=\"#{article.id}\"/>\n                    </h:link>\n                    #{' '}\n                    <h:commandLink value=\"delete\" action=\"#{articleController.delete(article)}\"/>\n                </h:column>\n            </h:dataTable>\n        </h:form>\n\n        <h:link value=\">>add new article\" outcome=\"add.xhtml\"/>\n    </h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jpa-examples/README.md",
    "content": "Notice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n           \nJPA support in deltaspike\n=========================\nThis example shows:\n\n1, how to use JPA in deltaspike;\n2, the function of @Transactional, how @Transactional save entity automatically. \n\nBUT, this example is not involved in deltaspike Data module, please see data-playground example for deltaspike data module.\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-jpa-examples</artifactId>\n\n    <name>Apache DeltaSpike JPA Examples</name>\n\n    <packaging>war</packaging>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n    </properties>\n\n    <dependencies>\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-impl</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.tomee</groupId>\n            <artifactId>jakartaee-api</artifactId>\n        </dependency>\n        \n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n        \n    </dependencies>\n\n    <build>\n        <finalName>${project.artifactId}</finalName>\n    </build>\n</project>\n\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/java/org/apache/deltaspike/example/Article.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport java.io.Serializable;\nimport java.util.Date;\nimport jakarta.persistence.Column;\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.Table;\nimport jakarta.persistence.Temporal;\nimport jakarta.persistence.TemporalType;\n\n@Entity\n@Table(name = \"articles\")\npublic class Article implements Serializable\n{\n\n    private static final long serialVersionUID = 1L;\n\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    private String title;\n    private String content;\n\n    @Temporal(TemporalType.TIMESTAMP)\n    @Column(name = \"time_created\")\n    private Date date;\n\n    // A must have!\n    public Article()\n    {\n        // this form used by Hibernate\n    }\n\n    public Article(String title, Date date)\n    {\n        // for application use, to create new articles\n        this.title = title;\n        this.date = date;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    private void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public Date getDate()\n    {\n        return date;\n    }\n\n    public void setDate(Date date)\n    {\n        this.date = date;\n    }\n\n    public String getTitle()\n    {\n        return title;\n    }\n\n    public void setTitle(String title)\n    {\n        this.title = title;\n    }\n\n    public String getContent()\n    {\n        return content;\n    }\n\n    public void setContent(String content)\n    {\n        this.content = content;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"Article{\" + \"id=\" + id + \", title=\" + title + \", content=\" + content + \", date=\" + date + '}';\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/java/org/apache/deltaspike/example/ArticleController.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport java.io.Serializable;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.logging.Logger;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.view.ViewScoped;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\nimport jakarta.persistence.EntityManager;\nimport jakarta.transaction.Transactional;\n\n@Named\n@ViewScoped\n@Transactional\npublic class ArticleController implements Serializable\n{\n\n    private Article article = new Article();\n\n    @Inject\n    private Logger log;\n\n    @Inject\n    private EntityManager em;\n    \n    @Inject\n    private FacesContext facesContext;\n    \n    @HttpParam(\"aid\") \n    @Inject\n    private String aid; // article id\n\n    public Article getArticle()\n    {\n        return article;\n    }\n\n    public void setArticle(Article article)\n    {\n        this.article = article;\n    }\n\n    public Article findArticleById(Long id)\n    {\n        article = em.find(Article.class, id);\n        return article;\n    }\n\n    \n    public String persist()\n    {\n        article.setDate(new Date());\n        em.merge(this.article);\n        facesContext.addMessage(null, new FacesMessage(\"article:\" + article.getTitle() + \" persisted\"));\n        return \"persisted\";\n    }\n\n    public String delete(Article article)\n    {\n        em.remove(article);\n        facesContext.addMessage(null, new FacesMessage(\"article:\" + article.getTitle() + \" deleted\"));\n        return \"deleted\";\n    }\n\n    public List<Article> getAllArticles()\n    {\n        return em.createQuery(\"from Article a order by a.id desc\").getResultList();\n    }\n    \n    public void loadArticle() \n    {\n        if (aid != null)\n        {\n            this.article = findArticleById(Long.valueOf(aid));\n        }\n    }\n    \n}\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/java/org/apache/deltaspike/example/HttpParam.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({ METHOD, FIELD, PARAMETER, TYPE })\npublic @interface HttpParam \n{\n    @Nonbinding String value();\n}\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/java/org/apache/deltaspike/example/HttpParams.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.servlet.ServletRequest;\n\npublic class HttpParams\n{\n\n    @Produces\n    @HttpParam(\"\")\n    String getParamValue(InjectionPoint ip)\n    {\n        ServletRequest request = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();\n        return request.getParameter(ip.getAnnotated().getAnnotation(HttpParam.class).value());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/java/org/apache/deltaspike/example/LogProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport java.util.logging.Logger;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\npublic class LogProducer\n{\n\n    @Produces\n    Logger createLogger(final InjectionPoint ip)\n    {\n        return Logger.getLogger(ip.getMember().getDeclaringClass().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/java/org/apache/deltaspike/example/Resources.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.faces.context.FacesContext;\n\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.PersistenceUnit;\n\n@ApplicationScoped\npublic class Resources\n{\n\n    @PersistenceUnit\n    private EntityManagerFactory entityManagerFactory;\n\n    @Produces\n    @Default\n    @RequestScoped\n    public EntityManager create()\n    {\n        return this.entityManagerFactory.createEntityManager();\n    }\n\n    public void dispose(@Disposes @Default EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n\n    @Produces\n    @RequestScoped\n    public FacesContext produceFacesContext()\n    {\n        return FacesContext.getCurrentInstance();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/resources/META-INF/persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\"\n             xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n             xsi:schemaLocation=\"\n        http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"primary\" transaction-type=\"JTA\">\n        <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>\n        <class>org.apache.deltaspike.example.Article</class>\n\n        <properties>\n            <property name=\"hibernate.hbm2ddl.auto\" value=\"create\" />\n            <property name=\"hibernate.show_sql\" value=\"true\" />\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/webapp/WEB-INF/faces-config.xml",
    "content": "<?xml version='1.0' encoding='UTF-8'?>\n<!--\n~ Licensed to the Apache Software Foundation (ASF) under one\n~ or more contributor license agreements. See the NOTICE file\n~ distributed with this work for additional information\n~ regarding copyright ownership. The ASF licenses this file\n~ to you under the Apache License, Version 2.0 (the\n~ \"License\"); you may not use this file except in compliance\n~ with the License. You may obtain a copy of the License at\n~\n~ http://www.apache.org/licenses/LICENSE-2.0\n~\n~ Unless required by applicable law or agreed to in writing,\n~ software distributed under the License is distributed on an\n~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n~ KIND, either express or implied. See the License for the\n~ specific language governing permissions and limitations\n~ under the License.\n-->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n    <navigation-rule>\n        <from-view-id>/add.xhtml</from-view-id>\n        <navigation-case>\n            <from-outcome>persisted</from-outcome>\n            <to-view-id>/list.xhtml</to-view-id>\n            <redirect />\n        </navigation-case>\n    </navigation-rule>    \n\n    <navigation-rule>\n        <from-view-id>/list.xhtml</from-view-id>\n        <navigation-case>\n            <from-outcome>deleted</from-outcome>\n            <to-view-id>/list.xhtml</to-view-id>\n        </navigation-case>\n    </navigation-rule>    \n\n</faces-config>"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <context-param>\n        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>\n        <param-value>.xhtml</param-value>\n    </context-param>\n\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n\n    <welcome-file-list>\n        <welcome-file>index.xhtml</welcome-file>\n    </welcome-file-list>\n</web-app>"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/webapp/add.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n-->\n<!DOCTYPE html\n    PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://xmlns.jcp.org/jsf/core\">\n    <f:metadata>\n        <f:viewAction action=\"#{articleController.loadArticle}\"/>\n    </f:metadata>\n\n    <h:head>\n        <title>Simple JPA  page</title>\n    </h:head>\n\n    <h:body>\n        <h1>#{empty(articleController.article.id) ? 'Add New ' : 'Edit '}Article</h1>\n        <h:form>\n            <h:panelGrid columns=\"2\">\n                <h:outputLabel value=\"title:\" for=\"title\"/>\n                <h:inputText id=\"title\" value=\"#{articleController.article.title}\" size=\"20\"/>\n\n                <h:outputLabel value=\"content:\" for=\"content\"/>\n                <h:inputTextarea id=\"content\" value=\"#{articleController.article.content}\" cols=\"20\" rows=\"5\"/>\n\n                <h:commandButton value=\"#{empty(articleController.article.id) ? 'Add New ' : 'Edit '}Article\" \n                                 action=\"#{articleController.persist}\"/>\n            </h:panelGrid>\n        </h:form>\n\n    </h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/webapp/index.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n-->\n<!DOCTYPE html\n    PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n\n    <h:head>\n        <title>Simple JPA  page</title>\n    </h:head>\n\n    <h:body>\n        <h1>Deltaspike JPA module examples</h1>\n        <h:link value=\">>Add new article\" outcome=\"add.xhtml\" />\n        <br />\n        <h:link value=\">>article list\" outcome=\"list.xhtml\" />\n        <br />\n    </h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jpa-examples/src/main/webapp/list.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n-->\n<!DOCTYPE html\n    PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n\n    <h:head>\n        <title>Simple JPA  page</title>\n    </h:head>\n\n    <h:body>\n        <h1>Article List</h1>\n        <h:messages style=\"color:red\"/>\n\n        <h:form>\n            <h:dataTable value=\"#{articleController.allArticles}\" var=\"article\" border=\"1\">\n                <h:column>\n                    <f:facet name=\"header\">ID</f:facet>\n                    <h:outputText value=\"#{article.id}\"/>\n                </h:column>\n                <h:column>\n                    <f:facet name=\"header\">title</f:facet>\n                    <h:outputText value=\"#{article.title}\"/>\n                </h:column>\n                <h:column>\n                    <f:facet name=\"header\">date</f:facet>\n                    <h:outputText value=\"#{article.date}\"/>\n                </h:column>\n                <h:column>\n                    <f:facet name=\"header\">operation</f:facet>\n                    <h:link value=\"edit\" outcome=\"add.xhtml\">\n                        <f:param name=\"aid\" value=\"#{article.id}\"/>\n                    </h:link>\n                    #{' '}\n                    <h:commandLink value=\"delete\" action=\"#{articleController.delete(article)}\"/>\n                </h:column>\n            </h:dataTable>\n        </h:form>\n\n        <h:link value=\">>add new article\" outcome=\"add.xhtml\"/>\n    </h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jse-examples/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.examples</groupId>\n    <artifactId>deltaspike-jse-example</artifactId>\n\n    <name>Apache DeltaSpike Java-SE Examples</name>\n\n    <packaging>jar</packaging>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n    </properties>\n\n    <profiles>\n        <profile>\n            <id>OWB</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>runtime</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>compile</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-owb</artifactId>\n                    <scope>runtime</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n        <profile>\n            <id>Weld</id>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-weld</artifactId>\n                    <scope>runtime</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.jboss.weld.se</groupId>\n                    <artifactId>weld-se-core</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>runtime</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n    </profiles>\n\n    <dependencies>\n\n\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-impl</artifactId>\n        </dependency>\n\n        <!-- Dependencies for Java-SE -->\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n    </dependencies>\n</project>\n\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/beanmanagement/SimpleBeanLookupExample.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.beanmanagement;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.example.echo.DefaultEchoService;\nimport org.apache.deltaspike.example.echo.EchoService;\nimport org.apache.deltaspike.example.optional.OptionalService;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.List;\nimport java.util.logging.Logger;\n\n/**\n * Example which illustrates the usage of {@inheritDoc BeanProvider}\n */\npublic class SimpleBeanLookupExample\n{\n    private static final Logger LOG = Logger.getLogger(SimpleBeanLookupExample.class.getName());\n\n    private SimpleBeanLookupExample()\n    {\n    }\n\n    /**\n     * Entry point\n     *\n     * @param args currently not used\n     */\n    public static void main(String[] args)\n    {\n\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        cdiContainer.boot();\n\n        ContextControl contextControl = cdiContainer.getContextControl();\n        contextControl.startContext(ApplicationScoped.class);\n        //containerControl.startContexts();\n\n        //or:\n        //cdiContainer.start();\n\n        List<EchoService> echoServiceList = BeanProvider.getContextualReferences(EchoService.class, false);\n\n        for (EchoService echoService : echoServiceList)\n        {\n            LOG.info(echoService.echo(\"Hello CDI bean!\"));\n        }\n\n        LOG.info(\"---\");\n\n        echoServiceList = BeanProvider.getContextualReferences(EchoService.class, false, false);\n\n        for (EchoService echoService : echoServiceList)\n        {\n            LOG.info(echoService.echo(\"Hello non dependent CDI scoped bean!\"));\n        }\n\n        LOG.info(\"---\");\n\n        EchoService defaultEchoService = BeanProvider.getContextualReference(DefaultEchoService.class, false);\n\n        LOG.info(defaultEchoService.echo(\"Hello explicitly resolved CDI bean!\"));\n\n        defaultEchoService = BeanProvider.getContextualReference(\"defaultEchoService\", false, EchoService.class);\n\n        LOG.info(defaultEchoService.echo(\"Hello CDI bean resolved by name!\"));\n\n        OptionalService optionalService = BeanProvider.getContextualReference(OptionalService.class, true);\n\n        if (optionalService == null)\n        {\n            LOG.info(\"No (optional) implementation found for \" + OptionalService.class.getName());\n        }\n        else\n        {\n            LOG.severe(\"Unexpected implementation found: \" + optionalService.getClass().getName());\n        }\n\n        contextControl.stopContext(ApplicationScoped.class);\n        cdiContainer.shutdown();\n\n        //or:\n        //containerControl.stopContexts();\n        //cdiContainer.shutdownContainer();\n\n        //cdiContainer.stopContext(ApplicationScoped.class); //doesn't work with weld right now - see WELD-1072\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/ConfigExample.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.logging.Logger;\n\npublic class ConfigExample\n{\n    private static final Logger LOG = Logger.getLogger(ConfigExample.class.getName());\n\n    private ConfigExample()\n    {\n    }\n\n    public static void main(String[] args)\n    {\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        cdiContainer.boot();\n\n        ContextControl contextControl = cdiContainer.getContextControl();\n        contextControl.startContext(ApplicationScoped.class);\n\n        SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);\n\n        LOG.info(\"configured int-value #1: \" + settingsBean.getIntProperty1());\n        LOG.info(\"configured long-value #2: \" + settingsBean.getProperty2());\n        LOG.info(\"configured inverse-value #2: \" + settingsBean.getInverseProperty());\n        LOG.info(\"configured location (custom config): \" + settingsBean.getLocationId().name());\n        \n        cdiContainer.shutdown();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/CustomConfigPropertyProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.core.spi.config.BaseConfigPropertyProducer;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport java.util.logging.Logger;\n\n/**\n * Equivalent to a custom converter\n */\n@ApplicationScoped\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class CustomConfigPropertyProducer extends BaseConfigPropertyProducer\n{\n    private static final Logger LOG = Logger.getLogger(CustomConfigPropertyProducer.class.getName());\n\n    @Produces\n    @Dependent\n    @Property2\n    public Long produceProperty2(InjectionPoint injectionPoint)\n    {\n        String configuredValue = getStringPropertyValue(injectionPoint);\n\n        if (configuredValue == null)\n        {\n            return null;\n        }\n\n        Property2 metaData = getAnnotation(injectionPoint, Property2.class);\n\n        if (metaData.logValue())\n        {\n            LOG.info(\"value of property 2: \" + configuredValue);\n        }\n\n        //X TODO integrate with the HandledHandler of DeltaSpike\n        return Long.parseLong(configuredValue);\n    }\n\n    @Produces\n    @Dependent\n    @Property2WithInverseSupport\n    public Long produceInverseProperty2(InjectionPoint injectionPoint)\n    {\n        String configuredValue = getStringPropertyValue(injectionPoint);\n\n        if (configuredValue == null)\n        {\n            return null;\n        }\n\n        //X TODO integrate with the HandledHandler of DeltaSpike\n        Long result = Long.parseLong(configuredValue);\n\n        Property2WithInverseSupport metaData = getAnnotation(injectionPoint, Property2WithInverseSupport.class);\n\n        if (metaData.inverseConvert())\n        {\n            return result * -1;\n        }\n\n        return result;\n    }\n\n    @Produces\n    @Dependent\n    @Location\n    public LocationId produceLocationId(InjectionPoint injectionPoint)\n    {\n        String configuredValue = getStringPropertyValue(injectionPoint);\n\n        /*\n        //alternative to @ConfigProperty#defaultValue\n        if (configuredValue == null)\n        {\n            return LocationId.LOCATION_X;\n        }\n        */\n        return LocationId.valueOf(configuredValue.trim().toUpperCase());\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/CustomPropertyFileConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.core.api.config.PropertyFileConfig;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n/**\n * Allows to use a different file than apache-deltaspike.properties\n */\n@ApplicationScoped\npublic class CustomPropertyFileConfig implements PropertyFileConfig\n{\n    @Override\n    public String getPropertyFileName()\n    {\n        return \"META-INF/location.properties\";\n    }\n\n    @Override\n    public boolean isOptional()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/Location.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ FIELD, METHOD })\n@Retention(RUNTIME)\n@Documented\n\n@ConfigProperty(name = \"locationId\", defaultValue = \"LOCATION_X\" /*as an alternative to a null check in the producer*/)\n\n@Qualifier\npublic @interface Location\n{\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/LocationId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\n/**\n * Enum as an example for a type-safe config with\n * {@link org.apache.deltaspike.core.api.config.ConfigProperty}\n */\npublic enum LocationId\n{\n    LOCATION_X, LOCATION_Y, LOCATION_Z\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/Property2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ PARAMETER, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n\n@ConfigProperty(name = \"property2\")\n\n@Qualifier\npublic @interface Property2\n{\n    @Nonbinding\n    boolean logValue() default true;\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/Property2WithInverseSupport.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.CONSTRUCTOR;\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ PARAMETER, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n\n@ConfigProperty(name = \"property2\")\n\n@Qualifier\npublic @interface Property2WithInverseSupport\n{\n    @Nonbinding\n    boolean inverseConvert() default false;\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/config/SettingsBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.config;\n\nimport org.apache.deltaspike.core.api.config.ConfigProperty;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class SettingsBean\n{\n    @Inject\n    @ConfigProperty(name = \"property1\")\n    private Integer intProperty1;\n\n    @Inject\n    @Location\n    private LocationId locationId;\n\n    private Long property2;\n\n    private Long inverseProperty;\n\n    protected SettingsBean()\n    {\n    }\n\n    @Inject\n    public SettingsBean(@Property2 Long property2)\n    {\n        this.property2 = property2;\n    }\n\n    @Inject\n    protected void init(@Property2WithInverseSupport(inverseConvert = true) Long inverseProperty)\n    {\n        this.inverseProperty = inverseProperty;\n    }\n\n    public Integer getIntProperty1()\n    {\n        return intProperty1;\n    }\n\n    public Long getProperty2()\n    {\n        return property2;\n    }\n\n    public Long getInverseProperty()\n    {\n        return inverseProperty;\n    }\n\n    public LocationId getLocationId()\n    {\n        return locationId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/echo/DefaultEchoService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.echo;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Named;\n\n/**\n * Default implementation\n */\n@Dependent\n@Named(\"DefaultEchoService\")\n//will be changed to defaultEchoService by org.apache.deltaspike.example.metadata.NamingConventionAwareMetadataFilter\npublic class DefaultEchoService implements EchoService\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String echo(String message)\n    {\n        return message;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/echo/EchoService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.echo;\n\n/**\n * Interface for the different kinds of echo-services\n */\npublic interface EchoService\n{\n    /**\n     * Returns the given text again - the format might change\n     *\n     * @param message given message\n     * @return message text\n     */\n    String echo(String message);\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/echo/NoEchoService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.echo;\n\nimport org.apache.deltaspike.core.api.exclude.Exclude;\n\n/**\n * This implementation can't be used as CDI bean\n */\n@Exclude\npublic class NoEchoService implements EchoService\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String echo(String message)\n    {\n        return message;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/echo/ToLowerCaseEchoService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.echo;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n/**\n * Implementation of {@link EchoService} which returns the given text in lower-case format\n */\n@ApplicationScoped\npublic class ToLowerCaseEchoService implements EchoService\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String echo(String message)\n    {\n        return message.toLowerCase();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/echo/ToUpperCaseEchoService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.echo;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n/**\n * Implementation of {@link EchoService} which returns the given text in upper-case format\n */\n@ApplicationScoped\npublic class ToUpperCaseEchoService implements EchoService\n{\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public String echo(String message)\n    {\n        return message.toUpperCase();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/metadata/NamingConventionAwareMetadataFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.metadata;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\n\n/**\n * Just a test filter to show the basic functionality provided by {@link AnnotatedTypeBuilder}\n */\npublic class NamingConventionAwareMetadataFilter implements Extension\n{\n    public void ensureNamingConvention(@Observes ProcessAnnotatedType processAnnotatedType)\n    {\n        Class<?> beanClass = processAnnotatedType.getAnnotatedType().getJavaClass();\n\n//        Named namedAnnotation = beanClass.getAnnotation(Named.class);\n//        if (namedAnnotation != null &&\n//                namedAnnotation.value().length() > 0 &&\n//                Character.isUpperCase(namedAnnotation.value().charAt(0)))\n//        {\n//            AnnotatedTypeBuilder builder = new AnnotatedTypeBuilder();\n//            builder.readFromType(beanClass);\n//\n//            String beanName = namedAnnotation.value();\n//            String newBeanName = beanName.substring(0, 1).toLowerCase() + beanName.substring(1);\n//\n//            builder.removeFromClass(Named.class)\n//                    .addToClass(new NamedLiteral(newBeanName));\n//\n//            processAnnotatedType.setAnnotatedType(builder.create());\n//        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/java/org/apache/deltaspike/example/optional/OptionalService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.optional;\n\n/**\n * Interface without implementation to show the lookup of optional implementations\n */\npublic interface OptionalService\n{\n}\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nproperty1=14\nproperty2=7\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/resources/META-INF/location.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nlocationId=location_z\n"
  },
  {
    "path": "deltaspike/examples/jse-examples/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.example.metadata.NamingConventionAwareMetadataFilter"
  },
  {
    "path": "deltaspike/examples/jsf-examples/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-jsf-example</artifactId>\n\n    <name>Apache DeltaSpike JSF Examples</name>\n\n    <packaging>war</packaging>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n    </properties>\n\n    <profiles>\n        <profile>\n            <!--\n             * Run it with: mvn clean package tomee:run -PtomeeConfig\n             *\n             * For debugging add: -Dopenejb.server.debug=true\n             *\n             * The application can be browsed under http://localhost:8080/ds\n             -->\n            <id>tomeeConfig</id>\n            <build>\n                <defaultGoal>install</defaultGoal>\n                <plugins>\n\n                    <plugin>\n                        <groupId>org.apache.tomee.maven</groupId>\n                        <artifactId>tomee-maven-plugin</artifactId>\n                        <version>1.0.1</version>\n                        <configuration>\n                            <tomeeVersion>${tomee.version}</tomeeVersion>\n                        </configuration>\n\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n    </profiles>\n\n    <dependencies>\n\n        <dependency>\n            <groupId>org.apache.tomee</groupId>\n            <artifactId>jakartaee-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n        </dependency>\n\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <scope>compile</scope>\n            <!-- compile since we extends DefaultMessageResolver -->\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n            <scope>compile</scope>\n            <!-- compile since we extends JsfMessageResolver -->\n        </dependency>\n\n    </dependencies>\n\n    <build>\n        <finalName>ds</finalName>\n    </build>\n</project>\n\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/ApplicationMessages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\n\n/**\n *\n */\n@MessageBundle\npublic interface ApplicationMessages\n{\n\n    String helloWorld(String name);\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/ControllerView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport org.apache.deltaspike.jsf.api.message.JsfMessage;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\nimport java.util.Date;\n\n/**\n *\n */\n@Named\n@RequestScoped\npublic class ControllerView\n{\n\n    private String name;\n\n    @Inject\n    private JsfMessage<ApplicationMessages> msg;\n\n    @Inject\n    private JsfMessage<CustomizedMessages> custom;\n\n    public void doGreeting()\n    {\n        msg.addInfo().helloWorld(name);\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String someName)\n    {\n        name = someName;\n    }\n\n    public String getNow()\n    {\n        // getTimestampMessage return a Message where you could do some customizations before calling toString().\n        return custom.get().getTimestampMessage(new Date()).toString();\n    }\n\n    public String getCustomMessage()\n    {\n        return custom.get().fromFacesMessageBundle();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/Custom.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\n\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n *\n */\n@Qualifier\n@Documented\n@Retention(RUNTIME)\npublic @interface Custom\n{\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/CustomMessageResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.jsf.impl.message.JsfMessageResolver;\n\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.faces.context.FacesContext;\n\n@Specializes\npublic class CustomMessageResolver extends JsfMessageResolver\n{\n    private static final long serialVersionUID = -7566133260553818285L;\n\n    @Override\n    public String getMessage(MessageContext messageContext, String messageTemplate, String category)\n    {\n        addMessageBundleFromFacesConfig(messageContext);\n        return super.getMessage(messageContext, messageTemplate, category);\n    }\n\n    private void addMessageBundleFromFacesConfig(MessageContext someMessageContext)\n    {\n        String messageBundle = FacesContext.getCurrentInstance().getApplication().getMessageBundle();\n        if (messageBundle != null && messageBundle.length() > 0)\n        {\n            someMessageContext.messageSource(messageBundle);\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/CustomizedMessages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\nimport org.apache.deltaspike.core.api.message.MessageTemplate;\n\nimport java.util.Date;\n\n/**\n *\n */\n@MessageBundle\n@MessageContextConfig(messageSource = {\"org.apache.deltaspike.example.message.ApplicationMessages\" },\n        messageInterpolator = MessageFormatMessageInterpolator.class)\npublic interface CustomizedMessages\n{\n\n    @MessageTemplate(value = \"{nowMessage}\")\n    Message getTimestampMessage(Date now);\n\n    String fromFacesMessageBundle();\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/LanguageView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\nimport java.util.Locale;\n\n/**\n *\n */\n@Named\n@SessionScoped\npublic class LanguageView implements Serializable\n{\n    private static final Locale ENGLISH = Locale.ENGLISH;\n    private static final Locale FRENCH = Locale.FRENCH;\n    private static final Locale DUTCH = new Locale(\"nl\");\n\n    private Locale selectedLanguage = new Locale(\"en\");\n\n    public boolean isEnglish()\n    {\n        return ENGLISH.equals(selectedLanguage);\n    }\n\n    public boolean isFrench()\n    {\n        return FRENCH.equals(selectedLanguage);\n    }\n\n    public boolean isDutch()\n    {\n        return DUTCH.equals(selectedLanguage);\n    }\n\n    public void setEnglish()\n    {\n        selectedLanguage = ENGLISH;\n    }\n\n    public void setFrench()\n    {\n        selectedLanguage = FRENCH;\n    }\n\n    public void setDutch()\n    {\n        selectedLanguage = DUTCH;\n    }\n\n    public Locale getSelectedLanguage()\n    {\n        return selectedLanguage;\n    }\n\n    public void setSelectedLanguage(Locale someSelectedLanguage)\n    {\n        selectedLanguage = someSelectedLanguage;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/message/MessageFormatMessageInterpolator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.message;\n\nimport org.apache.deltaspike.core.api.message.MessageInterpolator;\n\nimport java.io.Serializable;\nimport java.text.MessageFormat;\nimport java.util.Locale;\n\n/**\n *\n */\n@Custom\npublic class MessageFormatMessageInterpolator implements MessageInterpolator\n{\n    @Override\n    public String interpolate(String messageText, Serializable[] arguments, Locale locale)\n    {\n        return MessageFormat.format(messageText, arguments);\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ApplicationScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Named;\n\n/**\n *\n */\n@Named\n@ApplicationScoped\npublic class ApplicationScopedBean extends ScopedBean\n{\n\n    @PostConstruct\n    public void init()\n    {\n        super.init();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/RequestScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Named;\n\n/**\n *\n */\n@Named\n@RequestScoped\npublic class RequestScopedBean extends ScopedBean\n{\n\n    @PostConstruct\n    public void init()\n    {\n        super.init();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport java.util.Date;\n\n/**\n *\n */\npublic class ScopedBean\n{\n    private Date creationDate;\n\n    public Date getCreationDate()\n    {\n        return creationDate;\n    }\n\n    public void init()\n    {\n        creationDate = new Date();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/SessionScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\n/**\n *\n */\n@Named\n@SessionScoped\npublic class SessionScopedBean extends ScopedBean implements Serializable\n{\n\n    @PostConstruct\n    public void init()\n    {\n        super.init();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ViewAccessScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport java.io.Serializable;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.inject.Named;\n\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\n\n@ViewAccessScoped\n@Named\npublic class ViewAccessScopedBean extends ScopedBean implements Serializable\n{\n\n    @PostConstruct\n    public void init()\n    {\n        super.init();\n    }\n    \n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ViewScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.faces.view.ViewScoped;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\n/**\n *\n */\n@ViewScoped\n@Named\npublic class ViewScopedBean extends ScopedBean implements Serializable\n{\n\n    @PostConstruct\n    public void init()\n    {\n        super.init();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/WindowScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scope;\n\nimport java.io.Serializable;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.inject.Named;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\n\n@WindowScoped\n@Named\npublic class WindowScopedBean extends ScopedBean implements Serializable\n{\n    \n    @PostConstruct\n    public void init()\n    {\n        super.init();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/DenyAllAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.viewconfig;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\npublic class DenyAllAccessDecisionVoter implements AccessDecisionVoter\n{\n\n    @Override\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)\n    {\n        Set<SecurityViolation> violations = new HashSet<SecurityViolation>();\n        violations.add(new SecurityViolation()\n        {\n            \n            @Override\n            public String getReason()\n            {\n                return \"This is a deny all AccessDecisionVoter\";\n            }\n        });\n        return violations;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/MyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.viewconfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class MyBean\n{\n\n    private String aValue = \"My bean value\";\n\n    public String getaValue()\n    {\n        return aValue;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/PageController.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.viewconfig;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\nimport org.apache.deltaspike.example.viewconfig.Pages.SecuredPages;\nimport org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.AllowedPage;\nimport org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.NavigationParameterPage;\nimport org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.RedirectedPage;\nimport org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.SecuredPage;\nimport org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.ViewConfigPage;\n\n@Model\npublic class PageController\n{\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    @Inject\n    private ViewNavigationHandler viewNavigationHandler;\n\n    public Class<RedirectedPage> toRedirectedPage()\n    {\n        return RedirectedPage.class;\n    }\n\n    public Class<ViewConfigPage> returnToMainPage()\n    {\n        return ViewConfigPage.class;\n    }\n\n    @NavigationParameter(key = \"param4\", value = \"Parameter from the Controller class\")\n    public Class<NavigationParameterPage> toNavigationParameterPage()\n    {\n        this.navigationParameterContext.addPageParameter(\"param3\",\n                \"I also come from a navigation parameter using Dynamic Configuration via NavigationParameterContext\");\n        return NavigationParameterPage.class;\n    }\n\n    public Class<? extends SecuredPages> toSecuredPage()\n    {\n        return SecuredPage.class;\n    }\n\n    public void doAnyActionAndProceeed()\n    {\n        // action is performed\n        this.viewNavigationHandler.navigateTo(AllowedPage.class);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.viewconfig;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;\nimport org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\npublic interface Pages extends ViewConfig\n{\n    @View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)\n    interface RedirectedPages extends ViewConfig\n    {\n    }\n\n    @Secured(DenyAllAccessDecisionVoter.class)\n    interface SecuredPages extends ViewConfig\n    {\n    }\n\n    @Folder(name = \"./viewconfig/\")\n    interface ViewConfigFolder extends ViewConfig\n    {\n\n        class RedirectedPage implements RedirectedPages\n        {\n        }\n\n        class ViewConfigPage implements RedirectedPages\n        {\n        }\n\n        @NavigationParameter.List({\n                @NavigationParameter(key = \"param1\", value = \"Hey, I come from a navigation parameter\"),\n                @NavigationParameter(key = \"param2\", value = \"Hey, It's an interpolated value: #{myBean.aValue}\")\n            })\n        class NavigationParameterPage implements RedirectedPages\n        {\n        }\n\n        class SecuredPage implements SecuredPages\n        {\n        }\n        \n        class AllowedPage implements ViewConfig\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/window/SampleClientWindowConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.window;\n\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.faces.context.FacesContext;\n\nimport org.apache.deltaspike.jsf.spi.scope.window.DefaultClientWindowConfig;\n\n/**\n * A sample ClientWindowConfig\n */\n@Specializes\npublic class SampleClientWindowConfig extends DefaultClientWindowConfig\n{\n    @Override\n    public ClientWindowRenderMode getClientWindowRenderMode(FacesContext facesContext)\n    {\n        return ClientWindowRenderMode.CLIENTWINDOW;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_en.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nhelloWorld=Hello %s\nnowMessage=Current time is {0}"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_fr.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nhelloWorld=Bonjour %s\nnowMessage=L'heure actuelle est {0}"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_nl.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nhelloWorld=Hallo %s\nnowMessage=Huidige tijd is {0}"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/FacesMessages.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nfromFacesMessageBundle=Text resolved from Faces config resource bundle."
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/WEB-INF/faces-config.xml",
    "content": "<?xml version='1.0' encoding='UTF-8'?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n\n    <application>\n        <message-bundle>org.apache.deltaspike.example.message.FacesMessages</message-bundle>\n    </application>\n</faces-config>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <context-param>\n        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>\n        <param-value>.xhtml</param-value>\n    </context-param>\n\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n\n    <welcome-file-list>\n        <welcome-file>index.xhtml</welcome-file>\n    </welcome-file-list>\n</web-app>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/index.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>Deltaspike JSF module examples</h1>\n\t<h:link value=\"Scopes\" outcome=\"pages/scopes/scopePage1.jsf\" />\n\t<br />\n\t<h:link value=\"Messages\" outcome=\"pages/message/jsfMessage.jsf\" />\n\t<br />\n\t<h:link value=\"Type-Safe View-Config\"\n\t\toutcome=\"pages/viewconfig/viewConfigPage.jsf\" />\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/message/jsfMessage.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\">\n\n<f:view locale=\"#{languageView.selectedLanguage}\">\n    <h:head>\n        <title>JsfMessage example</title>\n    </h:head>\n\n    <h:body>\n\n        <h:form>\n            <h1>JsfMessage example</h1>\n            <h:messages/>\n\n            <h:commandLink actionListener=\"#{languageView.setEnglish}\" value=\"English\"\n                           disabled=\"#{languageView.english}\" immediate=\"true\"/> &nbsp;\n            <h:commandLink actionListener=\"#{languageView.setFrench}\" value=\"French\"\n                           disabled=\"#{languageView.french}\" immediate=\"true\"/>  &nbsp;\n            <h:commandLink actionListener=\"#{languageView.setDutch}\" value=\"Dutch\"\n                           disabled=\"#{languageView.dutch}\" immediate=\"true\"/>\n            <br/>\n            <h:outputLabel value=\"name\" for=\"name\"/> <h:inputText id=\"name\" value=\"#{controllerView.name}\"\n                                                                  required=\"true\"/>\n            <br/>\n            <h:commandButton value=\"greet\" actionListener=\"#{controllerView.doGreeting}\"/>\n            <br/>\n            #{controllerView.now}\n            <br/>\n            following text is revolved by CustomMessageResolver: [#{controllerView.customMessage}]\n        </h:form>\n    </h:body>\n</f:view>\n</html>\n"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage1.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>JSF 2/CDI Scope testing</h1>\n\t<h2>Page 1</h2>\n\t<h:panelGrid columns=\"2\" id=\"scopedValues\">\n\t\t<h:outputLabel value=\"ApplicationScope : \" />\n\t\t<h:outputText value=\"#{applicationScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"SessionScope : \" />\n\t\t<h:outputText value=\"#{sessionScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"WindowScope : \" />\n\t\t<h:outputText value=\"#{windowScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"ViewScope : \" />\n\t\t<h:outputText value=\"#{viewScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"ViewAccessScope : \" />\n\t\t<h:outputText value=\"#{viewAccessScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"RequestScope : \" />\n\t\t<h:outputText value=\"#{requestScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t</h:panelGrid>\n\t<h:form>\n\t\t<h:commandButton value=\"Same page\" />\n\t\t<h:commandButton value=\"AJAX refresh\">\n\t\t\t<f:ajax render=\":scopedValues\" />\n\t\t</h:commandButton>\n\t\t<h:commandButton value=\"Next page\" action=\"scopePage2\" />\n\t</h:form>\n\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage2.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>JSF 2/CDI Scope testing</h1>\n\t<h2>Page 2</h2>\n\t<h:panelGrid columns=\"2\" id=\"scopedValues\">\n\t\t<h:outputLabel value=\"ApplicationScope : \" />\n\t\t<h:outputText value=\"#{applicationScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"SessionScope : \" />\n\t\t<h:outputText value=\"#{sessionScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"WindowScope : \" />\n\t\t<h:outputText value=\"#{windowScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"ViewScope : \" />\n\t\t<h:outputText value=\"#{viewScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"ViewAccessScope : \" />\n\t\t<h:outputText value=\"#{viewAccessScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t\t<h:outputLabel value=\"RequestScope : \" />\n\t\t<h:outputText value=\"#{requestScopedBean.creationDate}\">\n\t\t\t<f:convertDateTime dateStyle=\"full\" type=\"both\" />\n\t\t</h:outputText>\n\n\t</h:panelGrid>\n\t<h:form>\n\t\t<h:commandButton value=\"Same page\" />\n\t\t<h:commandButton value=\"AJAX refresh\">\n\t\t\t<f:ajax render=\":scopedValues\" />\n\t\t</h:commandButton>\n\t\t<h:commandButton value=\"Index\" action=\"/index\" />\n\t</h:form>\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/allowedPage.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>Allowed Page</h1>\n\t<h:form>\n\t\t<h:commandButton action=\"#{pageController.returnToMainPage()}\"\n\t\t\tvalue=\"Return to Main Page\" />\n\t</h:form>\n\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/navigationParameterPage.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>Parameters Page</h1>\n\t<h:form>\n\t\t<h:outputText value=\"Param1: #{param['param1']}\" />\n\t\t<br />\n\t\t<h:outputText value=\"Param2: #{param['param2']}\" />\n\t\t<br />\n\t\t<h:outputText value=\"Param3: #{param['param3']}\" />\n\t\t<br />\n\t\t<h:outputText value=\"Param4: #{param['param4']}\" />\n\t\t<br />\n\t\t<h:commandButton action=\"#{pageController.returnToMainPage()}\"\n\t\t\tvalue=\"Return to Main Page\" />\n\t</h:form>\n\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/redirectedPage.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>Redirected Page</h1>\n\t<h:form>\n\t\t<h:commandButton action=\"#{pageController.returnToMainPage()}\"\n\t\t\tvalue=\"Return to Main Page\" />\n\t</h:form>\n\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/securedPage.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>Secured Page</h1>\n\t<h:form>\n\t\t<h:commandButton action=\"#{pageController.returnToMainPage()}\"\n\t\t\tvalue=\"Return to Main Page\" />\n\t</h:form>\n\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/viewConfigPage.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:f=\"http://java.sun.com/jsf/core\">\n\n<h:head>\n\t<title>Simple JSF Facelets page</title>\n</h:head>\n\n<h:body>\n\t<h1>JSF 2/CDI Type-safe View-Config</h1>\n\t<h:form>\n\t\t<h:commandButton action=\"#{pageController.toRedirectedPage()}\"\n\t\t\tvalue=\"Navigate using redirect\" />\n\t\t<br />\n\t\t<h:commandButton\n\t\t\taction=\"#{pageController.toNavigationParameterPage()}\"\n\t\t\tvalue=\"Parameters page\" />\n\t\t<br />\n\t\t<h:commandButton action=\"#{pageController.toSecuredPage()}\"\n\t\t\tvalue=\"Secured page\" />\n\t\t<br />\n\t\t<h:commandButton action=\"#{pageController.doAnyActionAndProceeed()}\"\n\t\t\tvalue=\"Allowed page without redirection\" />\n\t</h:form>\n\n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n        Unless required by applicable law or agreed to in writing,\n        software distributed under the License is distributed on an\n        \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n        KIND, either express or implied.  See the License for the\n        specific language governing permissions and limitations\n        under the License.\n    -->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-jsf-playground</artifactId>\n\n    <name>Apache DeltaSpike JSF Playground</name>\n\n    <packaging>war</packaging>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n    </properties>\n\n    <dependencies>\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.tomee</groupId>\n            <artifactId>jakartaee-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.tomee.maven</groupId>\n                <artifactId>tomee-embedded-maven-plugin</artifactId>\n                <version>9.1.2</version>\n                <configuration>\n                    <context>/</context>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n\n"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/playground/PlaygroundClientWindowConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.playground;\n\nimport org.apache.deltaspike.jsf.spi.scope.window.DefaultClientWindowConfig;\n\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.faces.context.FacesContext;\n\n@Specializes\npublic class PlaygroundClientWindowConfig extends DefaultClientWindowConfig\n{\n    @Override\n    public ClientWindowRenderMode getClientWindowRenderMode(FacesContext facesContext)\n    {\n        String path = facesContext.getExternalContext().getRequestPathInfo();\n        if (path == null)\n        {\n            path = facesContext.getExternalContext().getRequestServletPath();\n        }\n\n        ClientWindowRenderMode mode;\n\n        if (path.contains(\"/windowhandling/clientwindow/\"))\n        {\n            mode = ClientWindowRenderMode.CLIENTWINDOW;\n        }\n        else if (path.contains(\"/windowhandling/lazy/\"))\n        {\n            mode = ClientWindowRenderMode.LAZY;\n        }\n        else if (path.contains(\"/windowhandling/none/\"))\n        {\n            mode = ClientWindowRenderMode.NONE;\n        }\n        else if (path.contains(\"/windowhandling/delegated/\"))\n        {\n            mode = ClientWindowRenderMode.DELEGATED;\n        }\n        else\n        {\n            mode = ClientWindowRenderMode.CLIENTWINDOW;\n        }\n\n        return mode;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/playground/scope/viewaccess/ViewAccessScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.playground.scope.viewaccess;\n\nimport java.io.Serializable;\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.inject.Named;\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\n\n@Named\n@ViewAccessScoped\npublic class ViewAccessScopedBean implements Serializable\n{\n    private String value;\n    \n    @PostConstruct\n    public void postConstruct()\n    {\n        System.err.println(\"postConstruct\");\n    }\n    \n    @PreDestroy\n    public void preDestroy()\n    {\n        System.err.println(\"preDestroy\");\n    }\n    \n    public void touch()\n    {\n        System.err.println(\"touch\");\n    }\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/java/org/apache/deltaspike/playground/windowhandling/ViewActionController.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.playground.windowhandling;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.lifecycle.ClientWindow;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\nimport java.util.Date;\n\n@Named\n@RequestScoped\npublic class ViewActionController\n{\n    @Inject\n    private ClientWindow clientWindow;\n    \n    private Date lastTimeLinkAction;\n\n    @PostConstruct\n    public void init()\n    {\n        System.out.println(\"@PostConstruct ViewActionController\");\n    }\n\n    public void action()\n    {\n        FacesContext context = FacesContext.getCurrentInstance();\n        System.out.println(\"ViewActionController#action with windowId: \" + clientWindow.getId());\n    }\n\n    public Date getLastTimeLinkAction()\n    {\n        return lastTimeLinkAction;\n    }\n\n    public void linkAction()\n    {\n        FacesContext context = FacesContext.getCurrentInstance();\n        System.out.println(\"ViewActionController#linkAction with windowId: \" + clientWindow.getId());\n        lastTimeLinkAction = new Date();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/faces-config.xml",
    "content": "<?xml version='1.0' encoding='UTF-8'?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n</faces-config>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <context-param>\n        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>\n        <param-value>.xhtml</param-value>\n    </context-param>\n    <context-param>\n        <param-name>jakarta.faces.PROJECT_STAGE</param-name>\n        <param-value>Development</param-value>\n    </context-param>\n\n\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n    \n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>/faces/*</url-pattern>\n    </servlet-mapping>\n\n    <welcome-file-list>\n        <welcome-file>index.xhtml</welcome-file>\n    </welcome-file-list>\n</web-app>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/index.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--\r\n  ~ Licensed to the Apache Software Foundation (ASF) under one\r\n  ~ or more contributor license agreements. See the NOTICE file\r\n  ~ distributed with this work for additional information\r\n  ~ regarding copyright ownership. The ASF licenses this file\r\n  ~ to you under the Apache License, Version 2.0 (the\r\n  ~ \"License\"); you may not use this file except in compliance\r\n  ~ with the License. You may obtain a copy of the License at\r\n  ~\r\n  ~ http://www.apache.org/licenses/LICENSE-2.0\r\n  ~\r\n  ~ Unless required by applicable law or agreed to in writing,\r\n  ~ software distributed under the License is distributed on an\r\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n  ~ KIND, either express or implied. See the License for the\r\n  ~ specific language governing permissions and limitations\r\n  ~ under the License.\r\n  -->\r\n<!DOCTYPE html\r\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\r\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\r\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\">\r\n\r\n<h:head>\r\n    <title>DeltaSpike JSF Playground</title>\r\n</h:head>\r\n\r\n<h:body>\r\n    <h1>Deltaspike JSF Playground</h1>\r\n    <br/>\r\n    ExceptionHandling: <br/>\r\n    <h:link value=\"ExceptionHandling\" outcome=\"views/exceptionhandling/exceptionhandling.jsf\" /> <br/>\r\n    <br/>\r\n    Scope: <br/>\r\n    <h:link value=\"ViewAccess 1\" outcome=\"views/scope/viewaccess/test1.jsf\" /> <br/>\r\n    <h:link value=\"ViewAccess 2\" outcome=\"views/scope/viewaccess/test2.jsf\" /> <br/>\r\n    <h:link value=\"ViewAccess 3\" outcome=\"views/scope/viewaccess/test3.jsf\" /> <br/>\r\n    <br/>\r\n    WindowHandling: <br/>\r\n    <h:link value=\"ClientWindow\" outcome=\"views/windowhandling/clientwindow/test.jsf\" /> <br/>\r\n    <h:link value=\"Lazy\" outcome=\"views/windowhandling/lazy/test.jsf\" /> <br/>\r\n    <h:link value=\"Lazy without JS\" outcome=\"views/windowhandling/lazy/testWithoutJS.jsf\" /> <br/>\r\n    <h:link value=\"Lazy ViewAction\" outcome=\"views/windowhandling/lazy/viewAction.jsf\" /> <br/>\r\n    \r\n    \r\n    <br/>\r\n    <br/>\r\n    'window.name': <input id=\"windowname\" />\r\n    <button onclick=\"window.name = document.getElementById('windowname').value; return false;\">set</button>\r\n    <script type=\"text/javascript\">\r\n        document.getElementById('windowname').value = window.name;\r\n    </script>\r\n    \r\n    \r\n</h:body>\r\n\r\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/scope/viewaccess/test1.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n    <title>DeltaSpike JSF Playground</title>\n</h:head>\n\n<h:body>\n    <h:form>\n        <ds:windowId/>\n\n        <h:inputText value=\"#{viewAccessScopedBean.value}\">\n            <f:ajax execute=\"@this\" render=\"@none\" />\n        </h:inputText>\n        \n        <h:commandButton value=\"Touch\" action=\"#{viewAccessScopedBean.touch()}\"/>\n        <h:commandButton value=\"Touch via AJAX\" action=\"#{viewAccessScopedBean.touch()}\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandButton>\n    </h:form>\n    \n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/scope/viewaccess/test2.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n    <title>DeltaSpike JSF Playground</title>\n</h:head>\n\n<h:body>\n    <h:form>\n        <ds:windowId/>\n\n        <!-- Just to touch the bean -->\n        Value: #{viewAccessScopedBean.value}\n        \n        <h:commandButton value=\"Touch\" action=\"#{viewAccessScopedBean.touch()}\"/>\n        <h:commandButton value=\"Touch via AJAX\" action=\"#{viewAccessScopedBean.touch()}\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandButton>\n    </h:form>\n    \n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/scope/viewaccess/test3.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n    <title>DeltaSpike JSF Playground</title>\n</h:head>\n\n<h:body>\n    <h:form>\n        <ds:windowId/>\n\n        <h:commandButton value=\"Touch\" action=\"#{viewAccessScopedBean.touch()}\"/>\n        <h:commandButton value=\"Touch via AJAX\" action=\"#{viewAccessScopedBean.touch()}\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandButton>\n    </h:form>\n    \n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/clientwindow/test.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n    <f:view contentType=\"text/html\">\n        <h:head>\n            <title>DeltaSpike JSF Playground</title>\n        </h:head>\n        <h:body>\n            <h:form>\n                <ds:windowId/>\n\n                DS WindowId: #{dsWindowContext.currentWindowId}\n                <br />\n                <br />\n                <h:link value=\"GET Link\" outcome=\"test.xhtml\" />\n                <br />\n                <br />\n                <h:commandLink value=\"Postback\">\n                </h:commandLink>\n                <br />\n                <br />\n                <h:commandLink value=\"Postback with outcome\" action=\"test.xhtml?faces-redirect=true\">\n                </h:commandLink>\n                <br />\n                <br />\n                <h:commandLink value=\"AJAX Postback\">\n                    <f:ajax render=\"@form\" execute=\"@this\" />\n                </h:commandLink>\n                <br />\n                <br />\n                <h:commandLink value=\"AJAX Postback with outcome\" action=\"test.xhtml?faces-redirect=true\">\n                    <f:ajax render=\"@form\" execute=\"@this\" />\n                </h:commandLink>\n                <br />\n                <br />\n                Last time linkAction: #{viewActionController.lastTimeLinkAction} <br/>\n                <h:commandLink value=\"AJAX action\" action=\"#{viewActionController.linkAction}\">\n                    <f:ajax render=\"@form\" execute=\"@this\" />\n                </h:commandLink>\n            </h:form>\n        </h:body>\n    </f:view>\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/test.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n    <title>DeltaSpike JSF Playground</title>\n</h:head>\n\n<h:body>\n    <h:form>\n        <ds:windowId/>\n\n        DS WindowId: #{dsWindowContext.currentWindowId}\n        <br />\n        <br />\n        <h:link value=\"GET Link\" outcome=\"test.xhtml\" />\n        <br />\n        <br />\n        <h:link value=\"GET Link - surrounded by ds:disableClientWindow\" outcome=\"test.xhtml\" disableClientWindow=\"true\" />\n        <br />\n        <br />\n        <h:commandLink value=\"Postback\">\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"Postback with outcome\" action=\"test.xhtml?faces-redirect=true\">\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"AJAX Postback\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"AJAX Postback with outcome\" action=\"test.xhtml?faces-redirect=true\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandLink>\n    </h:form>\n    \n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/testWithoutJS.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n    <title>DeltaSpike JSF Playground</title>\n</h:head>\n\n<h:body>\n    <h:form>\n        DS WindowId: #{dsWindowContext.currentWindowId}\n        <br />\n        <br />\n        <h:link value=\"GET Link\" outcome=\"test.xhtml\" />\n        <br />\n        <br />\n        <h:link value=\"GET Link - surrounded by ds:disableClientWindow\" outcome=\"test.xhtml\" disableClientWindow=\"true\" />\n        <br />\n        <br />\n        <h:commandLink value=\"Postback\">\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"Postback with outcome\" action=\"test.xhtml?faces-redirect=true\">\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"AJAX Postback\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"AJAX Postback with outcome\" action=\"test.xhtml?faces-redirect=true\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandLink>\n    </h:form>\n    \n</h:body>\n\n</html>"
  },
  {
    "path": "deltaspike/examples/jsf-playground/src/main/webapp/views/windowhandling/lazy/viewAction.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n    <title>DeltaSpike JSF Playground</title>\n</h:head>\n\n<f:metadata>\n    <f:viewAction action=\"#{viewActionController.action()}\"/>\n</f:metadata>\n    \n<h:body>\n    <h:form>\n        <ds:windowId/>\n        \n        DS WindowId: #{dsWindowContext.currentWindowId}\n        <br />\n        <br />\n        <h:link value=\"GET Link\" outcome=\"viewAction.xhtml\" />\n        <br />\n        <br />\n        <h:link value=\"GET Link - surrounded by ds:disableClientWindow\" outcome=\"viewAction.xhtml\" disableClientWindow=\"true\" />\n        <br />\n        <br />\n        <h:commandLink value=\"Postback\">\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"Postback with outcome\" action=\"viewAction.xhtml?faces-redirect=true\">\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"AJAX Postback\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandLink>\n        <br />\n        <br />\n        <h:commandLink value=\"AJAX Postback with outcome\" action=\"viewAction.xhtml?faces-redirect=true\">\n            <f:ajax render=\"@form\" execute=\"@this\" />\n        </h:commandLink>\n    </h:form>\n    \n</h:body>\n\n</html>\t\n"
  },
  {
    "path": "deltaspike/examples/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <!--\n        Licensed to the Apache Software Foundation (ASF) under one\n        or more contributor license agreements.  See the NOTICE file\n        distributed with this work for additional information\n        regarding copyright ownership.  The ASF licenses this file\n        to you under the Apache License, Version 2.0 (the\n        \"License\"); you may not use this file except in compliance\n        with the License.  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n        Unless required by applicable law or agreed to in writing,\n        software distributed under the License is distributed on an\n        \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n        KIND, either express or implied.  See the License for the\n        specific language governing permissions and limitations\n        under the License.\n    -->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>parent-code</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../parent/code/pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.examples</groupId>\n    <artifactId>examples-project</artifactId>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Examples</name>\n\n    <modules>\n        <module>jse-examples</module>\n        <module>jsf-examples</module>\n        <module>jsf-playground</module>\n        <module>security-requested-page-after-login-cdi</module>\n        <module>security-requested-page-after-login-picketlink</module>\n        <module>scheduler-playground</module>\n        <module>jpa-examples</module>\n        <module>data-examples</module>\n    </modules>\n\n    <properties>\n        <deploy.skip>false</deploy.skip>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>org.apache.deltaspike.core</groupId>\n                <artifactId>deltaspike-core-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.core</groupId>\n                <artifactId>deltaspike-core-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-security-module-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-security-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jsf-module-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jsf-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jpa-module-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-jpa-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-data-module-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-data-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-scheduler-module-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.modules</groupId>\n                <artifactId>deltaspike-scheduler-module-impl</artifactId>\n                <version>${project.version}</version>\n                <scope>runtime</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-api</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-owb</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-openejb</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.deltaspike.cdictrl</groupId>\n                <artifactId>deltaspike-cdictrl-weld</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.tomee</groupId>\n                <artifactId>jakartaee-api</artifactId>\n                <version>${tomee-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.myfaces.core</groupId>\n                <artifactId>myfaces-api</artifactId>\n                <version>${myfaces.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n        </dependencies>\n    </dependencyManagement>\n\n    <dependencies>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-deploy-plugin</artifactId>\n                <version>3.1.1</version>\n                <configuration>\n                    <skip>${deploy.skip}</skip> <!-- we don't deploy our samples upstream -->\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.examples</groupId>\n    <artifactId>deltaspike-scheduler-example</artifactId>\n\n    <name>Apache DeltaSpike Java-SE Scheduler Examples</name>\n\n    <packaging>jar</packaging>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n    </properties>\n\n    <profiles>\n        <profile>\n            <id>OWB</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>runtime</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>compile</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.javassist</groupId>\n                    <artifactId>javassist</artifactId>\n                    <version>3.17.1-GA</version>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-owb</artifactId>\n                    <scope>runtime</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n        <profile>\n            <id>Weld</id>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-weld</artifactId>\n                    <scope>runtime</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.jboss.weld.se</groupId>\n                    <artifactId>weld-se-core</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>runtime</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n    </profiles>\n\n    <dependencies>\n\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-scheduler-module-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-scheduler-module-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.quartz-scheduler</groupId>\n            <artifactId>quartz</artifactId>\n            <version>2.3.2</version>\n        </dependency>\n    </dependencies>\n</project>\n\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/src/main/java/org/apache/deltaspike/example/scheduler/GlobalResultHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scheduler;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport java.util.concurrent.atomic.AtomicInteger;\n\n@ApplicationScoped\npublic class GlobalResultHolder\n{\n    private AtomicInteger count = new AtomicInteger();\n\n    @Inject\n    private RequestScopedNumberProvider numberProvider;\n\n\n    @PostConstruct\n    protected void init()\n    {\n        count.set(0);\n    }\n\n    public void increase()\n    {\n        count.addAndGet(numberProvider.getNumber());\n    }\n\n    public int getCount()\n    {\n        return count.get();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/src/main/java/org/apache/deltaspike/example/scheduler/RequestScopedNumberProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scheduler;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport java.math.BigDecimal;\n\n@RequestScoped\npublic class RequestScopedNumberProvider\n{\n    public int getNumber()\n    {\n        int result = new BigDecimal(Math.random() % 10).intValue();\n        return result != 0 ? result : 1;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/src/main/java/org/apache/deltaspike/example/scheduler/SimpleSchedulerExample.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scheduler;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.logging.Logger;\n\npublic class SimpleSchedulerExample\n{\n    private static final Logger LOG = Logger.getLogger(SimpleSchedulerExample.class.getName());\n\n    private SimpleSchedulerExample()\n    {\n    }\n\n    public static void main(String[] args) throws InterruptedException\n    {\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        cdiContainer.boot();\n\n        ContextControl contextControl = cdiContainer.getContextControl();\n        contextControl.startContext(ApplicationScoped.class);\n\n        GlobalResultHolder globalResultHolder =\n            BeanProvider.getContextualReference(GlobalResultHolder.class);\n\n        while (globalResultHolder.getCount() < 100)\n        {\n            Thread.sleep(500);\n            LOG.info(\"current count: \" + globalResultHolder.getCount());\n        }\n        LOG.info(\"completed!\");\n\n        contextControl.stopContext(ApplicationScoped.class);\n        cdiContainer.shutdown();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/src/main/java/org/apache/deltaspike/example/scheduler/SimpleSchedulerJob1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scheduler;\n\nimport org.apache.deltaspike.scheduler.api.Scheduled;\nimport org.quartz.Job;\nimport org.quartz.JobExecutionContext;\nimport org.quartz.JobExecutionException;\n\nimport jakarta.inject.Inject;\nimport java.util.logging.Logger;\n\n@Scheduled(cronExpression = \"0/2 * * * * ?\")\npublic class SimpleSchedulerJob1 implements Job\n{\n    private static final Logger LOG = Logger.getLogger(SimpleSchedulerJob1.class.getName());\n\n    @Inject\n    private GlobalResultHolder globalResultHolder;\n\n    @Override\n    public void execute(JobExecutionContext context) throws JobExecutionException\n    {\n        LOG.info(\"#increase called by \" + getClass().getName());\n        globalResultHolder.increase();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/src/main/java/org/apache/deltaspike/example/scheduler/SimpleSchedulerJob2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.scheduler;\n\nimport org.apache.deltaspike.scheduler.api.Scheduled;\nimport org.quartz.Job;\nimport org.quartz.JobExecutionContext;\nimport org.quartz.JobExecutionException;\n\nimport jakarta.inject.Inject;\nimport java.util.logging.Logger;\n\n@Scheduled(cronExpression = \"0/1 * * * * ?\")\npublic class SimpleSchedulerJob2 implements Job\n{\n    private static final Logger LOG = Logger.getLogger(SimpleSchedulerJob2.class.getName());\n\n    @Inject\n    private GlobalResultHolder globalResultHolder;\n\n    @Override\n    public void execute(JobExecutionContext context) throws JobExecutionException\n    {\n        LOG.info(\"#increase called by \" + getClass().getName());\n        globalResultHolder.increase();\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/scheduler-playground/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/README.md",
    "content": "Notice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n\nMaking initially requested secured page available for redirect after login with CDI\n===================================================================================\n\nThe following scenario is commonly seen in web applications:\n\n1. User requests a web page\n2. The web page is restricted to logged in users so the browser is redirected to login page\n3. After successful login, the user is redirected back to the originally requested page\n\nThis example shows pure CDI implementation of this technique.\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n    \n    <artifactId>deltaspike-security-requested-page-after-login-cdi</artifactId>\n    <packaging>war</packaging>\n    <name>Apache DeltaSpike Security Example CDI</name>\n    <description>DeltaSpike Example: Show requested page after login with CDI</description>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n        <picketlink.version>2.7.0.Final</picketlink.version>\n    </properties>\n\n    <dependencies>\n\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <version>${myfaces.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n        \n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.tomee</groupId>\n            <artifactId>jakartaee-api</artifactId>\n        </dependency>\n\n    </dependencies>\n\n    <build>\n        <finalName>${project.artifactId}</finalName>\n    </build>\n\n</project>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/AuthenticationListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.cdi;\n\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.inject.Inject;\n\npublic class AuthenticationListener\n{\n    @Inject\n    private ViewNavigationHandler viewNavigationHandler;\n\n    @Inject\n    private LoggedInAccessDecisionVoter loggedInAccessDecisionVoter;\n\n    public void handleLoggedIn(@Observes UserEvent.LoggedIn event) \n    {\n        this.viewNavigationHandler.navigateTo(loggedInAccessDecisionVoter.getDeniedPage());\n        System.err.println(\"handling loggedin\");\n    }\n\n    public void handleFailed(@Observes UserEvent.LoginFailed event)\n    {\n        this.viewNavigationHandler.navigateTo(Pages.Login.class);\n        System.err.println(\"handling failed\");\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoggedInAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.cdi;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.security.api.authorization.AbstractAccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.inject.Inject;\nimport java.util.Set;\n\n@SessionScoped //or @WindowScoped\npublic class LoggedInAccessDecisionVoter extends AbstractAccessDecisionVoter\n{\n\n    @Inject\n    private ViewConfigResolver viewConfigResolver;\n\n    @Inject\n    private LoginController loginController;\n\n    private Class<? extends ViewConfig> deniedPage = Pages.Secure.Home.class;\n\n    @Override\n    protected void checkPermission(AccessDecisionVoterContext context, Set<SecurityViolation> violations)\n    {\n        if (loginController.isLoggedIn())\n        {\n            // no violations, pass\n        }\n        else\n        {\n            violations.add(new SecurityViolation()\n            {\n                @Override\n                public String getReason()\n                {\n                    return \"User must be logged in to access this resource\";\n                }\n            });\n\n            // remember the requested page\n            deniedPage = viewConfigResolver\n                    .getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId())\n                    .getConfigClass();\n        }\n    }\n\n    public Class<? extends ViewConfig> getDeniedPage()\n    {\n        return deniedPage;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoginController.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.cdi;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.event.Event;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@RequestScoped\npublic class LoginController\n{\n    public static final String DEFAULT_USER = \"john\";\n\n    public static final String DEFAULT_PASSWORD = \"123456\";\n\n    public static final String DEFAULT_NAME = \"John User\";\n\n    private String username;\n\n    private String password;\n\n    private boolean loggedIn = false;\n\n    @Inject\n    private Event<UserEvent.LoggedIn> evtLoggedIn;\n\n    @Inject\n    private Event<UserEvent.LoginFailed> evtLoginFailed;\n\n    public void login()\n    {\n        if (DEFAULT_USER.equals(username) && DEFAULT_PASSWORD.equals(password))\n        {\n            loggedIn = true;\n            evtLoggedIn.fire(new UserEvent.LoggedIn());\n            System.err.println(\"logged in\");\n        }\n        else\n        {\n            evtLoginFailed.fire(new UserEvent.LoginFailed());\n            System.err.println(\"failed\");\n        }\n    }\n\n    public void logout()\n    {\n        loggedIn = false;\n    }\n\n    public String getPassword()\n    {\n        return password;\n    }\n\n    public void setPassword(String password)\n    {\n        this.password = password;\n    }\n\n    public String getUsername()\n    {\n        return username;\n    }\n\n    public void setUsername(String username)\n    {\n        this.username = username;\n    }\n\n    public String getName()\n    {\n        return DEFAULT_NAME;\n    }\n\n    public boolean isLoggedIn()\n    {\n        return loggedIn;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.cdi;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\n@Folder(name = \"/\")\npublic interface Pages\n{\n    class Login extends DefaultErrorView\n    {\n    }\n\n    @Folder(name = \"/secured\")\n    interface Secure extends ViewConfig\n    {\n\n        @Secured(LoggedInAccessDecisionVoter.class)\n        class Home implements Secure\n        {\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/UserEvent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.cdi;\n\npublic class UserEvent\n{\n    public static class LoggedIn\n    {\n    }\n\n    public static class LoginFailed\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n\n    <interceptors>\n        <class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>\n    </interceptors>\n\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/faces-config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n\n</faces-config>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <context-param>\n        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>\n        <param-value>.xhtml</param-value>\n    </context-param>\n\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n\n    <welcome-file-list>\n        <welcome-file>index.html</welcome-file>\n    </welcome-file-list>\n</web-app>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/index.html",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html>\n<head>\n    <title>Index</title>\n</head>\n<body>\n<h1>Index</h1>\n\n<p>\n    This link points to a secured page and should redirect to login page:\n    <br>\n    <a href=\"secured/home.xhtml\">Go Home</a>\n</p>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/login.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n<head>\n    <title>Login</title>\n</head>\n\n<body>\n<h1>Log in</h1>\n<h:messages globalOnly=\"true\"></h:messages>\n<h:form id=\"loginForm\">\n    <h:outputLabel value=\"Username:\" for=\"username\"/><br/>\n    <h:inputText value=\"#{loginController.username}\" id=\"username\"/><br/><br/>\n    <h:outputLabel value=\"Password:\" for=\"password\"/><br/>\n    <h:inputSecret value=\"#{loginController.password}\" id=\"password\"/><br/>\n    <h:commandButton value=\"Log in\" action=\"#{loginController.login()}\" id=\"loginBtn\"/>\n</h:form>\n\n<p>\n    <b>Hint:</b> log in as john / 123456\n</p>\n<br/>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/secured/home.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n<head>\n    <title>Login</title>\n</head>\n\n<body>\n<h1>Log in</h1>\n<h:messages globalOnly=\"true\"></h:messages>\n<h:form id=\"loginForm\">\n    <h:outputLabel value=\"Username:\" for=\"username\"/><br/>\n    <h:inputText value=\"#{loginController.username}\" id=\"username\"/><br/><br/>\n    <h:outputLabel value=\"Password:\" for=\"password\"/><br/>\n    <h:inputSecret value=\"#{loginController.password}\" id=\"password\"/><br/>\n    <h:commandButton value=\"Log in\" action=\"#{loginController.login()}\" id=\"loginBtn\"/>\n</h:form>\n\n<p>\n    <b>Hint:</b> log in as john / 123456\n</p>\n<br/>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/README.md",
    "content": "Notice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n           \nMaking initially requested secured page available for redirect after login with PicketLink\n==========================================================================================\n\nThe following scenario is commonly seen in web applications:\n\n1. User requests a web page\n2. The web page is restricted to logged in users so the browser is redirected to login page\n3. After successful login, the user is redirected back to the originally requested page\n\nThis example shows an implementation of this technique using PicketLink.\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.apache.deltaspike.examples</groupId>\n        <artifactId>examples-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-security-requested-page-after-login-picketlink</artifactId>\n    <packaging>war</packaging>\n    <name>Apache DeltaSpike Security Example PicketLink</name>\n    <description>DeltaSpike Example: Show requested page after login with PicketLink</description>\n\n    <properties>\n        <deploy.skip>true</deploy.skip>\n        <picketlink.version>2.7.0.Final</picketlink.version>\n    </properties>\n\n    <dependencies>\n\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <!-- DeltaSpike modules -->\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-impl</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.picketlink</groupId>\n            <artifactId>picketlink-api</artifactId>\n            <scope>compile</scope>\n            <version>${picketlink.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.picketlink</groupId>\n            <artifactId>picketlink-impl</artifactId>\n            <scope>compile</scope>\n            <version>${picketlink.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.tomee</groupId>\n            <artifactId>jakartaee-api</artifactId>\n        </dependency>\n\n    </dependencies>\n\n    <build>\n        <finalName>${project.artifactId}</finalName>\n    </build>\n\n</project>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.picketlink;\n\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\nimport org.picketlink.authentication.event.LoggedInEvent;\nimport org.picketlink.authentication.event.LoginFailedEvent;\nimport org.picketlink.authentication.event.PostLoggedOutEvent;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.inject.Inject;\n\npublic class AuthenticationListener\n{\n\n    @Inject\n    private ViewNavigationHandler viewNavigationHandler;\n\n    @Inject\n    private LoggedInAccessDecisionVoter loggedInAccessDecisionVoter;\n\n    public void handleLoggedIn(@Observes LoggedInEvent event)\n    {\n        this.viewNavigationHandler.navigateTo(loggedInAccessDecisionVoter.getDeniedPage());\n    }\n\n    public void handleFailed(@Observes LoginFailedEvent event)\n    {\n        this.viewNavigationHandler.navigateTo(Pages.Login.class);\n    }\n\n    public void handleLogout(@Observes PostLoggedOutEvent event)\n    {\n        this.viewNavigationHandler.navigateTo(Pages.Login.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Initializer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.picketlink;\n\nimport org.picketlink.idm.IdentityManager;\nimport org.picketlink.idm.PartitionManager;\nimport org.picketlink.idm.credential.Password;\nimport org.picketlink.idm.model.basic.User;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.ejb.Singleton;\nimport jakarta.ejb.Startup;\nimport jakarta.inject.Inject;\n\n/**\n * This startup bean creates the default users, groups and roles when the application is started.\n */\n@Singleton\n@Startup\npublic class Initializer\n{\n\n    @Inject\n    private PartitionManager partitionManager;\n\n    @PostConstruct\n    public void create() \n    {\n\n        // Create user john\n        User john = new User(\"john\");\n        john.setEmail(\"john@acme.com\");\n        john.setFirstName(\"John\");\n        john.setLastName(\"User\");\n\n        IdentityManager identityManager = this.partitionManager.createIdentityManager();\n\n        identityManager.add(john);\n        identityManager.updateCredential(john, new Password(\"123456\"));\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/LoggedInAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.picketlink;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.security.api.authorization.AbstractAccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\nimport org.picketlink.Identity;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.inject.Inject;\nimport java.util.Set;\n\n@SessionScoped //or @WindowScoped\npublic class LoggedInAccessDecisionVoter extends AbstractAccessDecisionVoter\n{\n\n    @Inject\n    private ViewConfigResolver viewConfigResolver;\n\n    @Inject\n    private Identity identity;\n\n    // set a default\n    private Class<? extends ViewConfig> deniedPage = Pages.Secure.Home.class;\n\n    @Override\n    protected void checkPermission(AccessDecisionVoterContext context, Set<SecurityViolation> violations)\n    {\n\n        if (identity.isLoggedIn())\n        {\n            // no violations, pass\n        }\n        else\n        {\n            violations.add(new SecurityViolation()\n            {\n                @Override\n                public String getReason()\n                {\n                    return \"User must be logged in to access this resource\";\n                }\n            });\n\n            // remember the requested page\n            deniedPage = viewConfigResolver\n                    .getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId())\n                    .getConfigClass();\n        }\n    }\n\n    public Class<? extends ViewConfig> getDeniedPage()\n    {\n        return deniedPage;\n    }\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.example.security.requestedpage.picketlink;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\n@Folder(name = \"/\")\npublic interface Pages\n{\n    class Login extends DefaultErrorView\n    {\n    }\n\n    @Folder(name = \"/secured\")\n    @Secured(LoggedInAccessDecisionVoter.class)\n    interface Secure\n    {   \n        class Home implements ViewConfig\n        {\n        }\n        \n        class Test implements ViewConfig\n        {\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/beans.xml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n\n    <interceptors>\n        <class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>\n    </interceptors>\n\n</beans>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/faces-config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n\n</faces-config>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <context-param>\n        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>\n        <param-value>.xhtml</param-value>\n    </context-param>\n\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n\n    <welcome-file-list>\n        <welcome-file>index.html</welcome-file>\n    </welcome-file-list>\n</web-app>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html>\n<head>\n    <title>Index</title>\n</head>\n<body>\n<h1>Index</h1>\n\n<p>\n    These link points to secured pages and should redirect to login page:\n    <br>\n    <a href=\"secured/home.xhtml\">Go Home</a></br>\n    <a href=\"secured/test.xhtml\">Go Test Page</a>\n</p>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/login.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n<head>\n    <title>Login</title>\n</head>\n\n<body>\n<h1>Log in</h1>\n<h:messages globalOnly=\"true\"></h:messages>\n<h:form id=\"loginForm\">\n    <h:outputLabel value=\"Username:\" for=\"username\"/><br/>\n    <h:inputText value=\"#{loginCredentials.userId}\" id=\"username\"/><br/><br/>\n    <h:outputLabel value=\"Password:\" for=\"password\"/><br/>\n    <h:inputSecret value=\"#{loginCredentials.password}\" id=\"password\"/><br/>\n    <h:commandButton value=\"Log in\" action=\"#{identity.login()}\" id=\"loginBtn\"/>\n</h:form>\n\n<p>\n    <b>Hint:</b> log in as john / 123456\n</p>\n<br/>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n<head>\n    <title>Home Page</title>\n</head>\n\n<body>\n<h1>Hello!</h1>\n\n<p>Welcome Home</p>\n<h:form>\n    <h:commandButton value=\"logout\" action=\"#{identity.logout}\"/>\n</h:form>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/test.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n<head>\n    <title>Test Page</title>\n</head>\n\n<body>\n<h1>Hello!</h1>\n\n<p>Welcome to Secured Test Page</p>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "deltaspike/javadoc.sh",
    "content": "#!/bin/sh\n#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\nmvn clean javadoc:aggregate scm-publish:publish-scm -Dmdep.skip=true\n"
  },
  {
    "path": "deltaspike/modules/data/README.adoc",
    "content": "= DeltaSpike Data\n\n///////////\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n.\nhttp://www.apache.org/licenses/LICENSE-2.0\n.\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied.  See the License for the\nspecific language governing permissions and limitations\nunder the License.\n///////////\n\n== DeltaSpike Data\n\nPlease refer to the module documentation on the http://deltaspike.apache.org/data.html[DeltaSpike website].\n "
  },
  {
    "path": "deltaspike/modules/data/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>data-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-data-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Data-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.data.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.persistence.*,\n            !org.apache.deltaspike.data.*,\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencies>\n\n        <dependency>\n            <groupId>jakarta.persistence</groupId>\n            <artifactId>jakarta.persistence-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-partial-bean-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/AbstractEntityRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.io.Serializable;\r\n\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.persistence.TypedQuery;\r\nimport jakarta.persistence.criteria.CriteriaQuery;\r\n\r\n\r\n/**\r\n * Base Repository class to be extended by concrete implementations\r\n * (abstract classes with implementation methods).\r\n *\r\n * @param <E>   Entity type.\r\n * @param <PK>  Primary key type.\r\n */\r\n@Repository\r\npublic abstract class AbstractEntityRepository<E, PK extends Serializable>\r\n        implements EntityRepository<E, PK>, EntityPersistenceRepository<E, PK>,\r\n        EntityCountRepository<E>\r\n{\r\n\r\n    /**\r\n     * Utility method to get hold of the entity manager for this Repository.\r\n     * @return          Entity manager instance.\r\n     */\r\n    protected abstract EntityManager entityManager();\r\n\r\n    /**\r\n     * Utility method to create a criteria query.\r\n     * @return          Criteria query\r\n     */\r\n    protected abstract CriteriaQuery<E> criteriaQuery();\r\n\r\n    /**\r\n     * Utility method to create a typed query.\r\n     * @param qlString  Query string\r\n     * @return          Typed query\r\n     */\r\n    protected abstract TypedQuery<E> typedQuery(String qlString);\r\n\r\n    /**\r\n     * Get the entity class this Repository is related to.\r\n     * @return          Repository entity class.\r\n     */\r\n    protected abstract Class<E> entityClass();\r\n\r\n    /**\r\n     * Get the entity table name this Repository is related to.\r\n     * @return          Repository entity table name.\r\n     */\r\n    protected abstract String tableName();\r\n\r\n    /**\r\n     * Get the entity name this Repository is related to.\r\n     * @return          Repository entity name.\r\n     */\r\n    protected abstract String entityName();\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/AbstractFullEntityRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * Full repository base class to be extended by concrete implementations. A convenience class\r\n * combining {@code AbstractEntityRepository}, {@code EntityManagerDelegate} and\r\n * {@code CriteriaSupport}.\r\n * \r\n * @param <E>\r\n *            Entity type.\r\n * @param <PK>\r\n *            Primary key type.\r\n */\r\npublic abstract class AbstractFullEntityRepository<E, PK extends Serializable> extends\r\n    AbstractEntityRepository<E, PK> implements FullEntityRepository<E, PK>\r\n{\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityCountRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.api;\n\nimport jakarta.persistence.metamodel.SingularAttribute;\n\npublic interface EntityCountRepository<E>\n{\n    /**\n     * Count all existing entities of entity class {@code <E>}.\n     * @return                  Counter.\n     */\n    Long count();\n\n    /**\n     * Count existing entities of entity class {@code <E>}\n     * with for a given object and a specific set of properties..\n     * @param example           Sample entity. Query all like.\n     * @param attributes        Which attributes to consider for the query.\n     *\n     * @return                  Counter.\n     */\n    Long count(E example, SingularAttribute<E, ?>... attributes);\n\n    /**\n     * Count existing entities of entity class using the like operator for String attributes {@code <E>}\n     * with for a given object and a specific set of properties..\n     * @param example           Sample entity. Query all like.\n     * @param attributes        Which attributes to consider for the query.\n     *\n     * @return                  Counter.\n     */\n    Long countLike(E example, SingularAttribute<E, ?>... attributes);\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraph.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Defines an entity graph to be applied to a query. This annotation can be added to any query\n * method of a repository class.\n * <p>\n * The arguments {@code value} and {@code paths} are mutually exclusive. If {@code value} is set, it\n * references a named entity graph defined by JPA metadata.\n * <p>\n * If {@code paths} is set, an entity graph is constructed programmatically from the list of\n * attribute paths.\n * \n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface EntityGraph\n{\n    /**\n     * Name of a named entity graph.\n     * @return graph name\n     */\n    String value() default \"\";\n\n    /**\n     * Type of entity graph (fetch or load).\n     * @return graph type\n     */\n    EntityGraphType type() default EntityGraphType.FETCH;\n\n    /**\n     * List of attribute paths. Each path may have multiple components, separated\n     * by dots. A single component path adds an attribute node to the entity graph.\n     * A path {@code foo.bar.baz} adds an attribute node {@code baz} to a subgraph\n     * {@code bar} for the subgraph {@code foo}.\n     * \n     * @return list of paths\n     */\n    String[] paths() default { };\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraphType.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\n/**\n * Entity graph type (fetch graph or load graph). The type determines\n * the query hint name used to pass the entity graph to a query.\n */\npublic enum EntityGraphType\n{\n    /** Fetch graph. */\n    FETCH(\"jakarta.persistence.fetchgraph\"),\n\n    /** Load graph. */\n    LOAD(\"jakarta.persistence.loadgraph\");\n    \n    private String hintName;\n    \n    private EntityGraphType(String hintName)\n    {\n        this.hintName = hintName;\n    }\n    \n    /**\n     * Gets the query hint name corresponding to this type.\n     * @return hint name\n     */\n    public String getHintName()\n    {\n        return hintName;\n    }\n}"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityManagerConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport jakarta.persistence.FlushModeType;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver;\n\n/**\n * Configure the EntityManager for a specific repository.\n *\n * This class is deprecated, instead use {@link org.apache.deltaspike.jpa.api.entitymanager.EntityManagerConfig}\n */\n@Target(ElementType.TYPE)\n@Retention(RetentionPolicy.RUNTIME)\n@Documented\n@Inherited\n@Deprecated\npublic @interface EntityManagerConfig\n{\n    /**\n     * References the type which provides the EntityManager for a specific repository.\n     * Must be resolvable over the BeanManager.\n     */\n    Class<? extends EntityManagerResolver> entityManagerResolver() default EntityManagerResolver.class;\n\n    /**\n     * Set the flush mode for the repository EntityManager.\n     */\n    FlushModeType flushMode() default FlushModeType.AUTO;\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityManagerDelegate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.util.Map;\n\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.EntityTransaction;\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.metamodel.Metamodel;\n\n\n/**\n * Expose {@link jakarta.persistence.EntityManager} methods not present on repository base interfaces.\n * Calls the corresponding method on the repository EntityManager.\n *\n * @param <E> The Entity type.\n */\npublic interface EntityManagerDelegate<E>\n{\n    /**\n     * See {@link jakarta.persistence.EntityManager#persist(Object)}.\n     */\n    void persist(E entity);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#merge(Object)}.\n     */\n    E merge(E entity);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#find(Class, Object, java.util.Map)}.\n     */\n    E find(Object primaryKey, Map<String, Object> properties);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#find(Class, Object, LockModeType)}.\n     */\n    E find(Object primaryKey, LockModeType lockMode);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#find(Class, Object, LockModeType, Map)}.\n     */\n    E find(Object primaryKey, LockModeType lockMode, Map<String, Object> properties);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getReference(Class, Object)}.\n     */\n    E getReference(Object primaryKey);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#setFlushMode(FlushModeType)}.\n     */\n    void setFlushMode(FlushModeType flushMode);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getFlushMode()}.\n     */\n    FlushModeType getFlushMode();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#lock(Object, LockModeType)}.\n     */\n    void lock(Object entity, LockModeType lockMode);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#lock(Object, LockModeType, Map)}.\n     */\n    void lock(Object entity, LockModeType lockMode, Map<String, Object> properties);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#refresh(Object, Map)}.\n     */\n    void refresh(E entity, Map<String, Object> properties);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#refresh(Object, LockModeType)}.\n     */\n    void refresh(E entity, LockModeType lockMode);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#refresh(Object, LockModeType, Map)}.\n     */\n    void refresh(E entity, LockModeType lockMode, Map<String, Object> properties);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#clear()}.\n     */\n    void clear();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#detach(Object)}.\n     */\n    void detach(E entity);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#contains(Object)}.\n     */\n    boolean contains(E entity);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getLockMode(Object)}.\n     */\n    LockModeType getLockMode(E entity);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#setProperty(String, Object)}.\n     */\n    void setProperty(String propertyName, Object value);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getProperties()}.\n     */\n    Map<String, Object> getProperties();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#joinTransaction()}.\n     */\n    void joinTransaction();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#unwrap(Class)}.\n     */\n    <T> T unwrap(Class<T> cls);\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getDelegate()}.\n     */\n    Object getDelegate();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#close()}.\n     */\n    void close();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#isOpen()}.\n     */\n    boolean isOpen();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getTransaction()}.\n     */\n    EntityTransaction getTransaction();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getEntityManagerFactory()}.\n     */\n    EntityManagerFactory getEntityManagerFactory();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getCriteriaBuilder()}.\n     */\n    CriteriaBuilder getCriteriaBuilder();\n\n    /**\n     * See {@link jakarta.persistence.EntityManager#getMetamodel()}.\n     */\n    Metamodel getMetamodel();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityManagerResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\n/**\n * Resolve the EntityManager used for a specific repository.\n * Only necessary if there is more than one persistence unit.\n *\n * This interface is deprecated and instead you should use the version from JPA module\n */\n@Deprecated\npublic interface EntityManagerResolver extends org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityPersistenceRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.api;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport java.io.Serializable;\n\npublic interface EntityPersistenceRepository<E, PK extends Serializable> extends Deactivatable\n{\n    /**\n     * Persist (new entity) or merge the given entity. The distinction on calling either\n     * method is done based on the primary key field being null or not.\n     * If this results in wrong behavior for a specific case, consider using the\n     * {@link org.apache.deltaspike.data.api.EntityManagerDelegate} which offers both\n     * {@code persist} and {@code merge}.\n     * @param entity            Entity to save.\n     * @return                  Returns the modified entity.\n     */\n    E save(E entity);\n\n    /**\n     * {@link #save(Object)}s the given entity and flushes the persistence context afterwards.\n     * @param entity            Entity to save.\n     * @return                  Returns the modified entity.\n     */\n    E saveAndFlush(E entity);\n\n    /**\n     * {@link #save(Object)}s the given entity and flushes the persistence context afterwards,\n     * followed by a refresh (e.g. to load DB trigger modifications).\n     * @param entity            Entity to save.\n     * @return                  Returns the modified entity.\n     */\n    E saveAndFlushAndRefresh(E entity);\n\n    /**\n     * Convenience access to {@link jakarta.persistence.EntityManager#remove(Object)}.\n     * @param entity            Entity to remove.\n     */\n    void remove(E entity);\n\n    /**\n     * Convenience access to {@link jakarta.persistence.EntityManager#remove(Object)}\n     * with a following flush.\n     * @param entity            Entity to remove.\n     */\n    void removeAndFlush(E entity);\n\n    /**\n     * Convenience access to {@link jakarta.persistence.EntityManager#remove(Object)}\n     * with an detached entity.\n     * @param entity            Entity to remove.\n     */\n    void attachAndRemove(E entity);\n\n    /**\n     * Convenience access to {@link jakarta.persistence.EntityManager#refresh(Object)}.\n     * @param entity            Entity to refresh.\n     */\n    void refresh(E entity);\n\n    /**\n     * Convenience access to {@link jakarta.persistence.EntityManager#flush()}.\n     */\n    void flush();\n\n    /**\n     * Return the id of the entity. Returns null if the entity does not yet have an id.\n     * @param example           Sample entity.\n     * @return                  id of the entity\n     */\n    PK getPrimaryKey(E example);\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.List;\r\nimport java.util.Optional;\r\n\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\n/**\r\n * Base Repository interface. All methods are implemented by the CDI extension.\r\n *\r\n * @param <E>   Entity type.\r\n * @param <PK>  Primary key type.\r\n */\r\npublic interface EntityRepository<E, PK extends Serializable> extends EntityPersistenceRepository<E, PK>,\r\n        EntityCountRepository<E>\r\n{\r\n\r\n    /**\r\n     * Entity lookup by primary key. Convenicence method around\r\n     * {@link jakarta.persistence.EntityManager#find(Class, Object)}.\r\n     * @param primaryKey        DB primary key.\r\n     * @return                  Entity identified by primary or null if it does not exist.\r\n     */\r\n    E findBy(PK primaryKey);\r\n    \r\n    /**\r\n     * Entity lookup by primary key. Convenicence method around\r\n     * {@link jakarta.persistence.EntityManager#find(Class, Object)}.\r\n     * @param primaryKey        DB primary key.\r\n     * @return                  Entity identified by primary or null if it does not exist, wrapped by Optional.\r\n     */\r\n    Optional<E> findOptionalBy(PK primaryKey);\r\n\r\n    /**\r\n     * Lookup all existing entities of entity class {@code <E>}.\r\n     * @return                  List of entities, empty if none found.\r\n     */\r\n    List<E> findAll();\r\n\r\n    /**\r\n     * Lookup a range of existing entities of entity class {@code <E>} with support for pagination.\r\n     * @param start             The starting position.\r\n     * @param max               The maximum number of results to return\r\n     * @return                  List of entities, empty if none found.\r\n     */\r\n    List<E> findAll(int start, int max);\r\n\r\n    /**\r\n     * Query by example - for a given object and a specific set of properties.\r\n     * @param example           Sample entity. Query all like.\r\n     * @param attributes        Which attributes to consider for the query.\r\n     * @return                  List of entities matching the example, or empty if none found.\r\n     */\r\n    List<E> findBy(E example, SingularAttribute<E, ?>... attributes);\r\n\r\n    /**\r\n     * Query by example - for a given object and a specific set of properties with support for pagination.\r\n     * @param example           Sample entity. Query all like.\r\n     * @param start             The starting position.\r\n     * @param max               The maximum number of results to return\r\n     * @param attributes        Which attributes to consider for the query.\r\n     * @return                  List of entities matching the example, or empty if none found.\r\n     */\r\n    List<E> findBy(E example, int start, int max, SingularAttribute<E, ?>... attributes);\r\n\r\n    /**\r\n     * Query by example - for a given object and a specific set of properties using a like operator for Strings.\r\n     * @param example           Sample entity. Query all like.\r\n     * @param attributes        Which attributes to consider for the query.\r\n     * @return                  List of entities matching the example, or empty if none found.\r\n     */\r\n    List<E> findByLike(E example, SingularAttribute<E, ?>... attributes);\r\n\r\n    /**\r\n     * Query by example - for a given object and a specific set of properties\r\n     * using a like operator for Strings with support for pagination.\r\n     * @param example           Sample entity. Query all like.\r\n     * @param start             The starting position.\r\n     * @param max               The maximum number of results to return\r\n     * @param attributes        Which attributes to consider for the query.\r\n     * @return                  List of entities matching the example, or empty if none found.\r\n     */\r\n    List<E> findByLike(E example, int start, int max, SingularAttribute<E, ?>... attributes);\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/FirstResult.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\n/**\r\n * Use paging for the query. Must be applied to an Integer parameter.\r\n */\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target(ElementType.PARAMETER)\r\npublic @interface FirstResult\r\n{\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/FullEntityRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.io.Serializable;\r\n\r\nimport org.apache.deltaspike.data.api.criteria.CriteriaSupport;\r\n\r\n/**\r\n * Full repository interface. A convenience class combining {@code EntityRepository},\r\n * {@code EntityManagerDelegate} and {@code CriteriaSupport}.\r\n * \r\n * @param <E>   Entity type.\r\n * @param <PK>  Primary key type.\r\n */\r\npublic interface FullEntityRepository<E, PK extends Serializable> \r\n    extends EntityRepository<E, PK>, EntityManagerDelegate<E>, CriteriaSupport<E>\r\n{\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/MaxResults.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\n/**\r\n * Limit the size of the result set. Must be applied to an Integer parameter.\r\n */\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target(ElementType.PARAMETER)\r\npublic @interface MaxResults\r\n{\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/Modifying.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks a query method to be modifying. This will execute the\n * {@link jakarta.persistence.Query#executeUpdate()} method instead of\n * {@link jakarta.persistence.Query#getResultList()} (or the corresponding single result method).\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface Modifying\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/Query.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.QueryHint;\n\n/**\n * Supply query meta data to a method with this annotation.<br/>\n * Currently supports:\n * <ul><li>JPQL queries as part of the annotation value</li>\n * <li>Execute named queries referenced by the named value</li>\n * <li>Execute native SQL queries</li>\n * <li>Restrict the result size to a static value</li>\n * <li>Provide a lock mode</li></ul>\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\n@Inherited\npublic @interface Query\n{\n\n    /**\n     * Defines the Query to execute. Can be left empty for method expression queries\n     * or when referencing a {@link #named()} query.\n     */\n    String value() default \"\";\n\n    /**\n     * References a named query.\n     */\n    String named() default \"\";\n\n    /**\n     * Defines a native SQL query.\n     */\n    boolean isNative() default false;\n\n    /**\n     * Limits the number of results the query returns.\n     */\n    int max() default 0;\n\n    /**\n     * Defines a lock mode for the query.\n     */\n    LockModeType lock() default LockModeType.NONE;\n\n    /**\n     * (Optional) Query properties and hints.  May include vendor-specific query hints.\n     */\n    QueryHint[] hints() default {\n    };\n\n    /**\n     * Defines how a single result query is fetched. Defaults to the JPA way with\n     * Exceptions thrown on non-single result queries.\n     */\n    SingleResultType singleResult() default SingleResultType.JPA;\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/QueryInvocationException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.lang.reflect.Method;\n\nimport org.apache.deltaspike.data.spi.QueryInvocationContext;\n\npublic class QueryInvocationException extends RuntimeException\n{\n\n    private static final long serialVersionUID = 1L;\n\n    public QueryInvocationException(Throwable t, QueryInvocationContext context)\n    {\n        super(createMessage(context, t), t);\n    }\n\n    public QueryInvocationException(String message, QueryInvocationContext context)\n    {\n        super(createMessage(context));\n    }\n\n    public QueryInvocationException(Throwable t, Class<?> proxy, Method method)\n    {\n        super(createMessage(proxy, method, t), t);\n    }\n\n    private static String createMessage(QueryInvocationContext context)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"Failed calling Repository: [\");\n        builder.append(\"Repository=\").append(context.getRepositoryClass().getName()).append(\",\");\n        builder.append(\"entity=\").append(context.getEntityClass().getName()).append(\",\");\n        builder.append(\"method=\").append(context.getMethod().getName()).append(\",\");\n        return builder.toString();\n    }\n\n    private static String createMessage(QueryInvocationContext context, Throwable t)\n    {\n        StringBuilder builder = new StringBuilder(createMessage(context));\n        builder.append(\"exception=\").append(t.getClass()).append(\",message=\").append(t.getMessage());\n        return builder.toString();\n    }\n\n    private static String createMessage(Class<?> repoClass, Method method, Throwable t)\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"Exception calling Repository: [\");\n        builder.append(\"Repository=\").append(repoClass).append(\",\");\n        builder.append(\"method=\").append(method.getName()).append(\"],\");\n        builder.append(\"exception=\").append(t.getClass()).append(\",message=\").append(t.getMessage());\n        return builder.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/QueryParam.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Mark a method parameter as a query parameter.\n * Can be named by the annotation value.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.PARAMETER)\npublic @interface QueryParam\n{\n    String value() default \"\";\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/QueryResult.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\nimport java.util.List;\n\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\n/**\n * Can be used as query result type, which will not execute the query immediately.\n * Allows some post processing like defining query ordering.\n *\n * @param <E> Entity type\n */\npublic interface QueryResult<E>\n{\n\n    /**\n     * Sort the query result ascending by the given entity singular attribute.\n     * This is the typesafe version, alternatively a {@link #orderAsc(String)}\n     * String can be used.\n     *\n     * @param attribute Sort attribute.\n     * @return Fluent API: the result instance.\n     */\n    <X> QueryResult<E> orderAsc(SingularAttribute<E, X> attribute);\n\n    /**\n     * Sort the query result ascending by the given entity singular attribute.\n     * This is the typesafe version, alternatively a {@link #orderAsc(String)}\n     * String can be used.\n     *\n     * @param attribute        Sort attribute.\n     * @param appendEntityName whether the entity name 'e' should be appended to this attribute\n     * @return Fluent API: the result instance.\n     */\n    <X> QueryResult<E> orderAsc(SingularAttribute<E, X> attribute, boolean appendEntityName);\n\n    /**\n     * Sort the query result ascending by the given entity attribute.\n     *\n     * @param attribute Sort attribute.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> orderAsc(String attribute);\n\n    /**\n     * Sort the query result ascending by the given entity attribute.\n     *\n     * @param attribute        Sort attribute.\n     * @param appendEntityName whether the entity name 'e' should be appended to this attribute\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> orderAsc(String attribute, boolean appendEntityName);\n\n    /**\n     * Sort the query result descending by the given entity singular attribute.\n     * This is the typesafe version, alternatively a {@link #orderDesc(String)}\n     * String can be used.\n     *\n     * @param attribute Sort attribute.\n     * @return Fluent API: the result instance.\n     */\n    <X> QueryResult<E> orderDesc(SingularAttribute<E, X> attribute);\n\n    /**\n     * Sort the query result descending by the given entity singular attribute.\n     * This is the typesafe version, alternatively a {@link #orderDesc(String)}\n     * String can be used.\n     *\n     * @param attribute        Sort attribute.\n     * @param appendEntityName whether the entity name 'e' should be appended to this attribute\n     * @return Fluent API: the result instance.\n     */\n    <X> QueryResult<E> orderDesc(SingularAttribute<E, X> attribute, boolean appendEntityName);\n\n    /**\n     * Sort the query result descending by the given entity attribute.\n     *\n     * @param attribute Sort attribute.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> orderDesc(String attribute);\n\n    /**\n     * Sort the query result descending by the given entity attribute.\n     *\n     * @param attribute        Sort attribute.\n     * @param appendEntityName whether the entity name 'e' should be appended to this attribute\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> orderDesc(String attribute, boolean appendEntityName);\n\n    /**\n     * Revert an existing order attribute sort direction. Defaults to ascending\n     * order if the sort attribute was not used before.\n     *\n     * @param attribute Sort attribute.\n     * @return Fluent API: the result instance.\n     */\n    <X> QueryResult<E> changeOrder(SingularAttribute<E, X> attribute);\n\n    /**\n     * Remove any ordering from the query result object.\n     *\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> clearOrder();\n\n    /**\n     * Revert an existing order attribute sort direction. Defaults to ascending\n     * order if the sort attribute was not used before.\n     *\n     * @param attribute Sort attribute.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> changeOrder(String attribute);\n\n    /**\n     * Limit the number of results returned by the query.\n     *\n     * @param max Max number of results.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> maxResults(int max);\n\n    /**\n     * Pagination: Set the result start position.\n     *\n     * @param first Result start position.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> firstResult(int first);\n\n    /**\n     * Sets the query lock mode.\n     *\n     * @param lockMode Query lock mode to use in the query.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> lockMode(LockModeType lockMode);\n\n    /**\n     * Sets the query flush mode.\n     *\n     * @param flushMode Query flush mode to use in the query.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> flushMode(FlushModeType flushMode);\n\n    /**\n     * Apply a query hint to the query to execute.\n     *\n     * @param hint  Hint name.\n     * @param value Hint value.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> hint(String hint, Object value);\n\n    /**\n     * Fetch the result set.\n     *\n     * @return List of entities retrieved by the query.\n     */\n    List<E> getResultList();\n\n    /**\n     * Fetch a single result entity.\n     *\n     * @return Entity retrieved by the query.\n     */\n    E getSingleResult();\n\n    /**\n     * Fetch a single result entity. Returns {@code null} if no result is found.\n     *\n     * @return Entity retrieved by the query, or {@code null} if no result.\n     */\n    E getOptionalResult();\n\n    /**\n     * Fetch a single result entity. Returns {@code null} if no result is found. If the\n     * query finds multiple results, it simply returns the first one found.\n     *\n     * @return First Entity retrieved by the query, or {@code null} if no result.\n     */\n    E getAnyResult();\n\n    /**\n     * Count the result set.\n     *\n     * @return Result count.\n     */\n    long count();\n\n    /**\n     * Set a page size on the query result. Defaults to 10 or takes the value of a\n     * previous {@link #maxResults(int)} call.\n     *\n     * @param pageSize Page size for further queries.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> withPageSize(int pageSize);\n\n    /**\n     * Move the page cursor to a specific page.\n     *\n     * @param page Page to move to for the next query.\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> toPage(int page);\n\n    /**\n     * Move to the next page.\n     *\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> nextPage();\n\n    /**\n     * Move to the previous page.\n     *\n     * @return Fluent API: the result instance.\n     */\n    QueryResult<E> previousPage();\n\n    /**\n     * Count the number of pages.\n     *\n     * @return Page count.\n     */\n    int countPages();\n\n    /**\n     * Return the actual page.\n     *\n     * @return Page position.\n     */\n    int currentPage();\n\n    /**\n     * Return the actual page size.\n     *\n     * @return Page size.\n     */\n    int pageSize();\n\n}"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/Repository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.api;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Inherited;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\nimport org.apache.deltaspike.partialbean.api.PartialBeanBinding;\r\n\r\nimport jakarta.enterprise.context.Dependent;\r\nimport jakarta.enterprise.inject.Stereotype;\r\n\r\n/**\r\n * The Repository annotation needs to be present in order to have the\r\n * interface or class to be processed by the CDI extension.\r\n */\r\n@Stereotype\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target(ElementType.TYPE)\r\n@Inherited\r\n@Dependent\r\n@PartialBeanBinding\r\npublic @interface Repository\r\n{\r\n    /**\r\n     * Relates the repository to a specific Entity. Can be left to\r\n     * default when the Entity is determined by one of the base\r\n     * repository classes.\r\n     */\r\n    Class<?> forEntity() default Object.class;\r\n\r\n    /**\r\n     * The method prefix for method expressions. Can be adapted to\r\n     * domain specific conventions.\r\n     */\r\n    String methodPrefix() default \"\";\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/SingleResultType.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api;\n\n/**\n * Defines the way a single result query is fetched.\n */\npublic enum SingleResultType\n{\n\n    /**\n     * Expects a single result, throws a {@link jakarta.persistence.NoResultException} or\n     * {@link jakarta.persistence.NonUniqueResultException} otherwise. This is the JPA\n     * default behavior.\n     */\n    JPA,\n\n    /**\n     * Expects a single result. Other than {@link SingleResultType#JPA} it returns {@code null}\n     * if no result is found.\n     */\n    OPTIONAL,\n\n    /**\n     * Returns any result, or {@code null} if nothing is found. If more than one result is found,\n     * it returns the first one from the result list.\n     */\n    ANY\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/audit/CreatedBy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.audit;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks a property which should be updated with the current when the entity gets persisted.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.FIELD, ElementType.METHOD })\npublic @interface CreatedBy\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/audit/CreatedOn.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.audit;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks a property which should be updated with a timestamp when the entity gets persisted.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.FIELD, ElementType.METHOD })\npublic @interface CreatedOn\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/audit/CurrentUser.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.audit;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport jakarta.inject.Qualifier;\n\n/**\n * Identifies the current user responsible for entity creation or modification.\n */\n@Qualifier\n@Target({ TYPE, METHOD, PARAMETER, FIELD })\n@Retention(RUNTIME)\n@Documented\npublic @interface CurrentUser\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/audit/ModifiedBy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.audit;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks a property which should keep track on the last changing user.\n * By setting {@link #onCreate()} to {@code false}, the property gets NOT set when\n * the entity is persisted.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.FIELD, ElementType.METHOD })\npublic @interface ModifiedBy\n{\n    boolean onCreate() default true;\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/audit/ModifiedOn.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.audit;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks a property which should be updated with a timestamp when the entity gets updated.\n * By setting {@link #onCreate()} to {@code true}, the property gets also set when\n * the entity is persisted.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.FIELD, ElementType.METHOD })\npublic @interface ModifiedOn\n{\n    /**\n     * Tells whether or not the property shall be set when the entity is first persisted.\n     * @deprecated If the property shall be set when the entity is first persisted, use {@link CreatedOn}.\n     * @return set this to {@code true} if the property shall be set when the entity is first persisted.\n     */\n    boolean onCreate() default false;\n}"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/Criteria.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.criteria;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport jakarta.persistence.TypedQuery;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.JoinType;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Predicate;\nimport jakarta.persistence.metamodel.CollectionAttribute;\nimport jakarta.persistence.metamodel.ListAttribute;\nimport jakarta.persistence.metamodel.MapAttribute;\nimport jakarta.persistence.metamodel.PluralAttribute;\nimport jakarta.persistence.metamodel.SetAttribute;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\n/**\n * Criteria API utilities.\n *\n * @param <C> Entity type.\n * @param <R> Result type.\n */\npublic interface Criteria<C, R>\n{\n\n    /**\n     * Executes the query and returns the result list.\n     * @return List of entities matching the query.\n     */\n    List<R> getResultList();\n\n    /**\n     * Executes the query which has a single result.\n     * @return Entity matching the search query.\n     */\n    R getSingleResult();\n\n    /**\n     * Executes the query which has a single result. Returns {@code null}\n     * if there is no result.\n     * @return Entity matching the search query, or {@code null} if there is none.\n     */\n    R getOptionalResult();\n\n    /**\n     * Executes the query and returns a single result. If there are\n     * multiple results, the first received is returned.\n     * @return Entity matching the search query.\n     */\n    R getAnyResult();\n\n    /**\n     * Creates a JPA query object to be executed.\n     * @return A {@link TypedQuery} object ready to return results.\n     */\n    TypedQuery<R> createQuery();\n\n    /**\n     * Boolean OR with another Criteria.\n     * @param criteria      The right side of the boolean OR.\n     * @return              Fluent API: Criteria instance.\n     */\n    Criteria<C, R> or(Criteria<C, R>... criteria);\n\n    /**\n     * Boolean OR with another Criteria.\n     * @param criteria      The right side of the boolean OR.\n     * @return              Fluent API: Criteria instance.\n     */\n    Criteria<C, R> or(Collection<Criteria<C, R>> criteria);\n\n    /**\n     * Join an attribute with another Criteria.\n     * @param att           The attribute to join.\n     * @param criteria      The join criteria.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> join(SingularAttribute<? super C, P> att, Criteria<P, P> criteria);\n\n    /**\n     * Join a collection attribute with another Criteria.\n     * @param att           The attribute to join.\n     * @param criteria      The join criteria.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> join(ListAttribute<? super C, P> att, Criteria<P, P> criteria);\n\n    /**\n     * Join a collection attribute with another Criteria.\n     * @param att           The attribute to join.\n     * @param criteria      The join criteria.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> join(CollectionAttribute<? super C, P> att, Criteria<P, P> criteria);\n\n    /**\n     * Join a collection attribute with another Criteria.\n     * @param att           The attribute to join.\n     * @param criteria      The join criteria.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> join(SetAttribute<? super C, P> att, Criteria<P, P> criteria);\n\n    /**\n     * Join a collection attribute with another Criteria.\n     * @param att           The attribute to join.\n     * @param criteria      The join criteria.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> join(MapAttribute<? super C, E, P> att, Criteria<P, P> criteria);\n\n\n    /**\n     * Fetch join an attribute.\n     * @param att           The attribute to fetch.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> fetch(SingularAttribute<? super C, P> att);\n\n    /**\n     * Fetch join an attribute.\n     * @param att           The attribute to fetch.\n     * @param joinType      The JoinType to use.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> fetch(SingularAttribute<? super C, P> att, JoinType joinType);\n\n    /**\n     * Fetch join an attribute.\n     * @param att           The attribute to fetch.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> fetch(PluralAttribute<? super C, P, E> att);\n\n    /**\n     * Fetch join an attribute.\n     * @param att           The attribute to fetch.\n     * @param joinType      The JoinType to use.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P, E> Criteria<C, R> fetch(PluralAttribute<? super C, P, E> att, JoinType joinType);\n\n    /**\n     * Apply sorting by an attribute, ascending direction.\n     * @param att           The attribute to order for.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> orderAsc(SingularAttribute<? super C, P> att);\n\n    /**\n     * Apply sorting by an attribute, descending direction.\n     * @param att           The attribute to order for.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> orderDesc(SingularAttribute<? super C, P> att);\n\n    /**\n     * Create a select query.\n     * @param resultClass   The query result class.\n     * @param selection     List of selects (attributes, scalars...)\n     * @return              Fluent API: Criteria instance.\n     */\n    <N> Criteria<C, N> select(Class<N> resultClass, QuerySelection<? super C, ?>... selection);\n\n    /**\n     * Create a select query.\n     * @param selection     List of selects (attributes, scalars...)\n     * @return              Fluent API: Criteria instance.\n     */\n    Criteria<C, Object[]> select(QuerySelection<? super C, ?>... selection);\n\n    /**\n     * Apply a distinct on the query.\n     * @return              Fluent API: Criteria instance.\n     */\n    Criteria<C, R> distinct();\n\n    /**\n     * Equals predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> eq(SingularAttribute<? super C, P> att, P value);\n\n    /**\n     * Equals predicate, case insensitive.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> eqIgnoreCase(SingularAttribute<? super C, String> att, String value);\n\n    /**\n     * Not Equals predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> notEq(SingularAttribute<? super C, P> att, P value);\n\n    /**\n     * Not Equals predicate, case insensitive.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> notEqIgnoreCase(SingularAttribute<? super C, String> att, String value);\n\n    /**\n     * Like predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> like(SingularAttribute<? super C, String> att, String value);\n\n    /**\n     * Like predicate, case insensitive.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> likeIgnoreCase(SingularAttribute<? super C, String> att, String value);\n\n    /**\n     * Not like predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> notLike(SingularAttribute<? super C, String> att, String value);\n\n    /**\n     * Not like predicate, case insensitive.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> notLikeIgnoreCase(SingularAttribute<? super C, String> att, String value);\n\n    /**\n     * Less than predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Comparable<? super P>> Criteria<C, R> lt(SingularAttribute<? super C, P> att, P value);\n\n    /**\n     * Less than or equals predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Comparable<? super P>> Criteria<C, R> ltOrEq(SingularAttribute<? super C, P> att, P value);\n\n    /**\n     * Greater than predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Comparable<? super P>> Criteria<C, R> gt(SingularAttribute<? super C, P> att, P value);\n\n    /**\n     * Greater than or equals predicate.\n     * @param att           The attribute to compare with.\n     * @param value         The comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Comparable<? super P>> Criteria<C, R> gtOrEq(SingularAttribute<? super C, P> att, P value);\n\n    /**\n     * Between predicate.\n     * @param att           The attribute to compare with.\n     * @param lower         The lower bound comparison value.\n     * @param upper         The upper bound comparison value.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Comparable<? super P>> Criteria<C, R> between(SingularAttribute<? super C, P> att, P lower, P upper);\n\n    /**\n     * IsNull predicate.\n     * @param att           The null attribute.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> isNull(SingularAttribute<? super C, P> att);\n\n    /**\n     * NotNull predicate.\n     * @param att           The non-null attribute.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P> Criteria<C, R> notNull(SingularAttribute<? super C, P> att);\n\n    /**\n     * Empty predicate.\n     * @param att           The collection attribute to check for emptyness.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Collection<?>> Criteria<C, R> empty(SingularAttribute<? super C, P> att);\n\n    /**\n     * Not empty predicate.\n     * @param att           The collection attribute to check for non-emptyness.\n     * @return              Fluent API: Criteria instance.\n     */\n    <P extends Collection<?>> Criteria<C, R> notEmpty(SingularAttribute<? super C, P> att);\n\n    /**\n     * In predicte.\n     * @param att           The attribute to check for.\n     * @param values        The values for the in predicate.\n     * @return\n     */\n    <P> Criteria<C, R> in(SingularAttribute<? super C, P> att, P... values);\n\n    /**\n     * Return the list of predicates applicable for this Criteria instance.\n     * @param builder       A CriteriaBuilder used to instantiate the Predicates.\n     * @param path          Current path.\n     * @return              List of predicates applicable to this Criteria.\n     */\n    List<Predicate> predicates(CriteriaBuilder builder, Path<C> path);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/CriteriaSupport.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.criteria;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.JoinType;\nimport jakarta.persistence.metamodel.SingularAttribute;\nimport java.sql.Date;\nimport java.sql.Time;\nimport java.sql.Timestamp;\n\n/**\n * Interface to be added to a repository for criteria support.\n *\n * @param <E> Entity type.\n */\npublic interface CriteriaSupport<E>\n{\n\n    /**\n     * Create a {@link Criteria} instance.\n     *\n     * @return Criteria instance related to the Repository entity class.\n     */\n    Criteria<E, E> criteria();\n\n    /**\n     * Create a {@link Criteria} instance.\n     *\n     * @param <T>   Type related to the current criteria class.\n     * @param clazz Class other than the current entity class.\n     * @return Criteria instance related to a join type of the current entity class.\n     */\n    <T> Criteria<T, T> where(Class<T> clazz);\n\n    /**\n     * Create a {@link Criteria} instance with a join type.\n     *\n     * @param <T>      Type related to the current criteria class.\n     * @param clazz    Class other than the current entity class.\n     * @param joinType Join type to apply.\n     * @return Criteria instance related to a join type of the current entity class.\n     */\n    <T> Criteria<T, T> where(Class<T> clazz, JoinType joinType);\n\n    /**\n     * Create a query selection for an Entity attribute.\n     *\n     * @param attribute Attribute to show up in the result selection\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <X> QuerySelection<E, X> attribute(SingularAttribute<? super E, X> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#abs(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <N extends Number> QuerySelection<E, N> abs(SingularAttribute<? super E, N> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#avg(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <N extends Number> QuerySelection<E, N> avg(SingularAttribute<? super E, N> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#count(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, Long> count(SingularAttribute<? super E, ?> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#countDistinct(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, Long> countDistinct(SingularAttribute<? super E, ?> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#max(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <N extends Number> QuerySelection<E, N> max(SingularAttribute<? super E, N> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#min(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <N extends Number> QuerySelection<E, N> min(SingularAttribute<? super E, N> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#neg(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <N extends Number> QuerySelection<E, N> neg(SingularAttribute<? super E, N> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#sum(jakarta.persistence.criteria.Expression)}\n     * over an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    <N extends Number> QuerySelection<E, N> sum(SingularAttribute<? super E, N> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#mod(jakarta.persistence.criteria.Expression, Integer)}\n     * for an attribute.\n     *\n     * @param attribute Attribute to use in the aggregate.\n     * @param modulo    Modulo what.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, Integer> modulo(SingularAttribute<? super E, Integer> attribute, Integer modulo);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#upper(jakarta.persistence.criteria.Expression)}\n     * over a String attribute.\n     *\n     * @param attribute Attribute to uppercase.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, String> upper(SingularAttribute<? super E, String> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#lower(jakarta.persistence.criteria.Expression)}\n     * over a String attribute.\n     *\n     * @param attribute Attribute to lowercase.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, String> lower(SingularAttribute<? super E, String> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#substring(jakarta.persistence.criteria.Expression, int)}\n     * over a String attribute.\n     *\n     * @param attribute Attribute to create a substring from.\n     * @param from      Substring start.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, String> substring(SingularAttribute<? super E, String> attribute, int from);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#substring(jakarta.persistence.criteria.Expression, int, int)}\n     * over a String attribute.\n     *\n     * @param attribute Attribute to create a substring from.\n     * @param from      Substring start.\n     * @param length    Substring length.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, String> substring(SingularAttribute<? super E, String> attribute, int from, int length);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#trim(jakarta.persistence.criteria.Expression)}\n     * over a String attribute.\n     *\n     * @param attribute Attribute to apply trim.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, String> trim(SingularAttribute<? super E, String> attribute);\n\n    /**\n     * Create a query selection for the\n     * {@link jakarta.persistence.criteria.CriteriaBuilder#trim(jakarta.persistence.criteria.CriteriaBuilder.Trimspec,\n     * jakarta.persistence.criteria.Expression)}\n     * over a String attribute.\n     *\n     * @param trimspec  Used to specify how strings are trimmed.\n     * @param attribute Attribute to apply trim.\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, String> trim(CriteriaBuilder.Trimspec trimspec, SingularAttribute<? super E, String> attribute);\n\n\n    /**\n     * Create a query selection for the {@link jakarta.persistence.criteria.CriteriaBuilder#currentDate()}.\n     *\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, Date> currDate();\n\n    /**\n     * Create a query selection for the {@link jakarta.persistence.criteria.CriteriaBuilder#currentTime()}.\n     *\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, Time> currTime();\n\n    /**\n     * Create a query selection for the {@link jakarta.persistence.criteria.CriteriaBuilder#currentTimestamp()}.\n     *\n     * @return {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)} call.\n     */\n    QuerySelection<E, Timestamp> currTStamp();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/QuerySelection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.criteria;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\n\n/**\n * Used for selection queries with the simplified Criteria API.\n *\n * @param <P>   Entity type.\n * @param <X>   Result type.\n */\npublic interface QuerySelection<P, X>\n{\n\n    /**\n     * Convert the instance to a criteria selection.\n     * @param query         The current criteria query.\n     * @param builder       The query builder used to instantiate the selection.\n     * @param path          Current path.\n     * @return              Criteria API selection instance corresponding to the\n     *                      QuerySelection implementation.\n     */\n    <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/mapping/MappingConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.mapping;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Defines mapping configuration for query result and input parameters.\n */\n@Target({ ElementType.TYPE, ElementType.METHOD })\n@Retention(RetentionPolicy.RUNTIME)\n@Documented\n@Inherited\npublic @interface MappingConfig\n{\n\n    Class<? extends QueryInOutMapper<?>> value();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/mapping/QueryInOutMapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.mapping;\n\nimport java.util.List;\n\n/**\n * Handles concrete mapping of query results and\n * query input parameters.\n */\npublic interface QueryInOutMapper<E>\n{\n\n    /**\n     * Map a single result query.\n     * @param result        The query result to map.\n     * @return              The mapped result object.\n     */\n    Object mapResult(E result);\n\n    /**\n     * Map a query result list.\n     * @param result        The query result list to map.\n     * @return              The mapped result. Does not have to be a collection.\n     */\n    Object mapResultList(List<E> result);\n\n    /**\n     * Check if this mapper handles a specific input parameter.\n     * @param parameter     The parameter candidate for mapping.\n     * @return              {@code true} if the mapper handles the parameter.\n     */\n    boolean mapsParameter(Object parameter);\n\n    /**\n     * Map a query parameter.\n     * @param parameter     The parameter to map. It can be assumed that the\n     *                      {@link #mapsParameter(Object)} method has been\n     *                      called before with this parameter.\n     * @return              The mapped result.\n     */\n    Object mapParameter(Object parameter);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/mapping/SimpleQueryInOutMapperBase.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.mapping;\n\nimport java.lang.reflect.Constructor;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.spi.QueryInvocationContext;\n\n/**\n * A base mapper to map from Dto to Entity and vice versa. This should be sufficient\n * for most mapping cases and simplify the implementation of a mapper.\n *\n * @param <Entity>      The Entity type.\n * @param <Dto>         The Dto type.\n */\npublic abstract class SimpleQueryInOutMapperBase<Entity, Dto> implements QueryInOutMapper<Entity>\n{\n    @Inject\n    private QueryInvocationContext context;\n\n    /**\n     * Return the primary key of the Entity corresponding to the Dto. If this is a new\n     * Entity, return {@code null}.\n     * @param dto       The Dto to map to an Entity.\n     * @return          The Entity primary key, or {@code null} for a new Entity.\n     */\n    protected abstract Object getPrimaryKey(Dto dto);\n\n    protected abstract Dto toDto(Entity entity);\n\n    /**\n     * Map a Dto to an Entity. In case the Dto contains a valid primary key,\n     * the Entity will be retrieved first and used as method parameter. Otherwise\n     * Entity is a unmanaged new instance.\n     *\n     * @param entity    Either a managed Entity looked up by the primary key,\n     *                  or a new Entity instance.\n     * @param dto       The Dto to map.\n     * @return          Mapped Entity.\n     */\n    protected abstract Entity toEntity(Entity entity, Dto dto);\n\n    @Override\n    public Object mapResult(final Entity result)\n    {\n        if (result == null)\n        {\n            return null;\n        }\n        return toDto(result);\n    }\n\n    @Override\n    public Object mapResultList(final List<Entity> result)\n    {\n        if (result != null)\n        {\n            final List<Object> mapped = new ArrayList<Object>(result.size());\n            for (final Entity a : result)\n            {\n                mapped.add(mapResult(a));\n            }\n            return mapped;\n        }\n        return new ArrayList<Object>();\n    }\n\n    @Override\n    public boolean mapsParameter(final Object parameter)\n    {\n        if (parameter == null)\n        {\n            return false;\n        }\n        final String name = parameter.getClass().getName();\n        return Object.class.isInstance(parameter)\n                && !(name.startsWith(\"java.\") || name.startsWith(\"javax.\") || name.startsWith(\"jakarta.\"));\n    }\n\n    @Override\n    public Object mapParameter(final Object parameter)\n    {\n        Dto dto = (Dto) parameter;\n        Object primaryKey = getPrimaryKey(dto);\n        if (primaryKey != null)\n        {\n            Entity entity = findEntity(primaryKey);\n            return toEntity(entity, dto);\n        }\n        return toEntity(newEntity(), dto);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    protected Entity newEntity()\n    {\n        try\n        {\n            Class<?> entityClass = context.getEntityClass();\n            Constructor<?> constructor = entityClass.getDeclaredConstructor();\n            constructor.setAccessible(true);\n            return (Entity) constructor.newInstance();\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Failed instantiating new Entity\", e);\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    protected Entity findEntity(Object primaryKey)\n    {\n        return (Entity) context.getEntityManager().find(context.getEntityClass(), primaryKey);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/spi/DelegateQueryHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.spi;\n\n/**\n * A marker interface. Used for writing custom query methods:\n * <pre>\n * public interface RepositoryExtension<E> {\n *     E saveAndFlushAndRefresh(E entity);\n * }\n *\n * public class DelegateRepositoryExtension<E> implements RepositoryExtension<E>, DelegateQueryHandler {\n *    &#064;Inject\n *    private QueryInvocationContext context;\n *\n *    &#064;Override\n *    public E saveAndFlushAndRefresh(E entity) {\n *        ...\n *    }\n * }\n * </pre>\n *\n * The extension is now usable with:\n * <pre>\n * &#064;Repository\n * public interface MySimpleRepository\n *         extends RepositoryExtension<Simple>, EntityRepository<Simple, Long> {\n * }\n * </pre>\n */\npublic interface DelegateQueryHandler\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/spi/QueryInvocationContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.spi;\n\nimport jakarta.persistence.EntityManager;\nimport java.lang.reflect.Method;\n\n/**\n * Expose the current query invocation to extensions.\n */\npublic interface QueryInvocationContext\n{\n    /**\n     * Entity Manager used for the query.\n     */\n    EntityManager getEntityManager();\n\n    /**\n     * The class of the Entity related to the invoked Repository.\n     */\n    Class<?> getEntityClass();\n\n    /**\n     * Given the object parameter is an entity, checks if the entity is\n     * persisted or not.\n     *\n     * @param entity Entity object, non nullable.\n     * @return true if the entity is not persisted, false otherwise and if no entity.\n     */\n    boolean isNew(Object entity);\n\n    /**\n     * The type of the repository currently accessed.\n     */\n    Class<?> getRepositoryClass();\n\n    /**\n     * The repository method currently executed.\n     */\n    Method getMethod();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/api/src/test/java/org/apache/deltaspike/data/api/mapping/SimpleQueryInOutMapperBaseTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.api.mapping;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.Test;\n\npublic class SimpleQueryInOutMapperBaseTest\n{\n\n    @Test\n    public void checkDefault() {\n        final SimpleQueryInOutMapperBase<String, Integer> mapper = new SimpleQueryInOutMapperBase<String, Integer>()\n        {\n            @Override\n            public Integer toDto(final String result) {\n                return result.length();\n            }\n\n            @Override\n            protected String toEntity(String entity, Integer b) {\n                return entity;\n            }\n\n            @Override\n            protected Object getPrimaryKey(Integer dto)\n            {\n                return null;\n            }\n\n            @Override\n            protected String newEntity()\n            {\n                return \"ok\";\n            }\n        };\n\n        assertNull(mapper.mapResult(null));\n        assertEquals(2, mapper.mapResult(\"ab\"));\n\n        final List<Integer> collection = List.class.cast(mapper.mapResultList(Arrays.asList(null, \"a\", \"bc\")));\n        assertEquals(3, collection.size());\n        assertEquals(Arrays.asList(null, 1, 2), collection);\n\n        assertFalse(mapper.mapsParameter(null));\n        assertFalse(mapper.mapsParameter(\"foo\"));\n        assertFalse(mapper.mapsParameter(true));\n        assertFalse(mapper.mapsParameter(2));\n        assertTrue(mapper.mapsParameter(new Object() {\n        }));\n\n        // this test is particular cause we refuse String but forcing call to it we having the mapper behavior\n        // but at least we test what is expected!\n        assertEquals(\"ok\", mapper.mapParameter(2));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>data-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-data-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Data-Module Impl</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.data.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.persistence.*,\n            org.apache.deltaspike.jpa.impl.transaction,\n            !org.apache.deltaspike.data.impl.*,\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n        <deltaspike.osgi.provide.capability>\n            org.ops4j.pax.cdi.extension; extension=deltaspike-data-module-impl\n        </deltaspike.osgi.provide.capability>\n    </properties>\n\n    <dependencyManagement>\n\t\t<!-- needed for arquillian dependency resolution: (@see TestDeployments#getDeltaSpikeDataWithDependencies) -->\n\t\t<dependencies>\n\t\t\t<dependency>\n\t            <groupId>org.apache.deltaspike.core</groupId>\n\t            <artifactId>deltaspike-core-api</artifactId>\n\t\t\t\t<version>${project.version}</version>\n\t\t\t</dependency>\n\t\t\t<dependency>\n\t\t\t\t<groupId>org.apache.deltaspike.modules</groupId>\n\t\t\t\t<artifactId>deltaspike-partial-bean-module-api</artifactId>\n\t\t\t\t<version>${project.version}</version>\n\t\t\t</dependency>\n\t\t\t<dependency>\n\t\t\t\t<groupId>org.apache.deltaspike.modules</groupId>\n\t\t\t\t<artifactId>deltaspike-jpa-module-api</artifactId>\n\t\t\t\t<version>${project.version}</version>\n\t\t\t</dependency>\n\t\t\t<dependency>\n\t\t\t\t<groupId>org.apache.deltaspike.modules</groupId>\n\t\t\t\t<artifactId>deltaspike-data-module-api</artifactId>\n\t\t\t\t<version>${project.version}</version>\n\t\t\t</dependency>\n\t\t\t<dependency>\n\t\t\t\t<groupId>org.apache.deltaspike.modules</groupId>\n\t\t\t\t<artifactId>deltaspike-data-module-impl</artifactId>\n\t\t\t\t<version>${project.version}</version>\n\t\t\t\t<scope>runtime</scope>\n\t\t\t</dependency>\n\t\t</dependencies>\t\t\t\t\n\t</dependencyManagement>\n\n    <build>\n        <pluginManagement>\n            <plugins>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-surefire-plugin</artifactId>\n                    <configuration>\n                        <argLine>-Xms128m -Xmx1024m</argLine>\n                    </configuration>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n        <plugins>\n            <plugin>\n                <groupId>org.bsc.maven</groupId>\n                <artifactId>maven-processor-plugin</artifactId>\n                <version>2.0.7</version>\n                <executions>\n                    <execution>\n                        <id>process-test</id>\n                        <goals>\n                            <goal>process-test</goal>\n                        </goals>\n                        <phase>generate-test-sources</phase>\n                    </execution>\n                </executions>\n                <configuration>\n                    <processors>\n                        <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>\n                    </processors>\n                </configuration>\n                <dependencies>\n                    <!-- this part of Hibernate is Apache License 2.0, thus O.K. for us. -->\n                    <dependency>\n                        <groupId>org.hibernate</groupId>\n                        <artifactId>hibernate-jpamodelgen</artifactId>\n                        <version>6.2.0.CR4</version>\n                    </dependency>\n                </dependencies>\n            </plugin>\n        </plugins>\n    </build>\n\n    <dependencies>\n        <dependency>\n            <groupId>jakarta.persistence</groupId>\n            <artifactId>jakarta.persistence-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.transaction</groupId>\n            <artifactId>jakarta.transaction-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-data-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-partial-bean-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n        \n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <!-- Tests -->\n\n        <dependency>\n            <groupId>org.jboss.shrinkwrap.resolver</groupId>\n            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>\n            <scope>test</scope>\n        </dependency>\n        \n        <dependency>\n            <groupId>org.jboss.shrinkwrap.descriptors</groupId>\n            <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>\n            <scope>test</scope>\n        </dependency>\n\n    </dependencies>\n\n    <profiles>\n        <profile>\n            <id>wildfly-build-managed</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-wildfly</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>wildfly-managed</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-wildfly</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>wildfly-remote</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-wildfly</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>glassfish-remote</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-payara</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>payara-build-managed</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-payara</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>tomee-build-managed</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-openejb</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>wls-remote-12c</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-weblogic</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n        <profile>\n            <id>wls-managed-12c</id>\n            <build>\n                <testResources>\n                    <testResource>\n                        <directory>src/test/resources</directory>\n                    </testResource>\n                    <testResource>\n                        <directory>src/test/resources-weblogic</directory>\n                    </testResource>\n                </testResources>\n            </build>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/RepositoryExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.util.ArrayList;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.BeforeShutdown;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\nimport org.apache.deltaspike.data.api.AbstractFullEntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\n\n/**\n * The main extension class for Repositories, based on PartialBeans. Handles following events:<br/>\n * <br/>\n * <b>{@code @Observes BeforeBeanDiscovery}</b>:\n *     Scans the classpath for <code>persistence.xml</code> and extracts relevant information out of it.\n *     This includes mainly entity definitions (type, primary keys) which are not declared with annotations.<br/>\n * <br/>\n * <b>{@code @Observes ProcessAnnotatedType<X>}</b>:\n *     Looks for types annotated with {@link Repository}. Repositories are validated and preprocessed -\n *     all the methods on the repository are checked and analyzed for better runtime performance.<br/>\n * <br/>\n * <b>{@code @Observes AfterBeanDiscovery<X>}</b>:\n *     Raises any definition errors discovered before.\n */\npublic class RepositoryExtension implements Extension, Deactivatable\n{\n    private static final Logger LOG = Logger.getLogger(RepositoryExtension.class.getName());\n\n    // TODO: Hack still required?\n    private static final ArrayList<Class<?>> REPOSITORY_CLASSES = new ArrayList<Class<?>>();\n\n    private final ArrayList<Class<?>> repositoryClasses = new ArrayList<Class<?>>();\n    \n    private Boolean isActivated = true;\n\n    void beforeBeanDiscovery(@Observes BeforeBeanDiscovery before)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        if (isVetoed(event.getAnnotatedType()))\n        {\n            event.veto();\n        }\n        else if (isRepository(event.getAnnotatedType()))\n        {\n            Class<X> repositoryClass = event.getAnnotatedType().getJavaClass();\n\n            LOG.log(Level.FINER, \"getHandlerClass: Repository annotation detected on {0}\",\n                    event.getAnnotatedType());\n            if (Deactivatable.class.isAssignableFrom(repositoryClass)\n                    && !ClassDeactivationUtils.isActivated((Class<? extends Deactivatable>) repositoryClass))\n            {\n                LOG.log(Level.FINER, \"Class {0} is Deactivated\", repositoryClass);\n                return;\n            }\n\n            repositoryClasses.add(repositoryClass);\n            REPOSITORY_CLASSES.add(repositoryClass);\n        }\n    }\n\n    private <X> boolean isRepository(AnnotatedType<X> annotatedType)\n    {\n        return (annotatedType.isAnnotationPresent(Repository.class) ||\n                annotatedType.getJavaClass().isAnnotationPresent(Repository.class)) &&\n                !InvocationHandler.class.isAssignableFrom(annotatedType.getJavaClass());\n    }\n\n    private <X> boolean isVetoed(AnnotatedType<X> annotated)\n    {\n        Class<X> javaClass = annotated.getJavaClass();\n        return javaClass.equals(AbstractEntityRepository.class) ||\n               javaClass.equals(AbstractFullEntityRepository.class);\n    }\n    \n    public ArrayList<Class<?>> getRepositoryClasses()\n    {\n        ArrayList<Class<?>> result = new ArrayList<Class<?>>();\n\n        if (repositoryClasses.isEmpty() && !REPOSITORY_CLASSES.isEmpty())\n        {\n            result.addAll(REPOSITORY_CLASSES);\n        }\n\n        if (!repositoryClasses.isEmpty())\n        {\n            result.addAll(repositoryClasses);\n        }\n\n        return result;\n    }\n    \n    protected void cleanup(@Observes BeforeShutdown beforeShutdown)\n    {\n        //we can reset it in any case,\n        //because every application produced a copy as application-scoped bean (see RepositoryComponentsFactory)\n        REPOSITORY_CLASSES.clear();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/AuditEntityListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport java.util.Set;\n\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.persistence.PrePersist;\nimport jakarta.persistence.PreUpdate;\n\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\n\npublic class AuditEntityListener\n{\n\n    @PrePersist\n    public void persist(Object entity)\n    {\n        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n        Set<Bean<?>> beans = beanManager.getBeans(PrePersistAuditListener.class);\n        for (Bean<?> bean : beans)\n        {\n            PrePersistAuditListener result = (PrePersistAuditListener) beanManager.getReference(\n                    bean, PrePersistAuditListener.class, beanManager.createCreationalContext(bean));\n            result.prePersist(entity);\n        }\n    }\n\n    @PreUpdate\n    public void update(Object entity)\n    {\n        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n        Set<Bean<?>> beans = beanManager.getBeans(PreUpdateAuditListener.class);\n        for (Bean<?> bean : beans)\n        {\n            PreUpdateAuditListener result = (PreUpdateAuditListener) beanManager.getReference(\n                    bean, PreUpdateAuditListener.class, beanManager.createCreationalContext(bean));\n            result.preUpdate(entity);\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/AuditPropertyException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\npublic class AuditPropertyException extends RuntimeException\n{\n\n    private static final long serialVersionUID = -8725707870578473975L;\n\n    public AuditPropertyException(String message, Throwable cause)\n    {\n        super(message, cause);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/AuditProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport java.lang.annotation.Annotation;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.apache.deltaspike.data.impl.property.query.AnnotatedPropertyCriteria;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQueries;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQuery;\n\nabstract class AuditProvider implements PrePersistAuditListener, PreUpdateAuditListener\n{\n\n    protected static final Logger log = Logger.getLogger(AuditProvider.class.getName());\n\n    String propertyName(Object entity, Property<Object> property)\n    {\n        return entity.getClass().getSimpleName() + \".\" + property.getName();\n    }\n\n    List<Property<Object>> getProperties(\n            Object entity,\n            Class<? extends Annotation> createdAnnotation,\n            Class<? extends Annotation> modifiedAnnotation,\n            boolean create)\n    {\n        List<Property<Object>> properties = new LinkedList<>();\n        PropertyQuery<Object> query = PropertyQueries.createQuery(entity.getClass())\n                .addCriteria(new AnnotatedPropertyCriteria(modifiedAnnotation));\n        properties.addAll(query.getWritableResultList());\n        if (create)\n        {\n            query = PropertyQueries.<Object> createQuery(entity.getClass())\n                    .addCriteria(new AnnotatedPropertyCriteria(createdAnnotation));\n            properties.addAll(query.getWritableResultList());\n        }\n        return properties;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/PrePersistAuditListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\npublic interface PrePersistAuditListener\n{\n\n    void prePersist(Object entity);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/PreUpdateAuditListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\npublic interface PreUpdateAuditListener\n{\n\n    void preUpdate(Object entity);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/PrincipalProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport java.util.Set;\nimport java.util.logging.Level;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.data.api.audit.CreatedBy;\nimport org.apache.deltaspike.data.api.audit.CurrentUser;\nimport org.apache.deltaspike.data.api.audit.ModifiedBy;\nimport org.apache.deltaspike.data.impl.property.Property;\n\n@Dependent\nclass PrincipalProvider extends AuditProvider\n{\n\n    @Inject\n    private BeanManager manager;\n\n    @Override\n    public void prePersist(Object entity)\n    {\n        updatePrincipal(entity, true);\n    }\n\n    @Override\n    public void preUpdate(Object entity)\n    {\n        updatePrincipal(entity, false);\n    }\n\n    private void updatePrincipal(Object entity, boolean create)\n    {\n        for (Property<Object> property : getProperties(entity, CreatedBy.class, ModifiedBy.class, create))\n        {\n            setProperty(entity, property, create);\n        }\n    }\n\n    private void setProperty(Object entity, Property<Object> property, boolean create)\n    {\n        try\n        {\n            if (!isCorrectContext(property, create))\n            {\n                return;\n            }\n            Object value = resolvePrincipal(entity, property);\n            property.setValue(entity, value);\n            log.log(Level.FINER, \"Updated {0} with {1}\", new Object[] { propertyName(entity, property), value });\n        }\n        catch (Exception e)\n        {\n            throw new AuditPropertyException(\"Failed to write principal to \" +\n                    propertyName(entity, property), e);\n        }\n    }\n\n    private boolean isCorrectContext(Property<Object> property, boolean create)\n    {\n        if (create && property.getAnnotatedElement().isAnnotationPresent(ModifiedBy.class))\n        {\n            ModifiedBy annotation = property.getAnnotatedElement().getAnnotation(ModifiedBy.class);\n            if (!annotation.onCreate())\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    protected Object resolvePrincipal(Object entity, Property<Object> property)\n    {\n        CurrentUser principal = AnnotationInstanceProvider.of(CurrentUser.class);\n        Class<?> propertyClass = property.getJavaClass();\n        Set<Bean<?>> beans = manager.getBeans(propertyClass, principal);\n        if (!beans.isEmpty() && beans.size() == 1)\n        {\n            Bean<?> bean = beans.iterator().next();\n            Object result = manager.getReference(bean, propertyClass, manager.createCreationalContext(bean));\n            return result;\n        }\n        throw new IllegalArgumentException(\"Principal \" + (beans.isEmpty() ? \"not found\" : \"not unique\") +\n                \" for \" + propertyName(entity, property));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/audit/TimestampsProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.logging.Level;\n\nimport jakarta.enterprise.context.Dependent;\nimport org.apache.deltaspike.data.api.audit.CreatedOn;\nimport org.apache.deltaspike.data.api.audit.ModifiedOn;\nimport org.apache.deltaspike.data.impl.property.Property;\n\n/**\n * Set timestamps on marked properties.\n */\n@Dependent\nclass TimestampsProvider extends AuditProvider\n{\n\n    @Override\n    public void prePersist(Object entity)\n    {\n        updateTimestamps(entity, true);\n    }\n\n    @Override\n    public void preUpdate(Object entity)\n    {\n        updateTimestamps(entity, false);\n    }\n\n    private void updateTimestamps(Object entity, boolean create)\n    {\n        long systime = System.currentTimeMillis();\n        for (Property<Object> property : getProperties(entity, CreatedOn.class, ModifiedOn.class, create))\n        {\n            setProperty(entity, property, systime, create);\n        }\n    }\n\n    private void setProperty(Object entity, Property<Object> property, long systime, boolean create)\n    {\n        try\n        {\n            if (!isCorrectContext(property, create))\n            {\n                return;\n            }\n            Object now = now(property.getJavaClass(), systime);\n            property.setValue(entity, now);\n            log.log(Level.FINER, \"Updated property {0} with {1}\", new Object[] { propertyName(entity, property), now });\n        }\n        catch (Exception e)\n        {\n            String message = \"Failed to set property \" + propertyName(entity, property) + \", is this a temporal type?\";\n            throw new AuditPropertyException(message, e);\n        }\n    }\n\n    private boolean isCorrectContext(Property<Object> property, boolean create)\n    {\n        if (create && property.getAnnotatedElement().isAnnotationPresent(ModifiedOn.class))\n        {\n            ModifiedOn annotation = property.getAnnotatedElement().getAnnotation(ModifiedOn.class);\n            if (!annotation.onCreate())\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    private Object now(Class<?> field, long systime) throws Exception\n    {\n        if (isCalendarClass(field))\n        {\n            Calendar cal = Calendar.getInstance();\n            cal.setTimeInMillis(systime);\n            return cal;\n        }\n        else if (isDateClass(field))\n        {\n            return field.getConstructor(Long.TYPE).newInstance(systime);\n        }\n        throw new IllegalArgumentException(\"Annotated field is not a date class: \" + field);\n    }\n\n    private boolean isCalendarClass(Class<?> field)\n    {\n        return Calendar.class.isAssignableFrom(field);\n    }\n\n    private boolean isDateClass(Class<?> field)\n    {\n        return Date.class.isAssignableFrom(field);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.param.Parameters;\nimport org.apache.deltaspike.data.impl.util.jpa.QueryStringExtractorFactory;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.EntityManager;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.ParameterizedType;\nimport java.util.List;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport org.apache.deltaspike.core.util.ClassUtils;\n\nimport static org.apache.deltaspike.core.util.StringUtils.isNotEmpty;\n\n/**\n * Create the query based on method annotations.\n */\n@ApplicationScoped\npublic class AnnotatedQueryBuilder extends QueryBuilder\n{\n\n    private final QueryStringExtractorFactory factory = new QueryStringExtractorFactory();\n\n    @Override\n    public Object execute(CdiQueryInvocationContext context)\n    {\n        Method method = context.getMethod();\n        Query query = method.getAnnotation(Query.class);\n        jakarta.persistence.Query jpaQuery = createJpaQuery(query, context);\n        return context.executeQuery(jpaQuery);\n    }\n\n    private jakarta.persistence.Query createJpaQuery(Query query, CdiQueryInvocationContext context)\n    {\n        EntityManager entityManager = context.getEntityManager();\n        Parameters params = context.getParams();\n        jakarta.persistence.Query result = null;\n        if (isNotEmpty(query.named()))\n        {\n            if (!context.hasQueryStringPostProcessors())\n            {\n                result = params.applyTo(entityManager.createNamedQuery(query.named()));\n            }\n            else\n            {\n                jakarta.persistence.Query namedQuery = entityManager.createNamedQuery(query.named());\n                String named = factory.extract(namedQuery);\n                String jpqlQuery = context.applyQueryStringPostProcessors(named);\n                result = params.applyTo(entityManager.createQuery(jpqlQuery));\n            }\n        }\n        else if (query.isNative())\n        {\n            String jpqlQuery = context.applyQueryStringPostProcessors(query.value());\n            Class<?> resultType = getQueryResultType(context.getMethod());\n            if (isEntityType(resultType))\n            {\n                result = params.applyTo(entityManager.createNativeQuery(jpqlQuery, resultType));\n            }\n            else\n            {\n                result = params.applyTo(entityManager.createNativeQuery(jpqlQuery));\n            }\n        }\n        else\n        {\n            String jpqlQuery = context.applyQueryStringPostProcessors(query.value());\n            context.setQueryString(jpqlQuery);\n            result = params.applyTo(entityManager.createQuery(jpqlQuery));\n        }\n        return context.applyRestrictions(result);\n    }\n\n    private boolean isEntityType(Class<?> cls)\n    {\n        return cls.getAnnotation(Entity.class) != null;\n    }\n\n    private Class<?> getQueryResultType(Method method)\n    {\n        if (ClassUtils.returns(method, List.class) && !ClassUtils.returns(method, Object.class))\n        {\n            ParameterizedType pt = (ParameterizedType) method.getGenericReturnType();\n            return (Class<?>) pt.getActualTypeArguments()[0];\n        }\n\n        return method.getReturnType();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.builder;\r\n\r\nimport java.lang.reflect.InvocationTargetException;\r\nimport java.lang.reflect.Method;\r\nimport java.util.Collection;\r\nimport java.util.HashMap;\r\nimport java.util.Map;\r\nimport java.util.Optional;\r\nimport java.util.Set;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\nimport jakarta.enterprise.context.Dependent;\r\nimport jakarta.enterprise.context.spi.CreationalContext;\r\nimport jakarta.enterprise.inject.spi.Bean;\r\nimport jakarta.enterprise.inject.spi.BeanManager;\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.PersistenceException;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.core.util.ClassUtils;\r\nimport org.apache.deltaspike.data.api.QueryInvocationException;\r\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\r\nimport org.apache.deltaspike.data.impl.util.bean.BeanDestroyable;\r\nimport org.apache.deltaspike.data.spi.DelegateQueryHandler;\r\n\r\n@ApplicationScoped\r\npublic class DelegateQueryBuilder extends QueryBuilder\r\n{\r\n    @Inject\r\n    private BeanManager beanManager;\r\n\r\n    private final Map<Method, Bean<DelegateQueryHandler>> lookupCache = new HashMap<>();\r\n    \r\n    @Override\r\n    public Object execute(CdiQueryInvocationContext context)\r\n    {\r\n        try\r\n        {\r\n            DelegateQueryHandler delegate = lookup(context);\r\n            if (delegate != null)\r\n            {\r\n                Object result = invoke(delegate, context);\r\n                if (result instanceof Collection && context.getRepositoryMethodMetadata().isReturnsStream())\r\n                {\r\n                    return ((Collection) result).stream();\r\n                }\r\n                else if (context.getRepositoryMethodMetadata().isReturnsOptional() && !(result instanceof Optional))\r\n                {\r\n                    return Optional.ofNullable(result);\r\n                }\r\n                else\r\n                {\r\n                    return result;\r\n                }\r\n            }\r\n        }\r\n        catch (PersistenceException e)\r\n        {\r\n            throw e;\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            throw new QueryInvocationException(e, context);\r\n        }\r\n        throw new QueryInvocationException(\"No DelegateQueryHandler found\", context);\r\n    }\r\n\r\n    private DelegateQueryHandler lookup(CdiQueryInvocationContext context)\r\n    {\r\n        Bean<DelegateQueryHandler> selectedBean = lookupCache.get(context.getMethod());\r\n        \r\n        if (selectedBean == null)\r\n        {\r\n            Set<Bean<DelegateQueryHandler>> beans = BeanProvider\r\n                    .getBeanDefinitions(DelegateQueryHandler.class, true, true);\r\n            for (Bean<DelegateQueryHandler> bean : beans)\r\n            {\r\n                if (ClassUtils.containsPossiblyGenericMethod(bean.getBeanClass(), context.getMethod()))\r\n                {\r\n                    selectedBean = bean;\r\n                }\r\n            }\r\n            \r\n            if (selectedBean != null)\r\n            {\r\n                lookupCache.put(context.getMethod(), selectedBean);\r\n            }\r\n        }\r\n        \r\n        \r\n        if (selectedBean != null)\r\n        {\r\n            CreationalContext<DelegateQueryHandler> cc = beanManager.createCreationalContext(selectedBean);\r\n            DelegateQueryHandler instance = (DelegateQueryHandler) beanManager.getReference(\r\n                    selectedBean, DelegateQueryHandler.class, cc);\r\n            \r\n            if (selectedBean.getScope().equals(Dependent.class))\r\n            {\r\n                context.addDestroyable(new BeanDestroyable<DelegateQueryHandler>(selectedBean, instance, cc));\r\n            }\r\n\r\n            return instance;\r\n        }\r\n        return null;\r\n    }\r\n\r\n    private Object invoke(DelegateQueryHandler delegate, CdiQueryInvocationContext context)\r\n    {\r\n        try\r\n        {\r\n            Method extract = ClassUtils.extractPossiblyGenericMethod(delegate.getClass(), context.getMethod());\r\n            return extract.invoke(delegate, context.getMethodParameters());\r\n        }\r\n        catch (InvocationTargetException e)\r\n        {\r\n            if (e.getCause() != null && e.getCause() instanceof PersistenceException)\r\n            {\r\n                throw (PersistenceException) e.getCause();\r\n            }\r\n            throw new QueryInvocationException(e, context);\r\n        }\r\n        catch (IllegalAccessException e)\r\n        {\r\n            throw new RuntimeException(e);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodExpressionException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\npublic class MethodExpressionException extends RuntimeException\n{\n\n    private static final long serialVersionUID = 1L;\n    private final String property;\n    private final Class<?> repoClass;\n    private final String method;\n\n    public MethodExpressionException(Class<?> repoClass, String method)\n    {\n        this(null, repoClass, method);\n    }\n\n    public MethodExpressionException(String property, Class<?> repoClass, String method)\n    {\n        this.property = property;\n        this.repoClass = repoClass;\n        this.method = method;\n    }\n\n    @Override\n    public String getMessage()\n    {\n        if (property != null)\n        {\n            return \"Invalid property '\" + property + \"' in method expression \" + repoClass.getName() + \".\" + method;\n        }\n        return \"Method '\" + method + \"'of Repository \" + repoClass.getName() + \" is not a method expression\";\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.builder.part.QueryRoot;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.param.Parameters;\n\n@ApplicationScoped\npublic class MethodQueryBuilder extends QueryBuilder\n{\n\n    @Override\n    public Object execute(CdiQueryInvocationContext context)\n    {\n        Query jpaQuery = createJpaQuery(context);\n        return context.executeQuery(jpaQuery);\n    }\n\n    private Query createJpaQuery(CdiQueryInvocationContext context)\n    {\n        Parameters params = context.getParams();\n        QueryRoot root = context.getRepositoryMethodMetadata().getQueryRoot();\n        String jpqlQuery = context.applyQueryStringPostProcessors(root.getJpqlQuery());\n        context.setQueryString(jpqlQuery);\n        params.updateValues(root.getParameterUpdates());\n        Query result = params.applyTo(context.getEntityManager().createQuery(jpqlQuery));\n        return context.applyRestrictions(result);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/OrderDirection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\npublic enum OrderDirection\n{\n\n    ASC\n    {\n        @Override\n        public OrderDirection change()\n        {\n            return DESC;\n        }\n    },\n    DESC\n    {\n        @Override\n        public OrderDirection change()\n        {\n            return ASC;\n        }\n    };\n\n    public abstract OrderDirection change();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\n\nimport jakarta.persistence.Query;\nimport java.text.MessageFormat;\nimport java.util.List;\n\n/**\n * Query builder factory. Delegates to concrete implementations.\n */\npublic abstract class QueryBuilder\n{\n    public static final String QUERY_SELECT = \"select e from {0} e\";\n    public static final String QUERY_COUNT = \"select count(e) from {0} e\";\n    public static final String QUERY_DELETE = \"delete from {0} e\";\n    public static final String ENTITY_NAME = \"e\";\n\n    public static String selectQuery(String entityName)\n    {\n        return MessageFormat.format(QUERY_SELECT, entityName);\n    }\n\n    public static String deleteQuery(String entityName)\n    {\n        return MessageFormat.format(QUERY_DELETE, entityName);\n    }\n\n    public static String countQuery(String entityName)\n    {\n        return MessageFormat.format(QUERY_COUNT, entityName);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public Object executeQuery(CdiQueryInvocationContext context)\n    {\n        Object result = execute(context);\n        if (!isUnmappableResult(result) && context.hasQueryInOutMapper())\n        {\n            QueryInOutMapper<Object> mapper = (QueryInOutMapper<Object>)\n                    context.getQueryInOutMapper();\n            if (result instanceof List)\n            {\n                return mapper.mapResultList((List<Object>) result);\n            }\n            return mapper.mapResult(result);\n        }\n        return result;\n    }\n\n    protected abstract Object execute(CdiQueryInvocationContext ctx);\n\n    private boolean isUnmappableResult(Object result)\n    {\n        return result instanceof QueryResult ||\n                result instanceof Query;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\nimport java.util.Collections;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.apache.deltaspike.data.impl.param.ParameterUpdate;\n\npublic class QueryBuilderContext\n{\n\n    private final StringBuilder builder;\n    private final List<ParameterUpdate> paramUpdates;\n    private int counter = 1;\n\n    public QueryBuilderContext()\n    {\n        this.builder = new StringBuilder();\n        this.paramUpdates = new LinkedList<>();\n    }\n\n    public int increment()\n    {\n        return counter++;\n    }\n\n    public QueryBuilderContext append(String string)\n    {\n        builder.append(string);\n        return this;\n    }\n\n    public String resultString()\n    {\n        return builder.toString();\n    }\n\n    public int getCounter()\n    {\n        return counter;\n    }\n\n    public void addParameterUpdate(ParameterUpdate update)\n    {\n        paramUpdates.add(update);\n    }\n\n    public List<ParameterUpdate> getParameterUpdates()\n    {\n        return Collections.unmodifiableList(paramUpdates);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\nimport static org.apache.deltaspike.data.impl.meta.RepositoryMethodType.ANNOTATED;\nimport static org.apache.deltaspike.data.impl.meta.RepositoryMethodType.DELEGATE;\nimport static org.apache.deltaspike.data.impl.meta.RepositoryMethodType.PARSE;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodType;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata;\n\n@ApplicationScoped\npublic class QueryBuilderFactory\n{\n    @Inject\n    private MethodQueryBuilder methodQueryBuilder;\n    @Inject\n    private DelegateQueryBuilder delegateQueryBuilder;\n    @Inject\n    private AnnotatedQueryBuilder annotatedQueryBuilder;\n            \n    protected QueryBuilder getQueryBuilder(RepositoryMethodType repositoryMethodType)\n    {\n        switch (repositoryMethodType)\n        {\n            case ANNOTATED:\n                return annotatedQueryBuilder;\n            case PARSE:\n                return methodQueryBuilder;\n            case DELEGATE:\n                return delegateQueryBuilder;\n            default:\n                throw new RuntimeException(\n                        \"No \" + QueryBuilder.class.getName() + \" avialable for type: \" + repositoryMethodType);\n        }\n    }\n\n    public QueryBuilder build(RepositoryMethodMetadata methodMetadata, CdiQueryInvocationContext context)\n    {\n        QueryBuilder builder = getQueryBuilder(context.getRepositoryMethodMetadata().getMethodType());\n\n        if (QueryResult.class.equals(methodMetadata.getMethod().getReturnType()))\n        {\n            return new WrappedQueryBuilder(builder);\n        }\n\n        return builder;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryOperator.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.builder;\r\n\r\n/**\r\n * Comparison options for queries.\r\n */\r\npublic enum QueryOperator\r\n{\r\n\r\n    LessThan(\"LessThan\", \"{0} < {1}\"),\r\n    LessThanEquals(\"LessThanEquals\", \"{0} <= {1}\"),\r\n    GreaterThan(\"GreaterThan\", \"{0} > {1}\"),\r\n    GreaterThanEquals(\"GreaterThanEquals\", \"{0} >= {1}\"),\r\n    NotLike(\"NotLike\", \"{0} not like {1}\"),\r\n    Like(\"Like\", \"{0} like {1}\"),\r\n    LikeIgnoreCase(\"LikeIgnoreCase\", \"upper({0}) like {1}\", true),\r\n    NotEqual(\"NotEqual\", \"{0} <> {1}\"),\r\n    NotEqualIgnoreCase(\"NotEqualIgnoreCase\", \"upper({0}) <> upper({1})\"),\r\n    Equal(\"Equal\", \"{0} = {1}\"),\r\n    EqualIgnoreCase(\"EqualIgnoreCase\", \"upper({0}) = upper({1})\"),\r\n    IgnoreCase(\"IgnoreCase\", \"upper({0}) = upper({1})\"),\r\n    Between(\"Between\", \"{0} between {1} and {2}\", 2),\r\n    IsNotNull(\"IsNotNull\", \"{0} IS NOT NULL\", 0),\r\n    IsNull(\"IsNull\", \"{0} IS NULL\", 0),\r\n    NotIn(\"NotIn\", \"{0} NOT IN {1}\"),\r\n    In(\"In\", \"{0} IN {1}\"),\r\n    True(\"True\", \"{0} IS TRUE\", 0),\r\n    False(\"False\", \"{0} IS FALSE\", 0),\r\n    Containing(\"Containing\", \"{0} like CONCAT(''%'', CONCAT({1}, ''%''))\"),\r\n    StartingWith(\"StartingWith\", \"{0} like CONCAT({1}, ''%'')\"),\r\n    EndingWith(\"EndingWith\", \"{0} like CONCAT(''%'', {1})\");\r\n\r\n    private final String expression;\r\n    private final String jpql;\r\n    private final int paramNum;\r\n    private final boolean caseInsensitive;\r\n\r\n    private QueryOperator(String expression, String jpql)\r\n    {\r\n        this(expression, jpql, 1);\r\n    }\r\n\r\n    private QueryOperator(String expression, String jpql, boolean caseInsensitive)\r\n    {\r\n        this(expression, jpql, 1, caseInsensitive);\r\n    }\r\n\r\n    private QueryOperator(String expression, String jpql, int paramNum)\r\n    {\r\n        this(expression, jpql, paramNum, false);\r\n    }\r\n\r\n    private QueryOperator(String expression, String jpql, int paramNum, boolean caseInsensitive)\r\n    {\r\n        this.expression = expression;\r\n        this.jpql = jpql;\r\n        this.paramNum = paramNum;\r\n        this.caseInsensitive = caseInsensitive;\r\n    }\r\n\r\n    public String getExpression()\r\n    {\r\n        return expression;\r\n    }\r\n\r\n    public String getJpql()\r\n    {\r\n        return jpql;\r\n    }\r\n\r\n    public int getParamNum()\r\n    {\r\n        return paramNum;\r\n    }\r\n\r\n    public boolean isCaseInsensitive()\r\n    {\r\n        return caseInsensitive;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/WrappedQueryBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder;\n\nimport org.apache.deltaspike.data.impl.builder.result.DefaultQueryResult;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\n\npublic class WrappedQueryBuilder extends QueryBuilder\n{\n\n    private final QueryBuilder delegate;\n\n    public WrappedQueryBuilder(QueryBuilder delegate)\n    {\n        this.delegate = delegate;\n    }\n\n    @Override\n    @SuppressWarnings(\"rawtypes\")\n    public Object execute(CdiQueryInvocationContext ctx)\n    {\n        return new DefaultQueryResult(delegate, ctx);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/AndQueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\n\nclass AndQueryPart extends ConnectingQueryPart\n{\n\n    public AndQueryPart(boolean first)\n    {\n        super(first);\n    }\n\n    @Override\n    protected QueryPart build(String queryPart, String method, RepositoryMetadata repo)\n    {\n        children.add(new PropertyQueryPart().build(queryPart, method, repo));\n        return this;\n    }\n\n    @Override\n    protected QueryPart buildQuery(QueryBuilderContext ctx)\n    {\n        if (!first)\n        {\n            ctx.append(\" and \");\n        }\n        buildQueryForChildren(ctx);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/BasePropertyQueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport org.apache.deltaspike.data.impl.builder.MethodExpressionException;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQueries;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQuery;\n\nabstract class BasePropertyQueryPart extends QueryPart\n{\n    static final String SEPARATOR = \"_\";\n\n    void validate(String name, String method, RepositoryMetadata repo)\n    {\n        Class<?> current = repo.getEntityMetadata().getEntityClass();\n        if (name == null)\n        {\n            throw new MethodExpressionException(null, repo.getRepositoryClass(), method);\n        }\n        for (String property : name.split(SEPARATOR))\n        {\n            PropertyQuery<?> query = PropertyQueries.createQuery(current)\n                    .addCriteria(new NamedPropertyCriteria(property));\n            Property<?> result = query.getFirstResult();\n            if (result == null)\n            {\n                throw new MethodExpressionException(property, repo.getRepositoryClass(), method);\n            }\n            current = result.getJavaClass();\n        }\n    }\n\n    String rewriteSeparator(String name)\n    {\n        if (name.contains(\"_\"))\n        {\n            return name.replaceAll(SEPARATOR, \".\");\n        }\n        return name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/ConnectingQueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nabstract class ConnectingQueryPart extends QueryPart\n{\n\n    protected final boolean first;\n\n    public ConnectingQueryPart(boolean first)\n    {\n        this.first = first;\n    }\n\n    public boolean isFirst()\n    {\n        return first;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/OrQueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.splitByKeyword;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\n\n\nclass OrQueryPart extends ConnectingQueryPart\n{\n\n    public OrQueryPart(boolean first)\n    {\n        super(first);\n    }\n\n    @Override\n    protected QueryPart build(String queryPart, String method, RepositoryMetadata repo)\n    {\n        String[] andParts = splitByKeyword(queryPart, \"And\");\n        boolean first = true;\n        for (String and : andParts)\n        {\n            AndQueryPart andPart = new AndQueryPart(first);\n            first = false;\n            children.add(andPart.build(and, method, repo));\n        }\n        return this;\n    }\n\n    @Override\n    protected QueryPart buildQuery(QueryBuilderContext ctx)\n    {\n        if (!first)\n        {\n            ctx.append(\" or \");\n        }\n        buildQueryForChildren(ctx);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/OrderByQueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport static org.apache.deltaspike.core.util.StringUtils.isNotEmpty;\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.splitByKeyword;\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.uncapitalize;\n\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.LinkedHashSet;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\n\npublic class OrderByQueryPart extends BasePropertyQueryPart\n{\n    private static final String KEYWORD_ASC = \"Asc\";\n    private static final String KEYWORD_DESC = \"Desc\";\n\n    private final List<OrderByQueryAttribute> attributes = new LinkedList<OrderByQueryAttribute>();\n\n    @Override\n    protected QueryPart build(String queryPart, String method, RepositoryMetadata repo)\n    {\n        Set<String> collect = new LinkedHashSet<String>();\n        List<String> ascSplit = new LinkedList<String>();\n        split(queryPart, KEYWORD_ASC, ascSplit);\n        for (String ascPart : ascSplit)\n        {\n            split(ascPart, KEYWORD_DESC, collect);\n        }\n        for (String part : collect)\n        {\n            Direction direction = Direction.fromQueryPart(part);\n            String attribute = direction.attribute(part);\n            validate(attribute, method, repo);\n            attributes.add(new OrderByQueryAttribute(attribute, direction));\n        }\n        return this;\n    }\n\n    @Override\n    protected QueryPart buildQuery(QueryBuilderContext ctx)\n    {\n        ctx.append(\" order by \");\n        for (Iterator<OrderByQueryAttribute> it = attributes.iterator(); it.hasNext();)\n        {\n            it.next().buildQuery(ctx);\n            if (it.hasNext())\n            {\n                ctx.append(\", \");\n            }\n        }\n        return this;\n    }\n\n    private void split(String queryPart, String keyword, Collection<String> result)\n    {\n        for (String part : splitByKeyword(queryPart, keyword))\n        {\n            String attribute = !part.endsWith(KEYWORD_DESC) && !part.endsWith(KEYWORD_ASC) ? part + keyword : part;\n            result.add(attribute);\n        }\n    }\n\n    private class OrderByQueryAttribute\n    {\n\n        private final String attribute;\n        private final Direction direction;\n\n        public OrderByQueryAttribute(String attribute, Direction direction)\n        {\n            this.attribute = attribute;\n            this.direction = direction;\n        }\n\n        protected void buildQuery(QueryBuilderContext ctx)\n        {\n            String entityPrefix = QueryBuilder.ENTITY_NAME + \".\";\n            ctx.append(entityPrefix).append(rewriteSeparator(attribute))\n                    .append(direction.queryDirection());\n        }\n    }\n\n    private static enum Direction\n    {\n        ASC(KEYWORD_ASC),\n        DESC(KEYWORD_DESC),\n        DEFAULT(\"\");\n\n        private final String postfix;\n\n        private Direction(String postfix)\n        {\n            this.postfix = postfix;\n        }\n\n        public boolean endsWith(String queryPart)\n        {\n            return isNotEmpty(postfix) ? queryPart.endsWith(postfix) : false;\n        }\n\n        public String attribute(String queryPart)\n        {\n            String attribute = isNotEmpty(postfix) ?\n                    queryPart.substring(0, queryPart.indexOf(postfix)) :\n                    queryPart;\n            return uncapitalize(attribute);\n        }\n\n        public String queryDirection()\n        {\n            return isNotEmpty(postfix) ? \" \" + postfix.toLowerCase() : \"\";\n        }\n\n        public static Direction fromQueryPart(String queryPart)\n        {\n            for (Direction dir : values())\n            {\n                if (dir.endsWith(queryPart))\n                {\n                    return dir;\n                }\n            }\n            return DEFAULT;\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/PropertyQueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.uncapitalize;\n\nimport java.text.MessageFormat;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderContext;\nimport org.apache.deltaspike.data.impl.builder.QueryOperator;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\nimport org.apache.deltaspike.data.impl.param.ToUpperStringParameterUpdate;\n\nclass PropertyQueryPart extends BasePropertyQueryPart\n{\n\n    private String name;\n    private QueryOperator comparator;\n\n    @Override\n    protected QueryPart build(String queryPart, String method, RepositoryMetadata repo)\n    {\n        comparator = QueryOperator.Equal;\n        name = uncapitalize(queryPart);\n        for (QueryOperator comp : QueryOperator.values())\n        {\n            if (queryPart.endsWith(comp.getExpression()))\n            {\n                comparator = comp;\n                name = uncapitalize(queryPart.substring(0, queryPart.indexOf(comp.getExpression())));\n                break;\n            }\n        }\n        validate(name, method, repo);\n        name = rewriteSeparator(name);\n        return this;\n    }\n\n    @Override\n    protected QueryPart buildQuery(QueryBuilderContext ctx)\n    {\n        String[] args = new String[comparator.getParamNum() + 1];\n        args[0] = QueryBuilder.ENTITY_NAME + \".\" + name;\n        for (int i = 1; i < args.length; i++)\n        {\n            args[i] = \"?\" + ctx.increment();\n        }\n        ctx.append(MessageFormat.format(comparator.getJpql(), (Object[]) args));\n        if (comparator.isCaseInsensitive() && args.length >= 1)\n        {\n            ctx.addParameterUpdate(new ToUpperStringParameterUpdate(args[1].substring(1)));\n        }\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/QueryPart.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\n\npublic abstract class QueryPart\n{\n\n    protected List<QueryPart> children = new LinkedList<QueryPart>();\n\n    protected abstract QueryPart build(String queryPart, String method, RepositoryMetadata repo);\n\n    protected abstract QueryPart buildQuery(QueryBuilderContext ctx);\n\n    protected void buildQueryForChildren(QueryBuilderContext ctx)\n    {\n        for (QueryPart child : children)\n        {\n            child.buildQuery(ctx);\n        }\n    }\n\n    protected boolean hasChildren(Set<Class<? extends QueryPart>> excluded)\n    {\n        if (children == null || children.isEmpty())\n        {\n            return false;\n        }\n        for (QueryPart part : children)\n        {\n            if (!excluded.contains(part.getClass()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/part/QueryRoot.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.part;\n\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.splitByKeyword;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.data.impl.builder.MethodExpressionException;\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\nimport org.apache.deltaspike.data.impl.param.ParameterUpdate;\n\n/**\n * Root of the query tree. Also the only exposed class in the package.\n */\npublic class QueryRoot extends QueryPart\n{\n\n    public static final QueryRoot UNKNOWN_ROOT = new QueryRoot(\"null-object\", new RepositoryMethodPrefix(\"\", null));\n\n    private static final Logger log = Logger.getLogger(QueryRoot.class.getName());\n\n    private final String entityName;\n    private final RepositoryMethodPrefix methodPrefix;\n\n    private String jpqlQuery;\n    private List<ParameterUpdate> paramUpdates;\n\n    protected QueryRoot(String entityName, RepositoryMethodPrefix methodPrefix)\n    {\n        this.entityName = entityName;\n        this.methodPrefix = methodPrefix;\n    }\n\n    public static QueryRoot create(String method, RepositoryMetadata repo, RepositoryMethodPrefix prefix)\n    {\n        QueryRoot root = new QueryRoot(repo.getEntityMetadata().getEntityName(), prefix);\n        root.build(method, method, repo);\n        root.createJpql();\n        return root;\n    }\n\n    public String getJpqlQuery()\n    {\n        return jpqlQuery;\n    }\n\n    public List<ParameterUpdate> getParameterUpdates()\n    {\n        return paramUpdates;\n    }\n\n    @Override\n    protected QueryPart build(String queryPart, String method, RepositoryMetadata repo)\n    {\n        String[] orderByParts = splitByKeyword(queryPart, \"OrderBy\");\n        if (hasQueryConditions(orderByParts))\n        {\n            String[] orParts = splitByKeyword(removePrefix(orderByParts[0]), \"Or\");\n            boolean first = true;\n            for (String or : orParts)\n            {\n                OrQueryPart orPart = new OrQueryPart(first);\n                first = false;\n                children.add(orPart.build(or, method, repo));\n            }\n        }\n        if (orderByParts.length > 1)\n        {\n            OrderByQueryPart orderByPart = new OrderByQueryPart();\n            children.add(orderByPart.build(orderByParts[1], method, repo));\n        }\n        if (children.isEmpty())\n        {\n            throw new MethodExpressionException(repo.getRepositoryClass(), method);\n        }\n        return this;\n    }\n\n    @Override\n    protected QueryPart buildQuery(QueryBuilderContext ctx)\n    {\n        if (methodPrefix.isDelete())\n        {\n            ctx.append(QueryBuilder.deleteQuery(entityName));\n        }\n        else if (methodPrefix.isCount())\n        {\n            ctx.append(QueryBuilder.countQuery(entityName));\n        }\n        else\n        {\n            ctx.append(QueryBuilder.selectQuery(entityName));\n        }\n        \n        if (hasChildren(excludedForWhereCheck()))\n        {\n            ctx.append(\" where \");\n        }\n        \n        buildQueryForChildren(ctx);\n\n        return this;\n    }\n\n    protected String createJpql()\n    {\n        QueryBuilderContext ctx = new QueryBuilderContext();\n        buildQuery(ctx);\n        jpqlQuery = ctx.resultString();\n        paramUpdates = ctx.getParameterUpdates();\n        log.log(Level.FINER, \"createJpql: Query is {0}\", jpqlQuery);\n        return jpqlQuery;\n    }\n\n    private Set<Class<? extends QueryPart>> excludedForWhereCheck()\n    {\n        Set<Class<? extends QueryPart>> excluded = new HashSet<Class<? extends QueryPart>>();\n        excluded.add(OrderByQueryPart.class);\n        return excluded;\n    }\n\n    private boolean hasQueryConditions(String[] orderByParts)\n    {\n        String orderByPart = orderByParts[0];\n        String prefix = methodPrefix.getPrefix();\n        return !prefix.equals(orderByPart) && !orderByPart.matches(prefix);\n    }\n\n    private String removePrefix(String queryPart)\n    {\n        return methodPrefix.removePrefix(queryPart);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/CountQueryPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport static org.apache.deltaspike.core.util.StringUtils.isNotEmpty;\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.nullSafeValue;\n\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.JpaQueryPostProcessor;\nimport org.apache.deltaspike.data.impl.param.Parameters;\nimport org.apache.deltaspike.data.impl.util.jpa.QueryStringExtractorFactory;\n\npublic class CountQueryPostProcessor implements JpaQueryPostProcessor\n{\n\n    private static final Logger log = Logger.getLogger(CountQueryPostProcessor.class.getName());\n\n    private final QueryStringExtractorFactory factory = new QueryStringExtractorFactory();\n\n    @Override\n    public Query postProcess(CdiQueryInvocationContext context, Query query)\n    {\n        String queryString = getQueryString(context, query);\n        QueryExtraction extract = new QueryExtraction(queryString);\n        String count = extract.rewriteToCount();\n        log.log(Level.FINER, \"Rewrote query {0} to {1}\", new Object[] { queryString, count });\n        Query result = context.getEntityManager().createQuery(count);\n        Parameters params = context.getParams();\n        params.applyTo(result);\n        return result;\n    }\n\n    private String getQueryString(CdiQueryInvocationContext context, Query query)\n    {\n        if (isNotEmpty(context.getQueryString()))\n        {\n            return context.getQueryString();\n        }\n        return factory.extract(query);\n    }\n\n    private static class QueryExtraction\n    {\n\n        private String select;\n        private String from;\n        private String where;\n\n        private String entityName;\n        private final String query;\n\n        public QueryExtraction(String query)\n        {\n            this.query = query;\n        }\n\n        public String rewriteToCount()\n        {\n            splitQuery();\n            extractEntityName();\n            return rewrite();\n        }\n\n        private String rewrite()\n        {\n            return new StringBuilder()\n                    .append(\"select count(\")\n                        .append(nullSafeValue(select, entityName))\n                    .append(\") \")\n                    .append(from)\n                    .append(nullSafeValue(where))\n                    .toString();\n        }\n\n        private void extractEntityName()\n        {\n            String[] split = from.split(\" \");\n            if (split.length > 1)\n            {\n                entityName = split[split.length - 1];\n            }\n            else\n            {\n                entityName = \"*\";\n            }\n        }\n\n        private void splitQuery()\n        {\n            String lower = query.toLowerCase();\n            int selectIndex = lower.indexOf(\"select\");\n            int fromIndex = lower.indexOf(\"from\");\n            int whereIndex = lower.indexOf(\"where\");\n            int orderByIndex = lower.indexOf(\"order by\");\n            if (selectIndex >= 0)\n            {\n                select = query.substring(\"select\".length(), fromIndex);\n            }\n            if (whereIndex >= 0)\n            {\n                from = query.substring(fromIndex, whereIndex);\n                where = query.substring(whereIndex);\n                if (orderByIndex > 0)\n                {\n                    where = where.substring(0, orderByIndex - whereIndex);\n                }\n            }\n            else\n            {\n                from = query.substring(fromIndex);\n            }\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/FirstResultPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.JpaQueryPostProcessor;\n\npublic class FirstResultPostProcessor implements JpaQueryPostProcessor\n{\n\n    private final int startPosition;\n\n    public FirstResultPostProcessor(int startPosition)\n    {\n        this.startPosition = startPosition;\n    }\n\n    @Override\n    public Query postProcess(CdiQueryInvocationContext context, Query query)\n    {\n        query.setFirstResult(startPosition);\n        return query;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/FlushModePostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.JpaQueryPostProcessor;\n\npublic class FlushModePostProcessor implements JpaQueryPostProcessor\n{\n\n    private final FlushModeType flushMode;\n\n    public FlushModePostProcessor(FlushModeType flushMode)\n    {\n        this.flushMode = flushMode;\n    }\n\n    @Override\n    public Query postProcess(CdiQueryInvocationContext context, Query query)\n    {\n        query.setFlushMode(flushMode);\n        return query;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/HintPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.JpaQueryPostProcessor;\n\npublic class HintPostProcessor implements JpaQueryPostProcessor\n{\n\n    private final String hintName;\n    private final Object hintValue;\n\n    public HintPostProcessor(String hintName, Object hintValue)\n    {\n        this.hintName = hintName;\n        this.hintValue = hintValue;\n    }\n\n    @Override\n    public Query postProcess(CdiQueryInvocationContext context, Query query)\n    {\n        query.setHint(hintName, hintValue);\n        return query;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/LockModePostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.JpaQueryPostProcessor;\n\npublic class LockModePostProcessor implements JpaQueryPostProcessor\n{\n\n    private final LockModeType lockMode;\n\n    public LockModePostProcessor(LockModeType lockMode)\n    {\n        this.lockMode = lockMode;\n    }\n\n    @Override\n    public Query postProcess(CdiQueryInvocationContext context, Query query)\n    {\n        query.setLockMode(lockMode);\n        return query;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/MaxResultPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.JpaQueryPostProcessor;\n\npublic class MaxResultPostProcessor implements JpaQueryPostProcessor\n{\n\n    private final int max;\n\n    public MaxResultPostProcessor(int max)\n    {\n        this.max = max;\n    }\n\n    @Override\n    public Query postProcess(CdiQueryInvocationContext context, Query query)\n    {\n        query.setMaxResults(max);\n        return query;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/postprocessor/OrderByQueryStringPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.postprocessor;\n\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.builder.OrderDirection;\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.handler.QueryStringPostProcessor;\n\npublic class OrderByQueryStringPostProcessor implements QueryStringPostProcessor\n{\n\n    private static final String ORDER_BY = \" order by \";\n\n    private final String attribute;\n    private OrderDirection direction;\n    private boolean appendEntityName;\n\n    public OrderByQueryStringPostProcessor(SingularAttribute<?, ?> attribute, OrderDirection direction,\n                                           boolean appendEntityName)\n    {\n        this.attribute = attribute.getName();\n        this.direction = direction;\n        this.appendEntityName = appendEntityName;\n    }\n\n    public OrderByQueryStringPostProcessor(String attribute, OrderDirection direction, boolean appendEntityName)\n    {\n        this.attribute = attribute;\n        this.direction = direction;\n        this.appendEntityName = appendEntityName;\n    }\n\n    @Override\n    public String postProcess(String queryString)\n    {\n        StringBuilder builder = new StringBuilder(queryString);\n        if (queryString.contains(ORDER_BY))\n        {\n            builder.append(\",\");\n        }\n        else\n        {\n            builder.append(ORDER_BY);\n        }\n        if (appendEntityName)\n        {\n            builder.append(QueryBuilder.ENTITY_NAME)\n                .append(\".\");\n        }\n\n        return builder\n                .append(attribute)\n                .append(\" \").append(direction)\n                .toString();\n    }\n\n    public boolean matches(SingularAttribute<?, ?> attribute)\n    {\n        return matches(attribute.getName());\n    }\n\n    public boolean matches(String attribute)\n    {\n        return this.attribute.equals(attribute);\n    }\n\n    public void changeDirection()\n    {\n        direction = direction.change();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/result/DefaultQueryResult.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.result;\n\nimport java.util.Iterator;\nimport java.util.List;\n\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.NoResultException;\nimport jakarta.persistence.Query;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.impl.builder.OrderDirection;\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.CountQueryPostProcessor;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.FirstResultPostProcessor;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.FlushModePostProcessor;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.HintPostProcessor;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.LockModePostProcessor;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.MaxResultPostProcessor;\nimport org.apache.deltaspike.data.impl.builder.postprocessor.OrderByQueryStringPostProcessor;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.QueryStringPostProcessor;\n\npublic class DefaultQueryResult<T> implements QueryResult<T>\n{\n\n    private final QueryBuilder builder;\n    private final CdiQueryInvocationContext context;\n\n    private int page = 0;\n    private int pageSize = 10;\n\n    public DefaultQueryResult(QueryBuilder builder, CdiQueryInvocationContext context)\n    {\n        this.builder = builder;\n        this.context = context;\n    }\n\n    @Override\n    public <X> QueryResult<T> orderAsc(SingularAttribute<T, X> attribute)\n    {\n        return orderAsc(attribute, true);\n    }\n\n    @Override\n    public <X> QueryResult<T> orderAsc(SingularAttribute<T, X> attribute, boolean appendEntityName)\n    {\n        context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC,\n                appendEntityName));\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> orderAsc(String attribute)\n    {\n        return orderAsc(attribute, true);\n    }\n\n    @Override\n    public QueryResult<T> orderAsc(String attribute, boolean appendEntityName)\n    {\n        context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC,\n                appendEntityName));\n        return this;\n    }\n\n    @Override\n    public <X> QueryResult<T> orderDesc(SingularAttribute<T, X> attribute)\n    {\n        return orderDesc(attribute, true);\n    }\n\n    @Override\n    public <X> QueryResult<T> orderDesc(SingularAttribute<T, X> attribute, boolean appendEntityName)\n    {\n        context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.DESC,\n                appendEntityName));\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> orderDesc(String attribute)\n    {\n        return orderDesc(attribute, true);\n    }\n\n    @Override\n    public QueryResult<T> orderDesc(String attribute, boolean appendEntityName)\n    {\n        context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.DESC,\n                appendEntityName));\n        return this;\n    }\n\n    @Override\n    public <X> QueryResult<T> changeOrder(final SingularAttribute<T, X> attribute)\n    {\n        changeOrder(new ChangeOrder()\n        {\n            @Override\n            public boolean matches(OrderByQueryStringPostProcessor orderBy)\n            {\n                return orderBy.matches(attribute);\n            }\n\n            @Override\n            public void addDefault()\n            {\n                orderAsc(attribute);\n            }\n        });\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> changeOrder(final String attribute)\n    {\n        changeOrder(new ChangeOrder()\n        {\n            @Override\n            public boolean matches(OrderByQueryStringPostProcessor orderBy)\n            {\n                return orderBy.matches(attribute);\n            }\n\n            @Override\n            public void addDefault()\n            {\n                orderAsc(attribute);\n            }\n        });\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> clearOrder()\n    {\n        for (Iterator<QueryStringPostProcessor> it = context.getQueryStringPostProcessors().iterator(); it.hasNext();)\n        {\n            if (it.next() instanceof OrderByQueryStringPostProcessor)\n            {\n                it.remove();\n            }\n        }\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> maxResults(int max)\n    {\n        context.addJpaQueryPostProcessor(new MaxResultPostProcessor(max));\n        pageSize = max;\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> firstResult(int first)\n    {\n        context.addJpaQueryPostProcessor(new FirstResultPostProcessor(first));\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> lockMode(LockModeType lockMode)\n    {\n        context.addJpaQueryPostProcessor(new LockModePostProcessor(lockMode));\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> flushMode(FlushModeType flushMode)\n    {\n        context.addJpaQueryPostProcessor(new FlushModePostProcessor(flushMode));\n        return this;\n    }\n\n    @Override\n    public QueryResult<T> hint(String hint, Object value)\n    {\n        context.addJpaQueryPostProcessor(new HintPostProcessor(hint, value));\n        return this;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public List<T> getResultList()\n    {\n        return ((Query) builder.executeQuery(context)).getResultList();\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public T getSingleResult()\n    {\n        return (T) ((Query) builder.executeQuery(context)).getSingleResult();\n    }\n\n    @Override\n    public T getOptionalResult()\n    {\n        try\n        {\n            return getSingleResult();\n        }\n        catch (NoResultException e)\n        {\n            return null;\n        }\n    }\n\n    @Override\n    public T getAnyResult()\n    {\n        List<T> queryResult = getResultList();\n        return !queryResult.isEmpty() ? queryResult.get(0) : null;\n    }\n\n    @Override\n    public long count()\n    {\n        CountQueryPostProcessor counter = new CountQueryPostProcessor();\n        context.addJpaQueryPostProcessor(counter);\n        try\n        {\n            Long result = (Long) ((Query) builder.executeQuery(context)).getSingleResult();\n            return result.intValue();\n        }\n        catch (RuntimeException e)\n        {\n            throw e;\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n        finally\n        {\n            context.removeJpaQueryPostProcessor(counter);\n        }\n    }\n\n    @Override\n    public QueryResult<T> withPageSize(int pageSize)\n    {\n        return maxResults(pageSize);\n    }\n\n    @Override\n    public QueryResult<T> toPage(int page)\n    {\n        this.page = page;\n        return firstResult(pageSize * page);\n    }\n\n    @Override\n    public QueryResult<T> nextPage()\n    {\n        page = page + 1;\n        return firstResult(pageSize * page);\n    }\n\n    @Override\n    public QueryResult<T> previousPage()\n    {\n        page = page > 0 ? page - 1 : page;\n        return firstResult(pageSize * page);\n    }\n\n    @Override\n    public int countPages()\n    {\n        return (int) Math.ceil((double) count() / pageSize);\n    }\n\n    @Override\n    public int currentPage()\n    {\n        return page;\n    }\n\n    @Override\n    public int pageSize()\n    {\n        return pageSize;\n    }\n\n    private <X> QueryResult<T> changeOrder(ChangeOrder changeOrder)\n    {\n        for (QueryStringPostProcessor processor : context.getQueryStringPostProcessors())\n        {\n            if (processor instanceof OrderByQueryStringPostProcessor)\n            {\n                OrderByQueryStringPostProcessor orderBy = (OrderByQueryStringPostProcessor) processor;\n                if (changeOrder.matches(orderBy))\n                {\n                    orderBy.changeDirection();\n                    return this;\n                }\n            }\n        }\n        changeOrder.addDefault();\n        return this;\n    }\n\n    private abstract static class ChangeOrder\n    {\n\n        public abstract boolean matches(OrderByQueryStringPostProcessor orderBy);\n\n        public abstract void addDefault();\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/result/QueryProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.result;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\n\npublic interface QueryProcessor\n{\n\n    Object executeQuery(Query query, CdiQueryInvocationContext context);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/result/QueryProcessorFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.builder.result;\n\nimport java.lang.reflect.Method;\nimport java.util.List;\nimport java.util.Optional;\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport jakarta.persistence.NoResultException;\nimport jakarta.persistence.Query;\nimport org.apache.deltaspike.core.util.ClassUtils;\n\nimport org.apache.deltaspike.data.api.Modifying;\nimport org.apache.deltaspike.data.api.QueryInvocationException;\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.api.SingleResultType;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata;\n\n@ApplicationScoped\npublic class QueryProcessorFactory\n{\n    private NoOpQueryProcessor noOp;\n    private ListResultQueryProcessor listResult;\n    private StreamResultQueryProcessor streamResult;\n    private ExecuteUpdateQueryProcessor executeUpdate;\n    private SingleResultQueryProcessor singleResult;\n    \n    @PostConstruct\n    public void init()\n    {\n        noOp = new NoOpQueryProcessor();\n        listResult = new ListResultQueryProcessor();\n        streamResult = new StreamResultQueryProcessor();\n        executeUpdate = new ExecuteUpdateQueryProcessor();\n        singleResult = new SingleResultQueryProcessor();\n    }\n    \n    public QueryProcessor build(RepositoryMethodMetadata methodMetadata)\n    {\n        if (ClassUtils.returns(methodMetadata.getMethod(), QueryResult.class))\n        {\n            return noOp;\n        }\n        \n        if (ClassUtils.returns(methodMetadata.getMethod(), List.class))\n        {\n            return listResult;\n        }\n        \n        if (methodMetadata.isReturnsStream())\n        {\n            return streamResult;\n        }\n        \n        if (isModifying(methodMetadata))\n        {\n            return executeUpdate;\n        }\n\n        return singleResult;\n    }\n\n    private boolean isModifying(RepositoryMethodMetadata methodMetadata)\n    {\n        boolean matchesType = Void.TYPE.equals(methodMetadata.getMethod().getReturnType()) ||\n                int.class.equals(methodMetadata.getMethod().getReturnType()) ||\n                Integer.class.equals(methodMetadata.getMethod().getReturnType());\n        return (methodMetadata.getMethod().isAnnotationPresent(Modifying.class) && matchesType)\n                || methodMetadata.getMethodPrefix().isDelete();\n    }\n\n    private static final class ListResultQueryProcessor implements QueryProcessor\n    {\n        @Override\n        public Object executeQuery(Query query, CdiQueryInvocationContext context)\n        {\n            return query.getResultList();\n        }\n    }\n\n    private static final class NoOpQueryProcessor implements QueryProcessor\n    {\n        @Override\n        public Object executeQuery(Query query, CdiQueryInvocationContext context)\n        {\n            return query;\n        }\n    }\n\n    private static final class StreamResultQueryProcessor implements QueryProcessor\n    {\n        // will be cached per @ApplicationScoped\n        private boolean initialized;\n        private Method getResultStreamMethod;\n        \n        @Override\n        public Object executeQuery(Query query, CdiQueryInvocationContext context)\n        {\n            if (initialized == false)\n            {\n                initialized = true;\n                try\n                {\n                    // take the query.getClass() instead of Query.class\n                    // as the users might use JPA 2.2 API but still a JPA 2.0 impl (could happen in TomEE soon)\n                    getResultStreamMethod = query.getClass().getMethod(\"getResultStream\");\n                }\n                catch (Exception e)\n                {\n                    // ignore\n                }\n            }\n\n            if (getResultStreamMethod != null)\n            {\n                try\n                {\n                    // delegate to JPA 2.2, which is probably optimized and fetches the data lazy\n                    return getResultStreamMethod.invoke(query);\n                }\n                catch (Exception e)\n                {\n                    throw new QueryInvocationException(e, context);\n                }\n            }\n            \n            return query.getResultList().stream();\n        }\n    }\n\n    private static final class SingleResultQueryProcessor implements QueryProcessor\n    {\n        @Override\n        public Object executeQuery(Query query, CdiQueryInvocationContext context)\n        {\n            SingleResultType style = context.getRepositoryMethodMetadata().getSingleResultType();\n            Object result = null;\n            switch (style)\n            {\n                case JPA:\n                    return query.getSingleResult();\n                case OPTIONAL:\n                    try\n                    {\n                        result = query.getSingleResult();\n                    }\n                    catch (NoResultException e)\n                    {\n                    }\n                    break;\n                default:\n                    @SuppressWarnings(\"unchecked\")\n                    List<Object> queryResult = query.getResultList();\n                    result = !queryResult.isEmpty() ? queryResult.get(0) : null;\n            }\n            \n            if (context.getRepositoryMethodMetadata().isReturnsOptional())\n            {\n                return Optional.ofNullable(result);\n            }\n            else\n            {\n                return result;\n            }\n        }\n    }\n\n    private static final class ExecuteUpdateQueryProcessor implements QueryProcessor\n    {\n        @Override\n        public Object executeQuery(Query query, CdiQueryInvocationContext context)\n        {\n            return query.executeUpdate();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/QueryCriteria.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.Collection;\r\nimport java.util.LinkedList;\r\nimport java.util.List;\r\nimport java.util.logging.Level;\r\nimport java.util.logging.Logger;\r\n\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.persistence.NoResultException;\r\nimport jakarta.persistence.TypedQuery;\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.CriteriaQuery;\r\nimport jakarta.persistence.criteria.From;\r\nimport jakarta.persistence.criteria.JoinType;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.criteria.Selection;\r\nimport jakarta.persistence.metamodel.CollectionAttribute;\r\nimport jakarta.persistence.metamodel.ListAttribute;\r\nimport jakarta.persistence.metamodel.MapAttribute;\r\nimport jakarta.persistence.metamodel.PluralAttribute;\r\nimport jakarta.persistence.metamodel.SetAttribute;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\nimport org.apache.deltaspike.data.api.criteria.Criteria;\r\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\r\nimport org.apache.deltaspike.data.impl.builder.OrderDirection;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.Between;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.Eq;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.EqIgnoreCase;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.FetchBuilder;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.GreaterThan;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.GreaterThanOrEqual;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.In;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.IsEmpty;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.IsNotEmpty;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.IsNotNull;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.IsNull;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.JoinBuilder;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.LessThan;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.LessThanOrEqual;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.Like;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.NotEq;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.NotEqIgnoreCase;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.NotLike;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.OrBuilder;\r\nimport org.apache.deltaspike.data.impl.criteria.predicate.PredicateBuilder;\r\nimport org.apache.deltaspike.data.impl.criteria.processor.OrderBy;\r\nimport org.apache.deltaspike.data.impl.criteria.processor.QueryProcessor;\r\n\r\npublic class QueryCriteria<C, R> implements Criteria<C, R>\r\n{\r\n\r\n    private static final Logger log = Logger.getLogger(QueryCriteria.class.getName());\r\n\r\n    private EntityManager entityManager;\r\n    private Class<C> entityClass;\r\n    private Class<R> resultClass;\r\n    private JoinType joinType;\r\n    private final boolean ignoreNull = true;\r\n    private boolean distinct = false;\r\n\r\n    private final OrderBy<C> orderByProcessor = new OrderBy<C>();\r\n    private final List<PredicateBuilder<C>> builders = new LinkedList<PredicateBuilder<C>>();\r\n    private final List<QueryProcessor<C>> processors = new LinkedList<QueryProcessor<C>>();\r\n    private final List<QuerySelection<? super C, ?>> selections = new LinkedList<QuerySelection<? super C, ?>>();\r\n\r\n    public QueryCriteria(Class<C> entityClass, Class<R> resultClass, EntityManager entityManager)\r\n    {\r\n        this(entityClass, resultClass, entityManager, null);\r\n    }\r\n\r\n    public QueryCriteria(Class<C> entityClass, Class<R> resultClass, EntityManager entityManager, JoinType joinType)\r\n    {\r\n        this.entityClass = entityClass;\r\n        this.resultClass = resultClass;\r\n        this.entityManager = entityManager;\r\n        this.joinType = joinType;\r\n    }\r\n\r\n    // --------------------------------------------------------------------\r\n    // Public criteria methods\r\n    // --------------------------------------------------------------------\r\n\r\n    @Override\r\n    public List<R> getResultList()\r\n    {\r\n        return createQuery().getResultList();\r\n    }\r\n\r\n    @Override\r\n    public R getSingleResult()\r\n    {\r\n        return createQuery().getSingleResult();\r\n    }\r\n\r\n    @Override\r\n    public R getOptionalResult()\r\n    {\r\n        try\r\n        {\r\n            return getSingleResult();\r\n        }\r\n        catch (NoResultException e)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public R getAnyResult()\r\n    {\r\n        List<R> queryResult = getResultList();\r\n        return !queryResult.isEmpty() ? queryResult.get(0) : null;\r\n    }\r\n\r\n    @Override\r\n    public TypedQuery<R> createQuery()\r\n    {\r\n        try\r\n        {\r\n            CriteriaBuilder builder = entityManager.getCriteriaBuilder();\r\n            CriteriaQuery<R> query = createCriteriaQuery(builder);\r\n            From<C, C> root = query.from(entityClass);\r\n            if (selections.size() == 1)\r\n            {\r\n                Selection<?>[] selections = prepareSelections(query, builder, root);\r\n                query.select((Selection<? extends R>) selections[0]);\r\n            }\r\n            if (selections.size() > 1)\r\n            {\r\n                query.multiselect(prepareSelections(query, builder, root));\r\n            }\r\n            List<Predicate> predicates = predicates(builder, root);\r\n            query.distinct(distinct);\r\n            if (!predicates.isEmpty())\r\n            {\r\n                query.where(predicates.toArray(new Predicate[predicates.size()]));\r\n            }\r\n            applyProcessors(query, builder, root);\r\n            return (TypedQuery<R>) entityManager.createQuery(query);\r\n        }\r\n        catch (RuntimeException e)\r\n        {\r\n            log.log(Level.SEVERE, \"Exception while creating JPA query\", e);\r\n            throw e;\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public Criteria<C, R> or(Criteria<C, R>... criteria)\r\n    {\r\n        return internalOr(criteria);\r\n    }\r\n\r\n    @Override\r\n    @SuppressWarnings(\"unchecked\")\r\n    public Criteria<C, R> or(Collection<Criteria<C, R>> criteria)\r\n    {\r\n        return internalOr(criteria.toArray(new Criteria[criteria.size()]));\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> join(SingularAttribute<? super C, P> att, Criteria<P, P> criteria)\r\n    {\r\n        add(new JoinBuilder<C, P, E>(criteria, joinType, att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> join(ListAttribute<? super C, P> att, Criteria<P, P> criteria)\r\n    {\r\n        add(new JoinBuilder<C, P, E>(criteria, joinType, att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> join(CollectionAttribute<? super C, P> att, Criteria<P, P> criteria)\r\n    {\r\n        add(new JoinBuilder<C, P, E>(criteria, joinType, att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> join(SetAttribute<? super C, P> att, Criteria<P, P> criteria)\r\n    {\r\n        add(new JoinBuilder<C, P, E>(criteria, joinType, att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> join(MapAttribute<? super C, E, P> att, Criteria<P, P> criteria)\r\n    {\r\n        add(new JoinBuilder<C, P, E>(criteria, joinType, att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> fetch(SingularAttribute<? super C, P> att)\r\n    {\r\n        add(new FetchBuilder<C, P, E>(att, null));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> fetch(SingularAttribute<? super C, P> att, JoinType joinType)\r\n    {\r\n        add(new FetchBuilder<C, P, E>(att, joinType));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> fetch(PluralAttribute<? super C, P, E> att)\r\n    {\r\n        add(new FetchBuilder<C, P, E>(att, null));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P, E> Criteria<C, R> fetch(PluralAttribute<? super C, P, E> att, JoinType joinType)\r\n    {\r\n        add(new FetchBuilder<C, P, E>(att, joinType));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> orderAsc(SingularAttribute<? super C, P> att)\r\n    {\r\n        addOrderBy(att, OrderDirection.ASC);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> orderDesc(SingularAttribute<? super C, P> att)\r\n    {\r\n        addOrderBy(att, OrderDirection.DESC);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public Criteria<C, R> distinct()\r\n    {\r\n        distinct = true;\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <N> Criteria<C, N> select(Class<N> resultClass, QuerySelection<? super C, ?>... selection)\r\n    {\r\n        QueryCriteria<C, N> result = new QueryCriteria<C, N>(entityClass, resultClass, entityManager, joinType);\r\n        result.builders.addAll(this.builders);\r\n        result.distinct = this.distinct;\r\n        result.processors.addAll(this.processors);\r\n        result.selections.addAll(Arrays.asList(selection));\r\n        return result;\r\n    }\r\n\r\n    @Override\r\n    public Criteria<C, Object[]> select(QuerySelection<? super C, ?>... selection)\r\n    {\r\n        return select(Object[].class, selection);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> predicates(CriteriaBuilder builder, Path<C> path)\r\n    {\r\n        List<Predicate> predicates = new LinkedList<Predicate>();\r\n        for (PredicateBuilder<C> pbuilder : builders)\r\n        {\r\n            List<Predicate> p = pbuilder.build(builder, path);\r\n            predicates.addAll(p);\r\n        }\r\n        return predicates;\r\n    }\r\n\r\n    // --------------------------------------------------------------------\r\n    // Package criteria methods\r\n    // --------------------------------------------------------------------\r\n\r\n    void applyProcessors(CriteriaQuery<?> query, CriteriaBuilder builder, From<C, C> from)\r\n    {\r\n        orderByProcessor.process(query, builder, from);\r\n        for (QueryProcessor<C> proc : processors)\r\n        {\r\n            proc.process(query, builder, from);\r\n        }\r\n    }\r\n\r\n    @SuppressWarnings(\"unchecked\")\r\n    Criteria<C, R> internalOr(Criteria<C, R>... others)\r\n    {\r\n        List<Criteria<C, R>> list = new LinkedList<Criteria<C, R>>();\r\n        list.addAll(Arrays.asList(others));\r\n        add(new OrBuilder<C>(list.toArray(new Criteria[list.size()])));\r\n        return this;\r\n    }\r\n\r\n    // --------------------------------------------------------------------\r\n    // Private criteria methods\r\n    // --------------------------------------------------------------------\r\n\r\n    private void add(PredicateBuilder<C> pred)\r\n    {\r\n        builders.add(pred);\r\n    }\r\n\r\n    private <P> void add(PredicateBuilder<C> pred, P value)\r\n    {\r\n        if (ignoreNull && value != null)\r\n        {\r\n            builders.add(pred);\r\n        }\r\n        else if (!ignoreNull)\r\n        {\r\n            builders.add(pred);\r\n        }\r\n    }\r\n\r\n    private <P> void addOrderBy(SingularAttribute<? super C, P> att, OrderDirection orderDirection)\r\n    {\r\n        orderByProcessor.add(att, orderDirection);\r\n    }\r\n\r\n    private Selection<?>[] prepareSelections(CriteriaQuery<?> query, CriteriaBuilder builder, From<C, C> root)\r\n    {\r\n        List<Selection<?>> result = new ArrayList<Selection<?>>(selections.size());\r\n        for (QuerySelection<? super C, ?> selection : selections)\r\n        {\r\n            result.add(selection.toSelection(query, builder, root));\r\n        }\r\n        return result.toArray(new Selection<?>[] {});\r\n    }\r\n\r\n    private CriteriaQuery<R> createCriteriaQuery(CriteriaBuilder builder)\r\n    {\r\n        return builder.createQuery(resultClass);\r\n    }\r\n\r\n    // --------------------------------------------------------------------\r\n    // Predicates\r\n    // --------------------------------------------------------------------\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> eq(SingularAttribute<? super C, P> att, P value)\r\n    {\r\n        add(new Eq<C, P>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> eqIgnoreCase(SingularAttribute<? super C, String> att, String value)\r\n    {\r\n        add(new EqIgnoreCase<C>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> notEq(SingularAttribute<? super C, P> att, P value)\r\n    {\r\n        add(new NotEq<C, P>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> notEqIgnoreCase(SingularAttribute<? super C, String> att, String value)\r\n    {\r\n        add(new NotEqIgnoreCase<C>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> like(SingularAttribute<? super C, String> att, String value)\r\n    {\r\n        add(new Like<C>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> likeIgnoreCase(SingularAttribute<? super C, String> att, String value)\r\n    {\r\n        add(new Like<C>(att, value, true), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> notLike(SingularAttribute<? super C, String> att, String value)\r\n    {\r\n        add(new NotLike<C>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> notLikeIgnoreCase(SingularAttribute<? super C, String> att, String value)\r\n    {\r\n        add(new NotLike<C>(att, value, true), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Comparable<? super P>> Criteria<C, R> lt(SingularAttribute<? super C, P> att, P value)\r\n    {\r\n        add(new LessThan<C, P>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Comparable<? super P>> Criteria<C, R> ltOrEq(SingularAttribute<? super C, P> att, P value)\r\n    {\r\n        add(new LessThanOrEqual<C, P>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Comparable<? super P>> Criteria<C, R> gt(SingularAttribute<? super C, P> att, P value)\r\n    {\r\n        add(new GreaterThan<C, P>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Comparable<? super P>> Criteria<C, R> gtOrEq(SingularAttribute<? super C, P> att, P value)\r\n    {\r\n        add(new GreaterThanOrEqual<C, P>(att, value), value);\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Comparable<? super P>> Criteria<C, R> between(SingularAttribute<? super C, P> att, P lower,\r\n            P upper)\r\n    {\r\n        add(new Between<C, P>(att, lower, upper));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> isNull(SingularAttribute<? super C, P> att)\r\n    {\r\n        add(new IsNull<C, P>(att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> notNull(SingularAttribute<? super C, P> att)\r\n    {\r\n        add(new IsNotNull<C, P>(att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Collection<?>> Criteria<C, R> empty(SingularAttribute<? super C, P> att)\r\n    {\r\n        add(new IsEmpty<C, P>(att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P extends Collection<?>> Criteria<C, R> notEmpty(SingularAttribute<? super C, P> att)\r\n    {\r\n        add(new IsNotEmpty<C, P>(att));\r\n        return this;\r\n    }\r\n\r\n    @Override\r\n    public <P> Criteria<C, R> in(SingularAttribute<? super C, P> att, P... values)\r\n    {\r\n        add(new In<C, P>(att, values), values);\r\n        return this;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/Between.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class Between<E, V extends Comparable<? super V>> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    private final V upper;\r\n\r\n    public Between(SingularAttribute<? super E, V> att, V lower, V upper)\r\n    {\r\n        super(att, lower);\r\n        this.upper = upper;\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.between(path.get(getAtt()), getValue(), upper));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/Eq.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class Eq<E, V> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    public Eq(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.equal(path.get(getAtt()), getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/EqIgnoreCase.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class EqIgnoreCase<E> extends SingleValueBuilder<E, String>\r\n{\r\n\r\n    public EqIgnoreCase(SingularAttribute<? super E, String> att, String value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.equal(builder.upper(path.<String>get(getAtt())), getValue().toUpperCase()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/FetchBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Collections;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.From;\r\nimport jakarta.persistence.criteria.JoinType;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.PluralAttribute;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class FetchBuilder<P, R, E> implements PredicateBuilder<P>\r\n{\r\n\r\n    private final JoinType joinType;\r\n\r\n    private SingularAttribute<? super P, R> singular;\r\n    private PluralAttribute<? super P, R, E> plural;\r\n\r\n    public FetchBuilder(SingularAttribute<? super P, R> singular, JoinType joinType)\r\n    {\r\n        this.joinType = joinType;\r\n        this.singular = singular;\r\n    }\r\n\r\n    public FetchBuilder(PluralAttribute<? super P, R, E> plural, JoinType joinType)\r\n    {\r\n        this.joinType = joinType;\r\n        this.plural = plural;\r\n    }\r\n\r\n    @SuppressWarnings(\"rawtypes\")\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<P> path)\r\n    {\r\n        if (singular != null)\r\n        {\r\n            fetchSingular((From) path);\r\n        }\r\n        else if (plural != null)\r\n        {\r\n            fetchPlural((From) path);\r\n        }\r\n        return Collections.emptyList();\r\n    }\r\n\r\n    SingularAttribute<? super P, R> getSingular()\r\n    {\r\n        return singular;\r\n    }\r\n\r\n    void setSingular(SingularAttribute<? super P, R> singular)\r\n    {\r\n        this.singular = singular;\r\n    }\r\n\r\n    PluralAttribute<? super P, R, E> getPlural()\r\n    {\r\n        return plural;\r\n    }\r\n\r\n    void setPlural(PluralAttribute<? super P, R, E> plural)\r\n    {\r\n        this.plural = plural;\r\n    }\r\n\r\n    JoinType getJoinType()\r\n    {\r\n        return joinType;\r\n    }\r\n\r\n    @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\r\n    private void fetchSingular(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            path.fetch(singular);\r\n        }\r\n        else\r\n        {\r\n            path.fetch(singular, joinType);\r\n        }\r\n    }\r\n\r\n    @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\r\n    private void fetchPlural(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            path.fetch(plural);\r\n        }\r\n        else\r\n        {\r\n            path.fetch(plural, joinType);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/GreaterThan.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class GreaterThan<E, V extends Comparable<? super V>> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    public GreaterThan(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.greaterThan(path.get(getAtt()), getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/GreaterThanOrEqual.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class GreaterThanOrEqual<E, V extends Comparable<? super V>> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    public GreaterThanOrEqual(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.greaterThanOrEqualTo(path.get(getAtt()), getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/In.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class In<P, V> implements PredicateBuilder<P>\r\n{\r\n\r\n    private final SingularAttribute<? super P, V> singular;\r\n    private final V[] values;\r\n\r\n    public In(SingularAttribute<? super P, V> singular, V[] values)\r\n    {\r\n        this.singular = singular;\r\n        this.values = Arrays.copyOf(values, values.length);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<P> path)\r\n    {\r\n        Path<V> p = path.get(singular);\r\n        CriteriaBuilder.In<V> in = builder.in(p);\r\n        for (V value : values)\r\n        {\r\n            if (value != null)\r\n            {\r\n                in.value(value);\r\n            }\r\n        }\r\n        return Arrays.asList((Predicate) in);\r\n    }\r\n\r\n    SingularAttribute<? super P, V> getSingular()\r\n    {\r\n        return singular;\r\n    }\r\n\r\n    V[] getValues()\r\n    {\r\n        return values;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/IsEmpty.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.Collection;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class IsEmpty<E, V extends Collection<?>> extends NoValueBuilder<E, V>\r\n{\r\n\r\n    public IsEmpty(SingularAttribute<? super E, V> att)\r\n    {\r\n        super(att);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.isEmpty(path.get(getAtt())));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/IsNotEmpty.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.Collection;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class IsNotEmpty<E, V extends Collection<?>> extends NoValueBuilder<E, V>\r\n{\r\n\r\n    public IsNotEmpty(SingularAttribute<? super E, V> att)\r\n    {\r\n        super(att);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.isNotEmpty(path.get(getAtt())));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/IsNotNull.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class IsNotNull<E, V> extends NoValueBuilder<E, V>\r\n{\r\n\r\n    public IsNotNull(SingularAttribute<? super E, V> att)\r\n    {\r\n        super(att);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.isNotNull(path.get(getAtt())));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/IsNull.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class IsNull<E, V> extends NoValueBuilder<E, V>\r\n{\r\n\r\n    public IsNull(SingularAttribute<? super E, V> att)\r\n    {\r\n        super(att);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.isNull(path.get(getAtt())));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/JoinBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.From;\r\nimport jakarta.persistence.criteria.Join;\r\nimport jakarta.persistence.criteria.JoinType;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.CollectionAttribute;\r\nimport jakarta.persistence.metamodel.ListAttribute;\r\nimport jakarta.persistence.metamodel.MapAttribute;\r\nimport jakarta.persistence.metamodel.SetAttribute;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\nimport org.apache.deltaspike.data.api.criteria.Criteria;\r\n\r\n@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\r\npublic class JoinBuilder<P, R, E> implements PredicateBuilder<P>\r\n{\r\n\r\n    private final Criteria<R, R> criteria;\r\n    private final JoinType joinType;\r\n\r\n    private SingularAttribute<? super P, R> singular;\r\n    private ListAttribute<? super P, R> list;\r\n    private CollectionAttribute<? super P, R> collection;\r\n    private SetAttribute<? super P, R> set;\r\n    private MapAttribute<? super P, E, R> map;\r\n\r\n    public JoinBuilder(Criteria<R, R> criteria, JoinType joinType)\r\n    {\r\n        this.criteria = criteria;\r\n        this.joinType = joinType;\r\n    }\r\n\r\n    public JoinBuilder(Criteria<R, R> criteria, JoinType joinType, SingularAttribute<? super P, R> singular)\r\n    {\r\n        this(criteria, joinType);\r\n        this.singular = singular;\r\n    }\r\n\r\n    public JoinBuilder(Criteria<R, R> criteria, JoinType joinType, ListAttribute<? super P, R> list)\r\n    {\r\n        this(criteria, joinType);\r\n        this.list = list;\r\n    }\r\n\r\n    public JoinBuilder(Criteria<R, R> criteria, JoinType joinType, CollectionAttribute<? super P, R> collection)\r\n    {\r\n        this(criteria, joinType);\r\n        this.collection = collection;\r\n    }\r\n\r\n    public JoinBuilder(Criteria<R, R> criteria, JoinType joinType, SetAttribute<? super P, R> set)\r\n    {\r\n        this(criteria, joinType);\r\n        this.set = set;\r\n    }\r\n\r\n    public JoinBuilder(Criteria<R, R> criteria, JoinType joinType, MapAttribute<? super P, E, R> map)\r\n    {\r\n        this(criteria, joinType);\r\n        this.map = map;\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<P> path)\r\n    {\r\n        Join join = null;\r\n        if (singular != null)\r\n        {\r\n            join = joinSingular((From) path);\r\n        }\r\n        else if (list != null)\r\n        {\r\n            join = joinList((From) path);\r\n        }\r\n        else if (collection != null)\r\n        {\r\n            join = joinCollection((From) path);\r\n        }\r\n        else if (set != null)\r\n        {\r\n            join = joinSet((From) path);\r\n        }\r\n        else\r\n        {\r\n            join = joinMap((From) path);\r\n        }\r\n        return criteria.predicates(builder, join);\r\n    }\r\n\r\n    private Join joinSingular(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            return path.join(singular);\r\n        }\r\n        return path.join(singular, joinType);\r\n    }\r\n\r\n    private Join joinList(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            return path.join(list);\r\n        }\r\n        return path.join(list, joinType);\r\n    }\r\n\r\n    private Join joinCollection(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            return path.join(collection);\r\n        }\r\n        return path.join(collection, joinType);\r\n    }\r\n\r\n    private Join joinSet(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            return path.join(set);\r\n        }\r\n        return path.join(set, joinType);\r\n    }\r\n\r\n    private Join joinMap(From path)\r\n    {\r\n        if (joinType == null)\r\n        {\r\n            return path.join(map);\r\n        }\r\n        return path.join(map, joinType);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/LessThan.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class LessThan<E, V extends Comparable<? super V>> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    public LessThan(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.lessThan(path.get(getAtt()), getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/LessThanOrEqual.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class LessThanOrEqual<E, V extends Comparable<? super V>> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    public LessThanOrEqual(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.lessThanOrEqualTo(path.get(getAtt()), getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/Like.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class Like<E> extends SingleValueBuilder<E, String>\r\n{\r\n\r\n    private final boolean caseInsensitive;\r\n\r\n    public Like(SingularAttribute<? super E, String> att, String value)\r\n    {\r\n        this(att, value, false);\r\n    }\r\n\r\n    public Like(SingularAttribute<? super E, String> att, String value, boolean caseInsensitive)\r\n    {\r\n        super(att, value);\r\n        this.caseInsensitive = caseInsensitive;\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.like(\r\n                caseInsensitive ? builder.upper(path.<String>get(getAtt())) : path.get(getAtt()),\r\n                caseInsensitive ? getValue().toUpperCase() : getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/NoValueBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\nabstract class NoValueBuilder<E, V> implements PredicateBuilder<E>\r\n{\r\n\r\n    private final SingularAttribute<? super E, V> att;\r\n\r\n    NoValueBuilder(SingularAttribute<? super E, V> att)\r\n    {\r\n        this.att = att;\r\n    }\r\n\r\n    SingularAttribute<? super E, V> getAtt()\r\n    {\r\n        return att;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/NotEq.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class NotEq<E, V> extends SingleValueBuilder<E, V>\r\n{\r\n\r\n    public NotEq(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.notEqual(path.get(getAtt()), getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/NotEqIgnoreCase.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class NotEqIgnoreCase<E> extends SingleValueBuilder<E, String>\r\n{\r\n\r\n    public NotEqIgnoreCase(SingularAttribute<? super E, String> att, String value)\r\n    {\r\n        super(att, value);\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.notEqual(builder.upper(path.<String>get(getAtt())), getValue().toUpperCase()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/NotLike.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\npublic class NotLike<E> extends SingleValueBuilder<E, String>\r\n{\r\n\r\n    private final boolean caseInsensitive;\r\n\r\n    public NotLike(SingularAttribute<? super E, String> att, String value)\r\n    {\r\n        this(att, value, false);\r\n    }\r\n\r\n    public NotLike(SingularAttribute<? super E, String> att, String value, boolean caseInsensitive)\r\n    {\r\n        super(att, value);\r\n        this.caseInsensitive = caseInsensitive;\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<E> path)\r\n    {\r\n        return Arrays.asList(builder.notLike(\r\n                caseInsensitive ? builder.upper(path.<String>get(getAtt())) : path.get(getAtt()),\r\n                caseInsensitive ? getValue().toUpperCase() : getValue()));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/OrBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\n\r\nimport org.apache.deltaspike.data.api.criteria.Criteria;\r\n\r\npublic class OrBuilder<P> implements PredicateBuilder<P>\r\n{\r\n\r\n    private final Criteria<P, P>[] criteria;\r\n\r\n    public OrBuilder(Criteria<P, P>... criteria)\r\n    {\r\n        this.criteria = criteria;\r\n    }\r\n\r\n    @Override\r\n    public List<Predicate> build(CriteriaBuilder builder, Path<P> path)\r\n    {\r\n        List<Predicate> and = new ArrayList<Predicate>(criteria.length);\r\n        for (Criteria<P, P> c : criteria)\r\n        {\r\n            and.add(builder.and(\r\n                    c.predicates(builder, path).toArray(new Predicate[0])));\r\n        }\r\n        return Arrays.asList(builder.or(and.toArray(new Predicate[0])));\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/PredicateBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.criteria.Predicate;\r\n\r\npublic interface PredicateBuilder<P>\r\n{\r\n\r\n    List<Predicate> build(CriteriaBuilder builder, Path<P> path);\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/predicate/SingleValueBuilder.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.predicate;\r\n\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\nabstract class SingleValueBuilder<E, V> extends NoValueBuilder<E, V>\r\n{\r\n\r\n    private final V value;\r\n\r\n    SingleValueBuilder(SingularAttribute<? super E, V> att, V value)\r\n    {\r\n        super(att);\r\n        this.value = value;\r\n    }\r\n\r\n    V getValue()\r\n    {\r\n        return value;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/processor/OrderBy.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.processor;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.CriteriaQuery;\r\nimport jakarta.persistence.criteria.Order;\r\nimport jakarta.persistence.criteria.Path;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\nimport org.apache.deltaspike.data.impl.builder.OrderDirection;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\n\r\npublic class OrderBy<P> implements QueryProcessor<P>\r\n{\r\n\r\n    private final List<OrderByDefinition<?>> orderByDefinitions = new ArrayList<OrderByDefinition<?>>();\r\n\r\n    public <V> void add(SingularAttribute<? super P, V> att, OrderDirection dir)\r\n    {\r\n        orderByDefinitions.add(new OrderByDefinition<V>(att, dir));\r\n    }\r\n\r\n    @Override\r\n    public <R> void process(CriteriaQuery<R> query, CriteriaBuilder builder, Path<P> path)\r\n    {\r\n        List<Order> orders = new ArrayList<Order>();\r\n        Iterator<OrderByDefinition<?>> iterator = orderByDefinitions.iterator();\r\n        while (iterator.hasNext())\r\n        {\r\n            OrderByDefinition<?> orderByDefinition = iterator.next();\r\n            switch (orderByDefinition.getDir())\r\n            {\r\n                case ASC:\r\n                    orders.add(builder.asc(path.get(orderByDefinition.getAtt())));\r\n                    break;\r\n                default:\r\n                    orders.add(builder.desc(path.get(orderByDefinition.getAtt())));\r\n            }\r\n        }\r\n        query.orderBy(orders);\r\n    }\r\n\r\n    private class OrderByDefinition<V>\r\n    {\r\n        private final SingularAttribute<? super P, V> att;\r\n        private final OrderDirection dir;\r\n\r\n        public OrderByDefinition(SingularAttribute<? super P, V> att, OrderDirection dir)\r\n        {\r\n            this.att = att;\r\n            this.dir = dir;\r\n        }\r\n\r\n        public SingularAttribute<? super P, V> getAtt()\r\n        {\r\n            return att;\r\n        }\r\n\r\n        public OrderDirection getDir()\r\n        {\r\n            return dir;\r\n        }\r\n\r\n        @Override\r\n        public boolean equals(Object o)\r\n        {\r\n            if (this == o)\r\n            {\r\n                return true;\r\n            }\r\n            if (getClass() != o.getClass())\r\n            {\r\n                return false;\r\n            }\r\n\r\n            @SuppressWarnings(\"unchecked\")\r\n            OrderByDefinition<V> that = (OrderByDefinition<V>) o;\r\n\r\n            if (att != null ? !att.equals(that.att) : that.att != null)\r\n            {\r\n                return false;\r\n            }\r\n            return dir == that.dir;\r\n\r\n        }\r\n\r\n        @Override\r\n        public int hashCode()\r\n        {\r\n            int result = att != null ? att.hashCode() : 0;\r\n            result = 31 * result + (dir != null ? dir.hashCode() : 0);\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/processor/QueryProcessor.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.criteria.processor;\r\n\r\nimport jakarta.persistence.criteria.CriteriaBuilder;\r\nimport jakarta.persistence.criteria.CriteriaQuery;\r\nimport jakarta.persistence.criteria.Path;\r\n\r\npublic interface QueryProcessor<P>\r\n{\r\n\r\n    <R> void process(CriteriaQuery<R> query, CriteriaBuilder builder, Path<P> path);\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/AttributeQuerySelection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\npublic class AttributeQuerySelection<P, X> extends SingularAttributeSelection<P, X>\n{\n\n    public AttributeQuerySelection(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return path.get(getAttribute());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/SingularAttributeSelection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection;\n\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\n\npublic abstract class SingularAttributeSelection<P, X> implements QuerySelection<P, X>\n{\n\n    protected final SingularAttribute<? super P, X> attribute;\n\n    public SingularAttributeSelection(SingularAttribute<? super P, X> attribute)\n    {\n        this.attribute = attribute;\n    }\n\n    public SingularAttribute<? super P, X> getAttribute()\n    {\n        return attribute;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Abs.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Abs<P, X extends Number> extends SingularAttributeSelection<P, X>\n{\n\n    public Abs(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.abs(path.get(attribute));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Avg.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Avg<P, X extends Number> extends SingularAttributeSelection<P, X>\n{\n\n    public Avg(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return (Selection<X>) builder.avg(path.get(attribute));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Count.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\n\npublic class Count<P> implements QuerySelection<P, Long>\n{\n\n    private final SingularAttribute<? super P, ?> attribute;\n\n    public Count(SingularAttribute<? super P, ?> attribute)\n    {\n        this.attribute = attribute;\n    }\n\n    @Override\n    public <R> Selection<Long> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.count(path.get(attribute));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/CountDistinct.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\n\npublic class CountDistinct<P> implements QuerySelection<P, Long>\n{\n\n    private final SingularAttribute<? super P, ?> attribute;\n\n    public CountDistinct(SingularAttribute<? super P, ?> attribute)\n    {\n        this.attribute = attribute;\n    }\n\n    @Override\n    public <R> Selection<Long> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.countDistinct(path.get(attribute));\n    }\n}"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Max.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Max<P, X extends Number> extends SingularAttributeSelection<P, X>\n{\n\n    public Max(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.max(path.get(attribute));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Min.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Min<P, X extends Number> extends SingularAttributeSelection<P, X>\n{\n\n    public Min(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.min(path.get(attribute));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Modulo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Modulo<P> extends SingularAttributeSelection<P, Integer>\n{\n\n    private final Integer modulo;\n\n    public Modulo(SingularAttribute<? super P, Integer> attribute, Integer modulo)\n    {\n        super(attribute);\n        this.modulo = modulo;\n    }\n\n    @Override\n    public <R> Selection<Integer> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.mod(path.get(attribute), modulo);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Neg.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Neg<P, X extends Number> extends SingularAttributeSelection<P, X>\n{\n\n    public Neg(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.neg(path.get(attribute));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Sum.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.numeric;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Sum<P, X extends Number> extends SingularAttributeSelection<P, X>\n{\n\n    public Sum(SingularAttribute<? super P, X> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<X> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.sum(path.get(attribute));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Lower.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.strings;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Lower<P> extends SingularAttributeSelection<P, String>\n{\n\n    public Lower(SingularAttribute<? super P, String> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<String> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.lower(path.get(getAttribute()));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFrom.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.strings;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class SubstringFrom<P> extends SingularAttributeSelection<P, String>\n{\n\n    private final int from;\n\n    public SubstringFrom(SingularAttribute<? super P, String> attribute, int from)\n    {\n        super(attribute);\n        this.from = from;\n    }\n\n    @Override\n    public <R> Selection<String> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.substring(path.get(getAttribute()), from);\n    }\n\n    int getFrom()\n    {\n        return from;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFromTo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.strings;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\npublic class SubstringFromTo<P> extends SubstringFrom<P>\n{\n\n    private final int length;\n\n    public SubstringFromTo(SingularAttribute<? super P, String> attribute, int from, int length)\n    {\n        super(attribute, from);\n        this.length = length;\n    }\n\n    @Override\n    public <R> Selection<String> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.substring(path.get(getAttribute()), getFrom(), length);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Trim.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.strings;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\npublic class Trim<P> extends SingularAttributeSelection<P, String>\n{\n\n    private final CriteriaBuilder.Trimspec trimspec;\n\n\n    public Trim(SingularAttribute<? super P, String> attribute)\n    {\n        super(attribute);\n        this.trimspec = CriteriaBuilder.Trimspec.BOTH;\n    }\n\n    public Trim(CriteriaBuilder.Trimspec trimspec, SingularAttribute<? super P, String> attribute)\n    {\n        super(attribute);\n        this.trimspec = trimspec;\n    }\n\n    @Override\n    public <R> Selection<String> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.trim(this.trimspec, path.get(getAttribute()));\n    }\n}"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Upper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.strings;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelection;\n\npublic class Upper<P> extends SingularAttributeSelection<P, String>\n{\n\n    public Upper(SingularAttribute<? super P, String> attribute)\n    {\n        super(attribute);\n    }\n\n    @Override\n    public <R> Selection<String> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.upper(path.get(getAttribute()));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/temporal/CurrentDate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.temporal;\n\nimport java.sql.Date;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\n\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\n\npublic class CurrentDate<P> implements QuerySelection<P, Date>\n{\n\n    @Override\n    public <R> Selection<Date> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.currentDate();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/temporal/CurrentTime.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.temporal;\n\nimport java.sql.Time;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\n\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\n\npublic class CurrentTime<P> implements QuerySelection<P, Time>\n{\n\n    @Override\n    public <R> Selection<Time> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.currentTime();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/temporal/CurrentTimestamp.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria.selection.temporal;\n\nimport java.sql.Timestamp;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.Path;\nimport jakarta.persistence.criteria.Selection;\n\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\n\npublic class CurrentTimestamp<P> implements QuerySelection<P, Timestamp>\n{\n\n    @Override\n    public <R> Selection<Timestamp> toSelection(CriteriaQuery<R> query, CriteriaBuilder builder, Path<? extends P> path)\n    {\n        return builder.currentTimestamp();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/graph/EntityGraphException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.graph;\n\npublic class EntityGraphException extends RuntimeException\n{\n\n    private static final long serialVersionUID = 1L;\n\n    public EntityGraphException(String message)\n    {\n        super(message);\n    }\n\n    public EntityGraphException(String message, Throwable cause)\n    {\n        super(message, cause);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/graph/EntityGraphHelper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.graph;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.data.api.EntityGraph;\n\n/**\n * Helper for entity graphs.\n */\npublic final class EntityGraphHelper\n{\n    private EntityGraphHelper()\n    {\n\n    }\n    \n    public static Object getEntityGraph(EntityManager em, Class<?> entityClass, EntityGraph entityGraphAnn)\n    {\n        String graphName = entityGraphAnn.value();\n        if (graphName.isEmpty())\n        {\n            return buildEntityGraph(em, entityClass, entityGraphAnn.paths());\n        }\n        else\n        {\n            return em.getEntityGraph(graphName);\n        }\n    }\n\n    private static Object createEntityGraph(EntityManager em, Class<?> entityClass)\n    {\n        return em.createEntityGraph(entityClass);\n    }\n\n    private static Object addSubgraph(Object graph, String attributeName)\n    {\n        if (graph instanceof jakarta.persistence.EntityGraph)\n        {\n            return ((jakarta.persistence.EntityGraph) graph).addSubgraph(attributeName);\n        }\n        else if (graph instanceof jakarta.persistence.Subgraph)\n        {\n            return ((jakarta.persistence.Subgraph) graph).addSubgraph(attributeName);\n        }\n\n        return null;\n    }\n\n    private static void addAttributeNodes(Object graph, String attributeName)\n    {\n        if (graph instanceof jakarta.persistence.EntityGraph)\n        {\n            ((jakarta.persistence.EntityGraph) graph).addAttributeNodes(\n                    new String[] { attributeName });\n        }\n        else if (graph instanceof jakarta.persistence.Subgraph)\n        {\n            ((jakarta.persistence.Subgraph) graph).addAttributeNodes(\n                    new String[] { attributeName });\n        }\n    }\n\n    private static Object buildEntityGraph(EntityManager em, Class<?> entityClass,\n        String[] attributePaths)\n    {\n        Object graph = createEntityGraph(em, entityClass);\n        List<String> paths = new ArrayList<>(Arrays.asList(attributePaths));\n\n        // handle longest paths first\n        Collections.sort(paths);\n        Collections.reverse(paths);\n\n        for (String path : attributePaths)\n        {\n            if (path.contains(\".\"))\n            {\n                String[] segments = path.split(\"\\\\.\");\n                Object parent = addSubgraph(graph, segments[0]);\n\n                for (int i = 1; i < segments.length - 1; i++)\n                {\n                    addSubgraph(parent, segments[i]);\n                }\n\n                addAttributeNodes(parent, segments[segments.length - 1]);\n            }\n            else\n            {\n                addAttributeNodes(graph, path);\n            }\n        }\n        return graph;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/AbstractDelegateQueryHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.data.spi.DelegateQueryHandler;\n\npublic abstract class AbstractDelegateQueryHandler<E> implements DelegateQueryHandler\n{\n\n    @Inject\n    protected CdiQueryInvocationContext context;\n\n    @SuppressWarnings(\"unchecked\")\n    protected Class<E> getEntityClass()\n    {\n        return (Class<E>) context.getEntityClass();\n    }\n\n    protected EntityManager getEntityManager()\n    {\n        return context.getEntityManager();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Produces;\nimport java.util.Stack;\n\n@ApplicationScoped\npublic class CdiQueryContextHolder\n{\n\n    private final ThreadLocal<Stack<CdiQueryInvocationContext>> contextStack =\n            new ThreadLocal<Stack<CdiQueryInvocationContext>>();\n\n    public void set(CdiQueryInvocationContext context)\n    {\n        if (contextStack.get() == null)\n        {\n            contextStack.set(new Stack<CdiQueryInvocationContext>());\n        }\n        contextStack.get().push(context);\n    }\n\n    @Produces\n    public CdiQueryInvocationContext get()\n    {\n        if (contextStack.get() != null && !contextStack.get().isEmpty())\n        {\n            return contextStack.get().peek();\n        }\n        return null;\n    }\n\n    public void dispose()\n    {\n        if (contextStack.get() != null && !contextStack.get().isEmpty())\n        {\n            CdiQueryInvocationContext ctx = contextStack.get().pop();\n            ctx.cleanup();\n        }\n        if (contextStack.get() != null && contextStack.get().isEmpty())\n        {\n            contextStack.remove();\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryInvocationContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport java.io.Serializable;\nimport java.lang.reflect.Method;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.Query;\nimport jakarta.persistence.QueryHint;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\n\nimport org.apache.deltaspike.data.api.EntityGraph;\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\nimport org.apache.deltaspike.data.impl.graph.EntityGraphHelper;\nimport org.apache.deltaspike.data.impl.meta.EntityMetadata;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata;\nimport org.apache.deltaspike.data.impl.param.Parameters;\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.apache.deltaspike.data.impl.util.EntityUtils;\nimport org.apache.deltaspike.data.impl.util.bean.DependentProviderDestroyable;\nimport org.apache.deltaspike.data.impl.util.bean.Destroyable;\nimport org.apache.deltaspike.data.spi.QueryInvocationContext;\n\npublic class CdiQueryInvocationContext implements QueryInvocationContext\n{\n\n    private final EntityManager entityManager;\n    private final Parameters params;\n    private final Object proxy;\n    private final Method method;\n    private final Object[] args;\n    \n    private final RepositoryMetadata repositoryMetadata;\n    private final RepositoryMethodMetadata repositoryMethodMetadata;\n    \n    private final List<QueryStringPostProcessor> queryPostProcessors;\n    private final List<JpaQueryPostProcessor> jpaPostProcessors;\n    private final List<Destroyable> cleanup;\n\n    private String queryString;\n\n    public CdiQueryInvocationContext(Object proxy, Method method, Object[] args,\n            RepositoryMetadata repositoryMetadata,\n            RepositoryMethodMetadata repositoryMethodMetadata, EntityManager entityManager)\n    {\n        this.proxy = proxy;\n        this.method = method;\n        this.args = args == null ? new Object[]{} : args;\n        this.repositoryMetadata = repositoryMetadata;\n        this.repositoryMethodMetadata = repositoryMethodMetadata;\n        this.entityManager = entityManager;\n        \n        this.params = Parameters.create(method, this.args, repositoryMethodMetadata);\n        this.queryPostProcessors = new LinkedList<QueryStringPostProcessor>();\n        this.jpaPostProcessors = new LinkedList<JpaQueryPostProcessor>();\n        this.cleanup = new LinkedList<Destroyable>();\n    }\n\n    public void init()\n    {\n        if (hasQueryInOutMapper())\n        {\n            QueryInOutMapper<?> mapper = getQueryInOutMapper();\n            params.applyMapper(mapper);\n            for (int i = 0; i < args.length; i++)\n            {\n                if (mapper.mapsParameter(args[i]))\n                {\n                    args[i] = mapper.mapParameter(args[i]);\n                }\n            }\n        }\n    }\n\n    @Override\n    public EntityManager getEntityManager()\n    {\n        return entityManager;\n    }\n\n    @Override\n    public boolean isNew(Object entity)\n    {\n        try\n        {\n            Property<Serializable> versionProperty = repositoryMetadata.getEntityMetadata().getVersionProperty();\n            if (versionProperty != null)\n            {\n                return versionProperty.getValue(entity) == null;\n            }\n\n            Property<Serializable> primaryKeyProperty = repositoryMetadata.getEntityMetadata().getPrimaryKeyProperty();\n            if (EntityUtils.primaryKeyValue(entity, primaryKeyProperty) == null)\n            {\n                return true;\n            }\n\n            if (!entityManager.contains(entity) && countCheck(entity, primaryKeyProperty))\n            {\n                return true;\n            }\n\n            return false;\n        }\n        catch (IllegalArgumentException e)\n        {\n            // Not an entity\n            return false;\n        }\n    }\n\n    @Override\n    public Class<?> getEntityClass()\n    {\n        return repositoryMetadata.getEntityMetadata().getEntityClass();\n    }\n\n    @Override\n    public Class<?> getRepositoryClass()\n    {\n        return repositoryMetadata.getRepositoryClass();\n    }\n\n    public Object proceed() throws Exception\n    {\n        return method.invoke(proxy, args);\n    }\n\n    @Override\n    public Method getMethod()\n    {\n        return method;\n    }\n\n    public Query applyRestrictions(Query query)\n    {\n        Parameters params = getParams();\n        Method method = getMethod();\n        \n        if (params.hasSizeRestriction())\n        {\n            query.setMaxResults(params.getSizeRestriciton());\n        }\n        \n        if (params.hasFirstResult())\n        {\n            query.setFirstResult(params.getFirstResult());\n        }\n        \n        LockModeType lockMode = extractLockMode();\n        if (lockMode != null)\n        {\n            query.setLockMode(lockMode);\n        }\n        \n        QueryHint[] hints = extractQueryHints();\n        if (hints != null)\n        {\n            for (QueryHint hint : hints)\n            {\n                query.setHint(hint.name(), hint.value());\n            }\n        }\n\n        applyEntityGraph(query, method);\n        query = applyJpaQueryPostProcessors(query);\n        return query;\n    }\n\n    public Object[] getMethodParameters()\n    {\n        return args;\n    }\n\n    public void addQueryStringPostProcessor(QueryStringPostProcessor postProcessor)\n    {\n        queryPostProcessors.add(postProcessor);\n    }\n\n    public void addJpaQueryPostProcessor(JpaQueryPostProcessor postProcessor)\n    {\n        jpaPostProcessors.add(postProcessor);\n    }\n\n    public void removeJpaQueryPostProcessor(JpaQueryPostProcessor postProcessor)\n    {\n        jpaPostProcessors.remove(postProcessor);\n    }\n\n    public boolean hasQueryStringPostProcessors()\n    {\n        return !queryPostProcessors.isEmpty();\n    }\n\n    public String applyQueryStringPostProcessors(String queryString)\n    {\n        String result = queryString;\n        for (QueryStringPostProcessor processor : queryPostProcessors)\n        {\n            result = processor.postProcess(result);\n        }\n        return result;\n    }\n\n    public Query applyJpaQueryPostProcessors(Query query)\n    {\n        Query result = query;\n        for (JpaQueryPostProcessor processor : jpaPostProcessors)\n        {\n            result = processor.postProcess(this, result);\n        }\n        return result;\n    }\n\n    public void addDestroyable(Destroyable destroyable)\n    {\n        cleanup.add(destroyable);\n    }\n\n    public void cleanup()\n    {\n        for (Destroyable destroy : cleanup)\n        {\n            destroy.destroy();\n        }\n        cleanup.clear();\n    }\n\n    public Object executeQuery(Query jpaQuery)\n    {\n        return repositoryMethodMetadata.getQueryProcessor().executeQuery(jpaQuery, this);\n    }\n\n    public Parameters getParams()\n    {\n        return params;\n    }\n\n    public String getQueryString()\n    {\n        return queryString;\n    }\n\n    public void setQueryString(String queryString)\n    {\n        this.queryString = queryString;\n    }\n\n    public List<QueryStringPostProcessor> getQueryStringPostProcessors()\n    {\n        return queryPostProcessors;\n    }\n\n    public boolean hasQueryInOutMapper()\n    {\n        return repositoryMethodMetadata.getQueryInOutMapperClass() != null;\n    }\n\n    public QueryInOutMapper<?> getQueryInOutMapper()\n    {\n        if (repositoryMethodMetadata.getQueryInOutMapperClass() == null)\n        {\n            return null;\n        }\n\n        QueryInOutMapper<?> result = null;\n        if (repositoryMethodMetadata.isQueryInOutMapperIsNormalScope())\n        {\n            result = BeanProvider.getContextualReference(repositoryMethodMetadata.getQueryInOutMapperClass());\n        }\n        else\n        {\n            DependentProvider<? extends QueryInOutMapper<?>> mappedProvider =\n                    BeanProvider.getDependent(repositoryMethodMetadata.getQueryInOutMapperClass());\n            \n            result = mappedProvider.get();\n            \n            this.addDestroyable(new DependentProviderDestroyable(mappedProvider));\n        }\n        \n        return result;\n    }\n\n    public Object getProxy()\n    {\n        return proxy;\n    }\n\n    private LockModeType extractLockMode()\n    {\n        org.apache.deltaspike.data.api.Query query = getRepositoryMethodMetadata().getQuery();\n        if (query != null && query.lock() != LockModeType.NONE)\n        {\n            return query.lock();\n        }\n\n        return null;\n    }\n\n    private QueryHint[] extractQueryHints()\n    {\n        org.apache.deltaspike.data.api.Query query = getRepositoryMethodMetadata().getQuery();        \n        if (query != null && query.hints().length > 0)\n        {\n            return query.hints();\n        }\n\n        return null;\n    }\n\n    private void applyEntityGraph(Query query, Method method)\n    {\n        EntityGraph entityGraphAnn = method.getAnnotation(EntityGraph.class);\n        if (entityGraphAnn == null)\n        {\n            return;\n        }\n        \n        Object graph = EntityGraphHelper.getEntityGraph(getEntityManager(),\n                repositoryMetadata.getEntityMetadata().getEntityClass(),\n                entityGraphAnn);\n        query.setHint(entityGraphAnn.type().getHintName(), graph);\n    }\n\n    private boolean countCheck(Object entity, Property<Serializable> primaryKeyProperty)\n    {\n        StringBuilder jpql = new StringBuilder(\"SELECT COUNT(e) FROM \" + getEntityMetadata()\n                .getEntityName() + \" e \");\n        jpql.append(\"WHERE e.\");\n        jpql.append(primaryKeyProperty.getName());\n        jpql.append(\" = :id\");\n\n        final Query query = entityManager.createQuery(jpql.toString());\n        query.setParameter(\"id\", EntityUtils.primaryKeyValue(entity, primaryKeyProperty));\n        final Long result = (Long) query.getSingleResult();\n        if (Long.valueOf(0).equals(result))\n        {\n            return true;\n        }\n        return false;\n    }\n\n    public RepositoryMetadata getRepositoryMetadata()\n    {\n        return repositoryMetadata;\n    }\n\n    public EntityMetadata getEntityMetadata()\n    {\n        return repositoryMetadata.getEntityMetadata();\n    }\n    \n    public RepositoryMethodMetadata getRepositoryMethodMetadata()\n    {\n        return repositoryMethodMetadata;\n    } \n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CriteriaSupportHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport java.sql.Date;\nimport java.sql.Time;\nimport java.sql.Timestamp;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.JoinType;\nimport jakarta.persistence.metamodel.SingularAttribute;\n\nimport org.apache.deltaspike.data.api.criteria.Criteria;\nimport org.apache.deltaspike.data.api.criteria.CriteriaSupport;\nimport org.apache.deltaspike.data.api.criteria.QuerySelection;\nimport org.apache.deltaspike.data.impl.criteria.QueryCriteria;\nimport org.apache.deltaspike.data.impl.criteria.selection.AttributeQuerySelection;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Abs;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Avg;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Count;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.CountDistinct;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Max;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Min;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Modulo;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Neg;\nimport org.apache.deltaspike.data.impl.criteria.selection.numeric.Sum;\nimport org.apache.deltaspike.data.impl.criteria.selection.strings.Lower;\nimport org.apache.deltaspike.data.impl.criteria.selection.strings.SubstringFrom;\nimport org.apache.deltaspike.data.impl.criteria.selection.strings.SubstringFromTo;\nimport org.apache.deltaspike.data.impl.criteria.selection.strings.Trim;\nimport org.apache.deltaspike.data.impl.criteria.selection.strings.Upper;\nimport org.apache.deltaspike.data.impl.criteria.selection.temporal.CurrentDate;\nimport org.apache.deltaspike.data.impl.criteria.selection.temporal.CurrentTime;\nimport org.apache.deltaspike.data.impl.criteria.selection.temporal.CurrentTimestamp;\n\n@Dependent\npublic class CriteriaSupportHandler<E> extends AbstractDelegateQueryHandler<E> implements CriteriaSupport<E>\n{\n\n    @Override\n    public Criteria<E, E> criteria()\n    {\n        return new QueryCriteria<E, E>(getEntityClass(), getEntityClass(), getEntityManager());\n    }\n\n    @Override\n    public <T> Criteria<T, T> where(Class<T> clazz)\n    {\n        return new QueryCriteria<T, T>(clazz, clazz, getEntityManager());\n    }\n\n    @Override\n    public <T> Criteria<T, T> where(Class<T> clazz, JoinType joinType)\n    {\n        return new QueryCriteria<T, T>(clazz, clazz, getEntityManager(), joinType);\n    }\n\n    @Override\n    public <X> QuerySelection<E, X> attribute(SingularAttribute<? super E, X> attribute)\n    {\n        return new AttributeQuerySelection<E, X>(attribute);\n    }\n\n    // ----------------------------------------------------------------------------\n    // NUMERIC QUERY SELECTION\n    // ----------------------------------------------------------------------------\n\n    @Override\n    public <N extends Number> QuerySelection<E, N> abs(SingularAttribute<? super E, N> attribute)\n    {\n        return new Abs<E, N>(attribute);\n    }\n\n    @Override\n    public <N extends Number> QuerySelection<E, N> avg(SingularAttribute<? super E, N> attribute)\n    {\n        return new Avg<E, N>(attribute);\n    }\n\n    @Override\n    public QuerySelection<E, Long> count(SingularAttribute<? super E, ?> attribute)\n    {\n        return new Count<E>(attribute);\n    }\n\n    @Override\n    public QuerySelection<E, Long> countDistinct(SingularAttribute<? super E, ?> attribute)\n    {\n        return new CountDistinct<E>(attribute);\n    }\n\n    @Override\n    public <N extends Number> QuerySelection<E, N> max(SingularAttribute<? super E, N> attribute)\n    {\n        return new Max<E, N>(attribute);\n    }\n\n    @Override\n    public <N extends Number> QuerySelection<E, N> min(SingularAttribute<? super E, N> attribute)\n    {\n        return new Min<E, N>(attribute);\n    }\n\n    @Override\n    public <N extends Number> QuerySelection<E, N> neg(SingularAttribute<? super E, N> attribute)\n    {\n        return new Neg<E, N>(attribute);\n    }\n\n    @Override\n    public <N extends Number> QuerySelection<E, N> sum(SingularAttribute<? super E, N> attribute)\n    {\n        return new Sum<E, N>(attribute);\n    }\n\n    @Override\n    public QuerySelection<E, Integer> modulo(SingularAttribute<? super E, Integer> attribute, Integer modulo)\n    {\n        return new Modulo<E>(attribute, modulo);\n    }\n\n    // ----------------------------------------------------------------------------\n    // STRING QUERY SELECTION\n    // ----------------------------------------------------------------------------\n\n    @Override\n    public QuerySelection<E, String> upper(SingularAttribute<? super E, String> attribute)\n    {\n        return new Upper<E>(attribute);\n    }\n\n    @Override\n    public QuerySelection<E, String> lower(SingularAttribute<? super E, String> attribute)\n    {\n        return new Lower<E>(attribute);\n    }\n\n    @Override\n    public QuerySelection<E, String> substring(SingularAttribute<? super E, String> attribute, int from)\n    {\n        return new SubstringFrom<E>(attribute, from);\n    }\n\n    @Override\n    public QuerySelection<E, String> substring(SingularAttribute<? super E, String> attribute, int from, int length)\n    {\n        return new SubstringFromTo<E>(attribute, from, length);\n    }\n\n    @Override\n    public QuerySelection<E, String> trim(SingularAttribute<? super E, String> attribute)\n    {\n        return new Trim<E>(attribute);\n    }\n\n    @Override\n    public QuerySelection<E, String> trim(CriteriaBuilder.Trimspec trimspec,\n                                          SingularAttribute<? super E, String> attribute)\n    {\n        return new Trim<E>(trimspec, attribute);\n    }\n\n    // ----------------------------------------------------------------------------\n    // TEMPORAL QUERY SELECTION\n    // ----------------------------------------------------------------------------\n\n    @Override\n    public QuerySelection<E, Date> currDate()\n    {\n        return new CurrentDate<E>();\n    }\n\n    @Override\n    public QuerySelection<E, Time> currTime()\n    {\n        return new CurrentTime<E>();\n    }\n\n    @Override\n    public QuerySelection<E, Timestamp> currTStamp()\n    {\n        return new CurrentTimestamp<E>();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerDelegateHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport java.util.Map;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.EntityTransaction;\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.metamodel.Metamodel;\n\nimport org.apache.deltaspike.data.api.EntityManagerDelegate;\nimport org.apache.deltaspike.data.spi.DelegateQueryHandler;\nimport org.apache.deltaspike.data.spi.QueryInvocationContext;\n\n@SuppressWarnings(\"unchecked\")\n@Dependent\npublic class EntityManagerDelegateHandler<E> implements EntityManagerDelegate<E>, DelegateQueryHandler\n{\n\n    @Inject\n    private QueryInvocationContext context;\n\n    @Override\n    public void persist(E entity)\n    {\n        entityManager().persist(entity);\n    }\n\n    @Override\n    public E merge(E entity)\n    {\n        return entityManager().merge(entity);\n    }\n\n    @Override\n    public E find(Object primaryKey, Map<String, Object> properties)\n    {\n        return (E) entityManager().find(context.getEntityClass(), primaryKey, properties);\n    }\n\n    @Override\n    public E find(Object primaryKey, LockModeType lockMode)\n    {\n        return (E) entityManager().find(context.getEntityClass(), primaryKey, lockMode);\n    }\n\n    @Override\n    public E find(Object primaryKey, LockModeType lockMode, Map<String, Object> properties)\n    {\n        return (E) entityManager().find(context.getEntityClass(), primaryKey, lockMode, properties);\n    }\n\n    @Override\n    public E getReference(Object primaryKey)\n    {\n        return (E) entityManager().getReference(context.getEntityClass(), primaryKey);\n    }\n\n    @Override\n    public void setFlushMode(FlushModeType flushMode)\n    {\n        entityManager().setFlushMode(flushMode);\n    }\n\n    @Override\n    public FlushModeType getFlushMode()\n    {\n        return entityManager().getFlushMode();\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode)\n    {\n        entityManager().lock(entity, lockMode);\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode, Map<String, Object> properties)\n    {\n        entityManager().lock(entity, lockMode, properties);\n    }\n\n    @Override\n    public void refresh(E entity, Map<String, Object> properties)\n    {\n        entityManager().refresh(entity, properties);\n    }\n\n    @Override\n    public void refresh(E entity, LockModeType lockMode)\n    {\n        entityManager().refresh(entity, lockMode);\n    }\n\n    @Override\n    public void refresh(E entity, LockModeType lockMode, Map<String, Object> properties)\n    {\n        entityManager().refresh(entity, lockMode, properties);\n    }\n\n    @Override\n    public void clear()\n    {\n        entityManager().clear();\n    }\n\n    @Override\n    public void detach(E entity)\n    {\n        entityManager().detach(entity);\n    }\n\n    @Override\n    public boolean contains(E entity)\n    {\n        return entityManager().contains(entity);\n    }\n\n    @Override\n    public LockModeType getLockMode(E entity)\n    {\n        return entityManager().getLockMode(entity);\n    }\n\n    @Override\n    public void setProperty(String propertyName, Object value)\n    {\n        entityManager().setProperty(propertyName, value);\n    }\n\n    @Override\n    public Map<String, Object> getProperties()\n    {\n        return entityManager().getProperties();\n    }\n\n    @Override\n    public void joinTransaction()\n    {\n        entityManager().joinTransaction();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls)\n    {\n        return entityManager().unwrap(cls);\n    }\n\n    @Override\n    public Object getDelegate()\n    {\n        return entityManager().getDelegate();\n    }\n\n    @Override\n    public void close()\n    {\n        entityManager().close();\n    }\n\n    @Override\n    public boolean isOpen()\n    {\n        return entityManager().isOpen();\n    }\n\n    @Override\n    public EntityTransaction getTransaction()\n    {\n        return entityManager().getTransaction();\n    }\n\n    @Override\n    public EntityManagerFactory getEntityManagerFactory()\n    {\n        return entityManager().getEntityManagerFactory();\n    }\n\n    @Override\n    public CriteriaBuilder getCriteriaBuilder()\n    {\n        return entityManager().getCriteriaBuilder();\n    }\n\n    @Override\n    public Metamodel getMetamodel()\n    {\n        return entityManager().getMetamodel();\n    }\n\n    private EntityManager entityManager()\n    {\n        return context.getEntityManager();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityRepositoryHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport org.apache.deltaspike.data.api.EntityRepository;\r\nimport org.apache.deltaspike.data.api.Query;\r\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\r\nimport org.apache.deltaspike.data.impl.meta.RequiresTransaction;\r\nimport org.apache.deltaspike.data.impl.property.Property;\r\nimport org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria;\r\nimport org.apache.deltaspike.data.impl.property.query.PropertyQueries;\r\nimport org.apache.deltaspike.data.impl.util.EntityUtils;\r\nimport org.apache.deltaspike.data.impl.util.jpa.PersistenceUnitUtilDelegateFactory;\r\nimport org.apache.deltaspike.data.spi.DelegateQueryHandler;\r\n\r\nimport jakarta.enterprise.context.Dependent;\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.persistence.PersistenceUnitUtil;\r\nimport jakarta.persistence.QueryHint;\r\nimport jakarta.persistence.TypedQuery;\r\nimport jakarta.persistence.criteria.CriteriaQuery;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.Optional;\r\nimport java.util.logging.Level;\r\nimport java.util.logging.Logger;\r\n\r\nimport static org.apache.deltaspike.core.util.ArraysUtils.isEmpty;\r\nimport static org.apache.deltaspike.data.impl.util.QueryUtils.isString;\r\n\r\n/**\r\n * Implement basic functionality from the {@link EntityRepository}.\r\n *\r\n * @param <E>  Entity type.\r\n * @param <PK> Primary key type, must be a serializable.\r\n */\r\n@Dependent\r\npublic class EntityRepositoryHandler<E, PK extends Serializable>\r\n        implements EntityRepository<E, PK>, DelegateQueryHandler\r\n{\r\n\r\n    private static final Logger log = Logger.getLogger(EntityRepositoryHandler.class.getName());\r\n\r\n    @Inject\r\n    private CdiQueryInvocationContext context;\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public E save(E entity)\r\n    {\r\n        if (context.isNew(entity))\r\n        {\r\n            entityManager().persist(entity);\r\n            return entity;\r\n        }\r\n        return entityManager().merge(entity);\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public E saveAndFlush(E entity)\r\n    {\r\n        E result = save(entity);\r\n        flush();\r\n        return result;\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public E saveAndFlushAndRefresh(E entity)\r\n    {\r\n        E result = saveAndFlush(entity);\r\n        entityManager().refresh(result);\r\n        return result;\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public void refresh(E entity)\r\n    {\r\n        entityManager().refresh(entity);\r\n    }\r\n\r\n    @Override\r\n    public E findBy(PK primaryKey)\r\n    {\r\n        Query query = context.getMethod().getAnnotation(Query.class);\r\n        if (query != null && query.hints().length > 0)\r\n        {\r\n            Map<String, Object> hints = new HashMap<String, Object>();\r\n            for (QueryHint hint : query.hints())\r\n            {\r\n                hints.put(hint.name(), hint.value());\r\n            }\r\n            return entityManager().find(entityClass(), primaryKey, hints);\r\n        }\r\n        else\r\n        {\r\n            return entityManager().find(entityClass(), primaryKey);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public Optional<E> findOptionalBy(PK primaryKey)\r\n    {\r\n        E found = null;\r\n        try\r\n        {\r\n            found = findBy(primaryKey);\r\n        }\r\n        catch (Exception e)\r\n        {\r\n        }\r\n        return Optional.ofNullable(found);\r\n    }\r\n\r\n    @Override\r\n    public List<E> findBy(E example, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        return findBy(example, -1, -1, attributes);\r\n    }\r\n\r\n    @Override\r\n    public List<E> findBy(E example, int start, int max, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        return executeExampleQuery(example, start, max, false, attributes);\r\n    }\r\n\r\n    @Override\r\n    public List<E> findByLike(E example, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        return findByLike(example, -1, -1, attributes);\r\n    }\r\n\r\n    @Override\r\n    public List<E> findByLike(E example, int start, int max, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        return executeExampleQuery(example, start, max, true, attributes);\r\n    }\r\n\r\n    @SuppressWarnings(\"unchecked\")\r\n    @Override\r\n    public List<E> findAll()\r\n    {\r\n        return context.applyRestrictions(entityManager().createQuery(allQuery(), entityClass())).getResultList();\r\n    }\r\n\r\n    @SuppressWarnings(\"unchecked\")\r\n    @Override\r\n    public List<E> findAll(int start, int max)\r\n    {\r\n        TypedQuery<E> query = entityManager().createQuery(allQuery(), entityClass());\r\n        if (start > 0)\r\n        {\r\n            query.setFirstResult(start);\r\n        }\r\n        if (max > 0)\r\n        {\r\n            query.setMaxResults(max);\r\n        }\r\n        return context.applyRestrictions(query).getResultList();\r\n    }\r\n\r\n    @Override\r\n    public Long count()\r\n    {\r\n        return (Long) context.applyRestrictions(entityManager().createQuery(countQuery(), Long.class))\r\n                .getSingleResult();\r\n    }\r\n\r\n    @Override\r\n    public Long count(E example, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        return executeCountQuery(example, false, attributes);\r\n    }\r\n\r\n    @Override\r\n    public Long countLike(E example, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        return executeCountQuery(example, true, attributes);\r\n    }\r\n\r\n    @SuppressWarnings(\"unchecked\")\r\n    @Override\r\n    public PK getPrimaryKey(E entity)\r\n    {\r\n        return (PK) persistenceUnitUtil().getIdentifier(entity);\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public void remove(E entity)\r\n    {\r\n        entityManager().remove(entity);\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public void removeAndFlush(E entity)\r\n    {\r\n        entityManager().remove(entity);\r\n        flush();\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public void attachAndRemove(E entity)\r\n    {\r\n        if (!entityManager().contains(entity))\r\n        {\r\n            entity = entityManager().merge(entity);\r\n        }\r\n        remove(entity);\r\n    }\r\n\r\n    @Override\r\n    @RequiresTransaction\r\n    public void flush()\r\n    {\r\n        entityManager().flush();\r\n    }\r\n\r\n    public EntityManager entityManager()\r\n    {\r\n        return context.getEntityManager();\r\n    }\r\n\r\n    public CriteriaQuery<E> criteriaQuery()\r\n    {\r\n        return entityManager().getCriteriaBuilder().createQuery(entityClass());\r\n    }\r\n\r\n    public TypedQuery<E> typedQuery(String qlString)\r\n    {\r\n        return entityManager().createQuery(qlString, entityClass());\r\n    }\r\n\r\n    @SuppressWarnings(\"unchecked\")\r\n    public Class<E> entityClass()\r\n    {\r\n        return (Class<E>) context.getEntityClass();\r\n    }\r\n\r\n    public String tableName()\r\n    {\r\n        return EntityUtils.tableName(context.getEntityClass(), entityManager());\r\n    }\r\n\r\n    public String entityName()\r\n    {\r\n        return context.getEntityMetadata().getEntityName();\r\n    }\r\n\r\n    // ----------------------------------------------------------------------------\r\n    // PRIVATE\r\n    // ----------------------------------------------------------------------------\r\n\r\n    private String allQuery()\r\n    {\r\n        return QueryBuilder.selectQuery(entityName());\r\n    }\r\n\r\n    private String countQuery()\r\n    {\r\n        return QueryBuilder.countQuery(entityName());\r\n    }\r\n\r\n    private String exampleQuery(String queryBase, List<Property<Object>> properties, boolean useLikeOperator)\r\n    {\r\n        StringBuilder jpqlQuery = new StringBuilder(queryBase).append(\" where \");\r\n        jpqlQuery.append(prepareWhere(properties, useLikeOperator));\r\n        return jpqlQuery.toString();\r\n    }\r\n\r\n    private void addParameters(TypedQuery<?> query, E example, List<Property<Object>> properties,\r\n                               boolean useLikeOperator)\r\n    {\r\n        for (Property<Object> property : properties)\r\n        {\r\n            property.setAccessible();\r\n            query.setParameter(property.getName(), transform(property.getValue(example), useLikeOperator));\r\n        }\r\n    }\r\n\r\n    private Object transform(Object value, final boolean useLikeOperator)\r\n    {\r\n        if (value != null && useLikeOperator && isString(value))\r\n        {\r\n            // seems to be an OpenJPA bug:\r\n            // parameters in querys fail validation, e.g. UPPER(e.name) like UPPER(:name)\r\n            String result = ((String) value).toUpperCase();\r\n            return \"%\" + result + \"%\";\r\n        }\r\n        return value;\r\n    }\r\n\r\n    private String prepareWhere(List<Property<Object>> properties, boolean useLikeOperator)\r\n    {\r\n        Iterator<Property<Object>> iterator = properties.iterator();\r\n        StringBuilder result = new StringBuilder();\r\n        while (iterator.hasNext())\r\n        {\r\n            Property<Object> property = iterator.next();\r\n            String name = property.getName();\r\n            if (useLikeOperator && property.getJavaClass().getName().equals(String.class.getName()))\r\n            {\r\n                result.append(\"UPPER(e.\").append(name).append(\") like :\").append(name)\r\n                        .append(iterator.hasNext() ? \" and \" : \"\");\r\n            }\r\n            else\r\n            {\r\n                result.append(\"e.\").append(name).append(\" = :\").append(name).append(iterator.hasNext() ? \" and \" : \"\");\r\n            }\r\n        }\r\n        return result.toString();\r\n    }\r\n\r\n    private List<String> extractPropertyNames(SingularAttribute<E, ?>... attributes)\r\n    {\r\n        List<String> result = new ArrayList<String>(attributes.length);\r\n        for (SingularAttribute<E, ?> attribute : attributes)\r\n        {\r\n            result.add(attribute.getName());\r\n        }\r\n        return result;\r\n    }\r\n\r\n    private List<Property<Object>> extractProperties(SingularAttribute<E, ?>... attributes)\r\n    {\r\n        List<String> names = extractPropertyNames(attributes);\r\n        List<Property<Object>> properties = PropertyQueries.createQuery(entityClass())\r\n                .addCriteria(new NamedPropertyCriteria(names.toArray(new String[]{}))).getResultList();\r\n        return properties;\r\n    }\r\n\r\n    private List<E> executeExampleQuery(E example, int start, int max, boolean useLikeOperator,\r\n                                        SingularAttribute<E, ?>... attributes)\r\n    {\r\n        // Not sure if this should be the intended behaviour\r\n        // when we don't get any attributes maybe we should\r\n        // return a empty list instead of all results\r\n        if (isEmpty(attributes))\r\n        {\r\n            return findAll(start, max);\r\n        }\r\n\r\n        List<Property<Object>> properties = extractProperties(attributes);\r\n        String jpqlQuery = exampleQuery(allQuery(), properties, useLikeOperator);\r\n        log.log(Level.FINER, \"findBy|findByLike: Created query {0}\", jpqlQuery);\r\n        TypedQuery<E> query = entityManager().createQuery(jpqlQuery, entityClass());\r\n\r\n        // set starting position\r\n        if (start > 0)\r\n        {\r\n            query.setFirstResult(start);\r\n        }\r\n\r\n        // set maximum results\r\n        if (max > 0)\r\n        {\r\n            query.setMaxResults(max);\r\n        }\r\n\r\n        context.applyRestrictions(query);\r\n        addParameters(query, example, properties, useLikeOperator);\r\n        return query.getResultList();\r\n    }\r\n\r\n    private Long executeCountQuery(E example, boolean useLikeOperator, SingularAttribute<E, ?>... attributes)\r\n    {\r\n        if (isEmpty(attributes))\r\n        {\r\n            return count();\r\n        }\r\n        List<Property<Object>> properties = extractProperties(attributes);\r\n        String jpqlQuery = exampleQuery(countQuery(), properties, useLikeOperator);\r\n        log.log(Level.FINER, \"count: Created query {0}\", jpqlQuery);\r\n        TypedQuery<Long> query = entityManager().createQuery(jpqlQuery, Long.class);\r\n        addParameters(query, example, properties, useLikeOperator);\r\n        context.applyRestrictions(query);\r\n        return query.getSingleResult();\r\n    }\r\n\r\n    private PersistenceUnitUtil persistenceUnitUtil()\r\n    {\r\n        return PersistenceUnitUtilDelegateFactory.get(entityManager());\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/JpaQueryPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport jakarta.persistence.Query;\n\npublic interface JpaQueryPostProcessor\n{\n\n    Query postProcess(CdiQueryInvocationContext context, Query query);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.core.util.ExceptionUtils;\r\nimport org.apache.deltaspike.core.util.ProxyUtils;\r\nimport org.apache.deltaspike.core.util.interceptor.AbstractInvocationContext;\r\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\r\nimport org.apache.deltaspike.data.api.QueryInvocationException;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\r\nimport org.apache.deltaspike.data.impl.builder.QueryBuilderFactory;\r\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadataHandler;\r\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\r\nimport org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerRef;\r\nimport org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerRefLookup;\r\nimport org.apache.deltaspike.jpa.spi.entitymanager.ActiveEntityManagerHolder;\r\nimport org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy;\r\n\r\nimport jakarta.enterprise.inject.Any;\r\nimport jakarta.enterprise.inject.spi.BeanManager;\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.persistence.PersistenceException;\r\nimport java.io.Serializable;\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\nimport java.util.List;\r\nimport java.util.logging.Level;\r\nimport java.util.logging.Logger;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\r\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata;\r\n\r\n/**\r\n * Entry point for query processing.\r\n */\r\n@Repository\r\n@ApplicationScoped\r\npublic class QueryHandler implements Serializable, InvocationHandler\r\n{\r\n    private static final Logger log = Logger.getLogger(QueryHandler.class.getName());\r\n\r\n    @Inject\r\n    private QueryBuilderFactory queryBuilderFactory;\r\n\r\n    @Inject\r\n    private RepositoryMetadataHandler metadataHandler;\r\n\r\n    @Inject\r\n    private CdiQueryContextHolder context;\r\n\r\n    @Inject\r\n    private EntityManagerRefLookup entityManagerRefLookup;\r\n\r\n    @Inject\r\n    private QueryRunner runner;\r\n\r\n    @Inject\r\n    private BeanManager beanManager;\r\n\r\n    @Inject\r\n    private TransactionStrategy transactionStrategy;\r\n\r\n    @Inject\r\n    private ActiveEntityManagerHolder activeEntityManagerHolder;\r\n\r\n    @Override\r\n    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable\r\n    {\r\n        List<Class<?>> candidates = ProxyUtils.getProxyAndBaseTypes(proxy.getClass());\r\n        final RepositoryMetadata repositoryMetadata =\r\n                metadataHandler.lookupMetadata(candidates);\r\n        final RepositoryMethodMetadata repositoryMethodMetadata =\r\n                metadataHandler.lookupMethodMetadata(repositoryMetadata, method);\r\n\r\n        if (repositoryMethodMetadata.getTransactional() != null)\r\n        {\r\n            if (repositoryMethodMetadata.getTransactional().qualifier().length > 1)\r\n            {\r\n                throw new IllegalStateException(proxy.getClass().getName() + \" uses @\" + Transactional.class.getName() +\r\n                    \" with multiple qualifiers. That isn't supported with @\" + Repository.class.getName());\r\n            }\r\n\r\n            Class<? extends Annotation> qualifier = repositoryMethodMetadata.getTransactional().qualifier()[0];\r\n            if (!Any.class.equals(qualifier))\r\n            {\r\n                EntityManager entityManager = BeanProvider.getContextualReference(\r\n                    EntityManager.class, false, AnnotationInstanceProvider.of(qualifier));\r\n                activeEntityManagerHolder.set(entityManager);\r\n            }\r\n\r\n            return transactionStrategy.execute(\r\n                new AbstractInvocationContext<>(proxy, method, args, null)\r\n                {\r\n                    @Override\r\n                    public Object proceed() throws Exception\r\n                    {\r\n                        try\r\n                        {\r\n                            return process(proxy, method, args, repositoryMetadata, repositoryMethodMetadata);\r\n                        }\r\n                        catch (Throwable t)\r\n                        {\r\n                            throw ExceptionUtils.throwAsRuntimeException(t);\r\n                        }\r\n                    }\r\n                });\r\n        }\r\n        else\r\n        {\r\n            return process(proxy, method, args, repositoryMetadata, repositoryMethodMetadata);\r\n        }\r\n    }\r\n\r\n    protected Object process(Object proxy, Method method, Object[] args,\r\n            RepositoryMetadata repositoryMetadata, RepositoryMethodMetadata repositoryMethodMetadata) throws Throwable\r\n    {\r\n        CdiQueryInvocationContext queryContext = null;\r\n        EntityManagerRef entityManagerRef = null;\r\n        try\r\n        {\r\n            entityManagerRef = entityManagerRefLookup.lookupReference(repositoryMetadata);\r\n            EntityManager entityManager = entityManagerRef.getEntityManager();\r\n            if (entityManager == null)\r\n            {\r\n                throw new IllegalStateException(\"Unable to look up EntityManager\");\r\n            }\r\n            queryContext = createContext(proxy, method, args, entityManager,\r\n                    repositoryMetadata, repositoryMethodMetadata);\r\n            \r\n            QueryBuilder builder = queryBuilderFactory.build(repositoryMethodMetadata, queryContext);\r\n            Object result = runner.executeQuery(builder, queryContext);\r\n            return result;\r\n        }\r\n        catch (PersistenceException e)\r\n        {\r\n            throw e;\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            log.log(Level.FINEST, \"Query execution error\", e);\r\n            if (queryContext != null)\r\n            {\r\n                throw new QueryInvocationException(e, queryContext);\r\n            }\r\n            throw new QueryInvocationException(e, proxy.getClass(), method);\r\n        }\r\n        finally\r\n        {\r\n            if (entityManagerRef != null)\r\n            {\r\n                entityManagerRef.release();\r\n            }\r\n            context.dispose();\r\n        }\r\n    }\r\n\r\n    private CdiQueryInvocationContext createContext(Object proxy, Method method,\r\n            Object[] args, EntityManager entityManager, RepositoryMetadata repositoryMetadata,\r\n            RepositoryMethodMetadata repositoryMethodMetadata)\r\n    {\r\n        CdiQueryInvocationContext queryContext = new CdiQueryInvocationContext(proxy, method, args,\r\n                repositoryMetadata, repositoryMethodMetadata, entityManager);\r\n        context.set(queryContext);\r\n        queryContext.init();\r\n        return queryContext;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryRunner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\n\npublic interface QueryRunner\n{\n\n    Object executeQuery(QueryBuilder builder, CdiQueryInvocationContext context) throws Throwable;\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryStringPostProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\npublic interface QueryStringPostProcessor\n{\n\n    String postProcess(String queryString);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/EntityMetadata.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport java.io.Serializable;\nimport org.apache.deltaspike.data.impl.property.Property;\n\npublic class EntityMetadata\n{\n    private Class<?> entityClass;\n    private Property<Serializable> primaryKeyProperty;\n    private Class<? extends Serializable> primaryKeyClass;\n    private Property<Serializable> versionProperty;\n    private String entityName;\n\n    public EntityMetadata(Class<?> entityClass)\n    {\n        this.entityClass = entityClass;\n    }\n    \n    public EntityMetadata(Class<?> entityClass,\n            Class<? extends Serializable> primaryKeyClass)\n    {\n        this.entityClass = entityClass;\n        this.primaryKeyClass = primaryKeyClass;\n    }\n    \n    public EntityMetadata(Class<?> entityClass, String entityName,\n            Class<? extends Serializable> primaryKeyClass)\n    {\n        this.entityClass = entityClass;\n        this.entityName = entityName;\n        this.primaryKeyClass = primaryKeyClass;\n    }\n    \n    public Class<?> getEntityClass()\n    {\n        return entityClass;\n    }\n\n    public void setEntityClass(Class<?> entityClass)\n    {\n        this.entityClass = entityClass;\n    }\n\n    public Class<? extends Serializable> getPrimaryKeyClass()\n    {\n        return primaryKeyClass;\n    }\n\n    public void setPrimaryKeyClass(Class<? extends Serializable> primaryKeyClass)\n    {\n        this.primaryKeyClass = primaryKeyClass;\n    }\n\n    public Property<Serializable> getPrimaryKeyProperty()\n    {\n        return primaryKeyProperty;\n    }\n\n    public void setPrimaryKeyProperty(Property<Serializable> primaryKeyProperty)\n    {\n        this.primaryKeyProperty = primaryKeyProperty;\n    }\n\n    public Property<Serializable> getVersionProperty()\n    {\n        return versionProperty;\n    }\n\n    public void setVersionProperty(Property<Serializable> versionProperty)\n    {\n        this.versionProperty = versionProperty;\n    }\n\n    public String getEntityName()\n    {\n        return entityName;\n    }\n\n    public void setEntityName(String entityName)\n    {\n        this.entityName = entityName;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/EntityMetadataInitializer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.impl.util.EntityUtils;\n\nimport java.io.Serializable;\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n@ApplicationScoped\npublic class EntityMetadataInitializer\n{\n    private static final Logger LOG = Logger.getLogger(EntityMetadataInitializer.class.getName());\n    \n    public EntityMetadata init(RepositoryMetadata metadata)\n    {\n        try\n        {\n            EntityMetadata entityMetadata = extract(metadata.getRepositoryClass());\n            if (entityMetadata == null)\n            {\n                return null;\n            }\n            entityMetadata.setPrimaryKeyProperty(EntityUtils.primaryKeyProperty(entityMetadata.getEntityClass()));\n            entityMetadata.setVersionProperty(EntityUtils.getVersionProperty(entityMetadata.getEntityClass()));\n            entityMetadata.setEntityName(EntityUtils.entityName(entityMetadata.getEntityClass()));\n\n            return entityMetadata;\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Could not initialize repository metadata for: \" + metadata.getRepositoryClass(), e);\n        }\n    }\n    \n    private EntityMetadata extract(Class<?> repositoryClass)\n    {\n        // get from annotation\n        Repository repository = repositoryClass.getAnnotation(Repository.class);\n        if (repository == null)\n        {\n            return null;\n        }\n        Class<?> entityClass = repository.forEntity();\n        boolean isEntityClass = !Object.class.equals(entityClass) && EntityUtils.isEntityClass(entityClass);\n        if (isEntityClass)\n        {\n            return new EntityMetadata(entityClass, EntityUtils.primaryKeyClass(entityClass));\n        }\n        \n        // get from type\n        for (Type inf : repositoryClass.getGenericInterfaces())\n        {\n            EntityMetadata result = extractFromType(inf);\n            if (result != null)\n            {\n                return result;\n            }\n        }\n\n        EntityMetadata entityMetadata = extractFromType(repositoryClass.getGenericSuperclass());\n        if (entityMetadata != null)\n        {\n            return entityMetadata;\n        }\n\n        for (Type intf : repositoryClass.getGenericInterfaces())\n        {\n            if (intf instanceof Class<?>)\n            {\n                entityMetadata = extract((Class<?>) intf);\n                if (entityMetadata != null)\n                {\n                    return entityMetadata;\n                }\n            }\n        }\n\n        if (repositoryClass.getSuperclass() != null)\n        {\n            return extract(repositoryClass.getSuperclass());\n        }\n\n        return null;\n    }\n\n    private EntityMetadata extractFromType(Type type)\n    {\n        LOG.log(Level.FINER, \"extractFrom: type = {0}\", type);\n\n        if (!(type instanceof ParameterizedType))\n        {\n            return null;\n        }\n        \n        ParameterizedType parametrizedType = (ParameterizedType) type;\n        Type[] genericTypes = parametrizedType.getActualTypeArguments();\n        \n        EntityMetadata result = null;\n        \n        // don't use a foreach here, we must be sure that the we first get the entity type\n        for (Type genericType : genericTypes)\n        {\n            if (genericType instanceof Class && EntityUtils.isEntityClass((Class<?>) genericType))\n            {\n                result = new EntityMetadata((Class<?>) genericType);\n                continue;\n            }\n\n            if (result != null && genericType instanceof Class)\n            {\n                result.setPrimaryKeyClass((Class<? extends Serializable>) genericType);\n                return result;\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMetadata.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport java.lang.reflect.Method;\nimport java.util.Map;\nimport org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerMetadata;\n\npublic class RepositoryMetadata extends EntityManagerMetadata\n{\n    private Class<?> repositoryClass;\n\n    private EntityMetadata entityMetadata;\n    private Map<Method, RepositoryMethodMetadata> methodsMetadata;\n\n    public RepositoryMetadata(Class<?> repositoryClass)\n    {\n        this.repositoryClass = repositoryClass;\n    }\n    \n    public RepositoryMetadata(Class<?> repositoryClass, EntityMetadata entityMetadata)\n    {\n        this.repositoryClass = repositoryClass;\n        this.entityMetadata = entityMetadata;\n    }\n    \n    public Class<?> getRepositoryClass()\n    {\n        return repositoryClass;\n    }\n\n    public void setRepositoryClass(Class<?> repositoryClass)\n    {\n        this.repositoryClass = repositoryClass;\n    }\n\n    public EntityMetadata getEntityMetadata()\n    {\n        return entityMetadata;\n    }\n\n    public void setEntityMetadata(EntityMetadata entityMetadata)\n    {\n        this.entityMetadata = entityMetadata;\n    }\n\n    public Map<Method, RepositoryMethodMetadata> getMethodsMetadata()\n    {\n        return methodsMetadata;\n    }\n\n    public void setMethodsMetadata(Map<Method, RepositoryMethodMetadata> methodsMetadata)\n    {\n        this.methodsMetadata = methodsMetadata;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMetadataHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.meta;\r\n\r\nimport java.lang.reflect.Method;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.concurrent.ConcurrentHashMap;\r\nimport jakarta.annotation.PostConstruct;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\nimport jakarta.enterprise.inject.spi.BeanManager;\r\nimport jakarta.inject.Inject;\r\nimport org.apache.deltaspike.data.impl.RepositoryExtension;\r\n\r\n@ApplicationScoped\r\npublic class RepositoryMetadataHandler\r\n{\r\n    private final Map<Class<?>, RepositoryMetadata> repositoriesMetadata =\r\n            new ConcurrentHashMap<Class<?>, RepositoryMetadata>();\r\n\r\n    @Inject\r\n    private BeanManager beanManager;\r\n    @Inject\r\n    private RepositoryExtension extension;\r\n    \r\n    @Inject\r\n    private RepositoryMetadataInitializer metadataInitializer;\r\n\r\n    @PostConstruct\r\n    public void init()\r\n    {\r\n        for (Class<?> repositoryClass : extension.getRepositoryClasses())\r\n        {\r\n            RepositoryMetadata metadata = metadataInitializer.init(repositoryClass, beanManager);\r\n            // invalid\r\n            if (metadata != null)\r\n            {\r\n                repositoriesMetadata.put(repositoryClass, metadata);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Lookup the Repository component meta data from a list of candidate classes.\r\n     * Depending on the implementation, proxy objects might have been modified so the actual class\r\n     * does not match the original Repository class.\r\n     *\r\n     * @param candidateClasses List of candidates to check.\r\n     * @return A {@link RepositoryMetadataInitializer}.\r\n     */\r\n    public RepositoryMetadata lookupMetadata(List<Class<?>> candidateClasses)\r\n    {\r\n        for (Class<?> repoClass : candidateClasses)\r\n        {\r\n            if (repositoriesMetadata.containsKey(repoClass))\r\n            {\r\n                return repositoriesMetadata.get(repoClass);\r\n            }\r\n        }\r\n        throw new RuntimeException(\"Unknown Repository classes \" + candidateClasses);\r\n    }\r\n    \r\n    /**\r\n     * lookup the {@link RepositoryMethodMetadata} for a specific repository and method.\r\n     *\r\n     * @param repositoryMetadata The Repository metadata to lookup the method for.\r\n     * @param method The method object to get Repository meta data for.\r\n     * @return A {@link RepositoryMethodMetadata}.\r\n     */\r\n    public RepositoryMethodMetadata lookupMethodMetadata(RepositoryMetadata repositoryMetadata, Method method)\r\n    {\r\n        return repositoryMetadata.getMethodsMetadata().get(method);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMetadataInitializer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.meta;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.Method;\r\nimport java.util.HashMap;\r\nimport java.util.HashSet;\r\nimport java.util.Set;\r\nimport java.util.logging.Level;\r\nimport java.util.logging.Logger;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\nimport jakarta.enterprise.inject.Default;\r\nimport jakarta.enterprise.inject.spi.Bean;\r\nimport jakarta.enterprise.inject.spi.BeanManager;\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.FlushModeType;\r\n\r\nimport org.apache.deltaspike.data.api.EntityManagerConfig;\r\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver;\r\nimport org.apache.deltaspike.jpa.spi.entitymanager.QualifierBackedEntityManagerResolver;\r\n\r\n@ApplicationScoped\r\npublic class RepositoryMetadataInitializer\r\n{\r\n    private static final Logger log = Logger.getLogger(RepositoryMetadataInitializer.class.getName());\r\n\r\n    @Inject\r\n    private RepositoryMethodMetadataInitializer methodMetadataInitializer;\r\n    \r\n    @Inject\r\n    private EntityMetadataInitializer entityMetadataInitializer;\r\n    \r\n    public RepositoryMetadata init(Class<?> repositoryClass, BeanManager beanManager)\r\n    {\r\n        RepositoryMetadata repositoryMetadata = new RepositoryMetadata(repositoryClass);\r\n        // read from looks for JPA Transactional and EntityManagerConfig to determine attributes\r\n        // if those are set, don't process old annotations\r\n        if (!repositoryMetadata.readFrom(repositoryClass, beanManager))\r\n        {\r\n            repositoryMetadata.setEntityManagerResolverClass(extractEntityManagerResolver(repositoryClass));\r\n            repositoryMetadata.setEntityManagerFlushMode(extractEntityManagerFlushMode(repositoryClass));\r\n\r\n            if (repositoryMetadata.getEntityManagerResolverClass() != null)\r\n            {\r\n                Set<Bean<?>> beans = beanManager.getBeans(repositoryMetadata.getEntityManagerResolverClass());\r\n                Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();\r\n                repositoryMetadata.setEntityManagerResolverIsNormalScope(beanManager.isNormalScope(scope));\r\n            }\r\n            else\r\n            {\r\n                EntityManagerResolver resolver;\r\n                if (repositoryMetadata.getQualifiers() != null)\r\n                {\r\n                    resolver = new QualifierBackedEntityManagerResolver(beanManager,\r\n                            repositoryMetadata.getQualifiers());\r\n                }\r\n                else\r\n                {\r\n                    resolver = new QualifierBackedEntityManagerResolver(beanManager, Default.class);\r\n                }\r\n                repositoryMetadata.setUnmanagedResolver(resolver);\r\n                repositoryMetadata.setEntityManagerResolverIsNormalScope(false);\r\n            }\r\n        }\r\n        EntityMetadata entityMetadata = entityMetadataInitializer.init(repositoryMetadata);\r\n        if (entityMetadata == null)\r\n        {\r\n            return null;\r\n        }\r\n        repositoryMetadata.setEntityMetadata(entityMetadata);\r\n        initializeMethodsMetadata(repositoryMetadata, beanManager);\r\n\r\n        return repositoryMetadata;\r\n    }\r\n\r\n    private void initializeMethodsMetadata(RepositoryMetadata repositoryMetadata, BeanManager beanManager)\r\n    {\r\n        repositoryMetadata.setMethodsMetadata(new HashMap<Method, RepositoryMethodMetadata>());\r\n        \r\n        Set<Class<?>> allImplemented = new HashSet<Class<?>>();\r\n        collectClasses(repositoryMetadata.getRepositoryClass(), allImplemented);\r\n        log.log(Level.FINER, \"collectClasses(): Found {0} for {1}\",\r\n                new Object[] { allImplemented, repositoryMetadata.getRepositoryClass() });\r\n\r\n        for (Class<?> implemented : allImplemented)\r\n        {\r\n            Method[] repositoryMethods = implemented.getDeclaredMethods();\r\n            for (Method repositoryMethod : repositoryMethods)\r\n            {\r\n                RepositoryMethodMetadata methodMetadata =\r\n                        methodMetadataInitializer.init(repositoryMetadata, repositoryMethod, beanManager);\r\n                repositoryMetadata.getMethodsMetadata().put(repositoryMethod, methodMetadata);\r\n            }\r\n        }\r\n    }\r\n\r\n    private void collectClasses(Class<?> cls, Set<Class<?>> result)\r\n    {\r\n        if (cls == null || cls == Object.class)\r\n        {\r\n            return;\r\n        }\r\n        \r\n        result.add(cls);\r\n        \r\n        for (Class<?> child : cls.getInterfaces())\r\n        {\r\n            collectClasses(child, result);\r\n        }\r\n        \r\n        collectClasses(cls.getSuperclass(), result);\r\n    }\r\n\r\n    private Class<? extends EntityManagerResolver> extractEntityManagerResolver(Class<?> clazz)\r\n    {\r\n        EntityManagerConfig config = extractEntityManagerConfig(clazz);\r\n        if (config != null && !EntityManagerResolver.class.equals(config.entityManagerResolver()))\r\n        {\r\n            return config.entityManagerResolver();\r\n        }\r\n        return null;\r\n    }\r\n\r\n    private FlushModeType extractEntityManagerFlushMode(Class<?> clazz)\r\n    {\r\n        EntityManagerConfig config = extractEntityManagerConfig(clazz);\r\n        if (config != null)\r\n        {\r\n            return config.flushMode();\r\n        }\r\n        return null;\r\n    }\r\n\r\n    private EntityManagerConfig extractEntityManagerConfig(Class<?> clazz)\r\n    {\r\n        if (clazz.isAnnotationPresent(EntityManagerConfig.class))\r\n        {\r\n            return clazz.getAnnotation(EntityManagerConfig.class);\r\n        }\r\n        return null;\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMethodMetadata.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport java.lang.reflect.Method;\nimport org.apache.deltaspike.data.api.Modifying;\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.api.SingleResultType;\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\nimport org.apache.deltaspike.data.impl.builder.part.QueryRoot;\nimport org.apache.deltaspike.data.impl.builder.result.QueryProcessor;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\npublic class RepositoryMethodMetadata\n{\n    private Method method;\n    private RepositoryMethodType methodType;\n    private RepositoryMethodPrefix methodPrefix;\n    \n    private Query query;\n    private Modifying modifying;\n    \n    private QueryRoot queryRoot;\n    private QueryProcessor queryProcessor;\n\n    private Class<? extends QueryInOutMapper<?>> queryInOutMapperClass;\n    private boolean queryInOutMapperIsNormalScope;\n    \n    private boolean returnsOptional;\n    private boolean returnsStream;\n    \n    private SingleResultType singleResultType;\n    \n    private boolean requiresTransaction;\n    \n    private Transactional transactional;\n\n    public RepositoryMethodMetadata()\n    {\n        \n    }\n    \n    public RepositoryMethodMetadata(Method method)\n    {\n        this.method = method;\n    }\n    \n    public Method getMethod()\n    {\n        return method;\n    }\n\n    public void setMethod(Method method)\n    {\n        this.method = method;\n    }\n\n    public RepositoryMethodType getMethodType()\n    {\n        return methodType;\n    }\n\n    public void setMethodType(RepositoryMethodType methodType)\n    {\n        this.methodType = methodType;\n    }\n\n    public RepositoryMethodPrefix getMethodPrefix()\n    {\n        return methodPrefix;\n    }\n\n    public void setMethodPrefix(RepositoryMethodPrefix methodPrefix)\n    {\n        this.methodPrefix = methodPrefix;\n    }\n\n    public QueryRoot getQueryRoot()\n    {\n        return queryRoot;\n    }\n\n    public void setQueryRoot(QueryRoot queryRoot)\n    {\n        this.queryRoot = queryRoot;\n    }\n\n    public QueryProcessor getQueryProcessor()\n    {\n        return queryProcessor;\n    }\n\n    public void setQueryProcessor(QueryProcessor queryProcessor)\n    {\n        this.queryProcessor = queryProcessor;\n    }\n\n    public Class<? extends QueryInOutMapper<?>> getQueryInOutMapperClass()\n    {\n        return queryInOutMapperClass;\n    }\n\n    public void setQueryInOutMapperClass(Class<? extends QueryInOutMapper<?>> queryInOutMapperClass)\n    {\n        this.queryInOutMapperClass = queryInOutMapperClass;\n    }\n\n    public boolean isQueryInOutMapperIsNormalScope()\n    {\n        return queryInOutMapperIsNormalScope;\n    }\n\n    public void setQueryInOutMapperIsNormalScope(boolean queryInOutMapperIsNormalScope)\n    {\n        this.queryInOutMapperIsNormalScope = queryInOutMapperIsNormalScope;\n    }\n\n    public Query getQuery()\n    {\n        return query;\n    }\n\n    public void setQuery(Query query)\n    {\n        this.query = query;\n    }\n\n    public Modifying getModifying() \n    {\n        return modifying;\n    }\n\n    public void setModifying(Modifying modifying)\n    {\n        this.modifying = modifying;\n    } \n\n    public boolean isReturnsOptional()\n    {\n        return returnsOptional;\n    }\n\n    public void setReturnsOptional(boolean returnsOptional)\n    {\n        this.returnsOptional = returnsOptional;\n    }\n\n    public boolean isReturnsStream()\n    {\n        return returnsStream;\n    }\n\n    public void setReturnsStream(boolean returnsStream)\n    {\n        this.returnsStream = returnsStream;\n    }\n\n    public SingleResultType getSingleResultType()\n    {\n        return singleResultType;\n    }\n\n    public void setSingleResultType(SingleResultType singleResultType)\n    {\n        this.singleResultType = singleResultType;\n    }\n\n    public boolean isRequiresTransaction()\n    {\n        return requiresTransaction;\n    }\n\n    public void setRequiresTransaction(boolean requiresTransaction)\n    {\n        this.requiresTransaction = requiresTransaction;\n    }\n\n    public Transactional getTransactional()\n    {\n        return transactional;\n    }\n\n    public void setTransactional(Transactional transactional)\n    {\n        this.transactional = transactional;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMethodMetadataInitializer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.meta;\r\n\r\nimport static org.apache.deltaspike.core.util.StringUtils.isNotEmpty;\r\n\r\nimport java.lang.annotation.Annotation;\r\nimport java.lang.reflect.Method;\r\nimport java.lang.reflect.Modifier;\r\nimport java.util.Optional;\r\nimport java.util.Set;\r\nimport java.util.stream.Stream;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\nimport jakarta.enterprise.inject.spi.Bean;\r\nimport jakarta.enterprise.inject.spi.BeanManager;\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.LockModeType;\r\nimport org.apache.deltaspike.core.util.AnnotationUtils;\r\nimport org.apache.deltaspike.core.util.ClassUtils;\r\n\r\nimport org.apache.deltaspike.data.api.Modifying;\r\nimport org.apache.deltaspike.data.api.Query;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.api.SingleResultType;\r\nimport org.apache.deltaspike.data.api.mapping.MappingConfig;\r\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\r\nimport org.apache.deltaspike.data.impl.builder.MethodExpressionException;\r\nimport org.apache.deltaspike.data.impl.builder.part.QueryRoot;\r\nimport org.apache.deltaspike.data.impl.builder.result.QueryProcessorFactory;\r\nimport org.apache.deltaspike.data.impl.handler.EntityRepositoryHandler;\r\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\r\n\r\n@ApplicationScoped\r\npublic class RepositoryMethodMetadataInitializer\r\n{\r\n    @Inject\r\n    private QueryProcessorFactory queryProcessorFactory;\r\n    \r\n    public RepositoryMethodMetadata init(RepositoryMetadata repositoryMetadata, Method method, BeanManager beanManager)\r\n    {\r\n        RepositoryMethodMetadata repositoryMethodMetadata = new RepositoryMethodMetadata();\r\n        \r\n        repositoryMethodMetadata.setMethod(method);\r\n\r\n        repositoryMethodMetadata.setReturnsOptional(Optional.class.isAssignableFrom(method.getReturnType()));\r\n        repositoryMethodMetadata.setReturnsStream(Stream.class.isAssignableFrom(method.getReturnType()));\r\n        \r\n        repositoryMethodMetadata.setQuery(method.isAnnotationPresent(Query.class)\r\n                ? method.getAnnotation(Query.class) : null);\r\n        repositoryMethodMetadata.setModifying(method.isAnnotationPresent(Modifying.class)\r\n                ? method.getAnnotation(Modifying.class) : null);\r\n        \r\n        repositoryMethodMetadata.setTransactional(AnnotationUtils.extractAnnotationFromMethodOrClass(\r\n                beanManager, method, repositoryMetadata.getRepositoryClass(), Transactional.class));\r\n\r\n        repositoryMethodMetadata.setMethodPrefix(new RepositoryMethodPrefix(\r\n                    repositoryMetadata.getRepositoryClass().getAnnotation(Repository.class).methodPrefix(),\r\n                    method.getName()));\r\n        repositoryMethodMetadata.setMethodType(\r\n                extractMethodType(repositoryMetadata, repositoryMethodMetadata));\r\n        \r\n        repositoryMethodMetadata.setQueryProcessor(queryProcessorFactory.build(repositoryMethodMetadata));\r\n        \r\n        repositoryMethodMetadata.setQueryInOutMapperClass(\r\n                extractMapper(method, repositoryMetadata));\r\n\r\n        initQueryRoot(repositoryMetadata, repositoryMethodMetadata);\r\n        initQueryInOutMapperIsNormalScope(repositoryMethodMetadata, beanManager);\r\n\r\n        initSingleResultType(repositoryMethodMetadata);\r\n        initRequiresTransaction(repositoryMethodMetadata);\r\n\r\n        \r\n        return repositoryMethodMetadata;\r\n    }\r\n\r\n    private RepositoryMethodType extractMethodType(RepositoryMetadata repositoryMetadata,\r\n            RepositoryMethodMetadata repositoryMethodMetadata)\r\n    {\r\n        if (isAnnotated(repositoryMethodMetadata))\r\n        {\r\n            return RepositoryMethodType.ANNOTATED;\r\n        }\r\n        \r\n        if (isMethodExpression(repositoryMetadata, repositoryMethodMetadata))\r\n        {\r\n            return RepositoryMethodType.PARSE;\r\n        }\r\n        \r\n        return RepositoryMethodType.DELEGATE;\r\n    }\r\n\r\n    private void initQueryRoot(RepositoryMetadata repositoryMetadata, RepositoryMethodMetadata methodMetadata)\r\n    {\r\n        if (methodMetadata.getMethodType() == RepositoryMethodType.PARSE)\r\n        {\r\n            methodMetadata.setQueryRoot(\r\n                    QueryRoot.create(methodMetadata.getMethod().getName(),\r\n                            repositoryMetadata,\r\n                            methodMetadata.getMethodPrefix()));\r\n        }\r\n        else\r\n        {\r\n            methodMetadata.setQueryRoot(QueryRoot.UNKNOWN_ROOT);\r\n        }\r\n    }\r\n    \r\n    private void initQueryInOutMapperIsNormalScope(RepositoryMethodMetadata repositoryMethodMetadata,\r\n                                                   BeanManager beanManager)\r\n    {\r\n        if (repositoryMethodMetadata.getQueryInOutMapperClass() != null)\r\n        {\r\n            Set<Bean<?>> beans = beanManager.getBeans(repositoryMethodMetadata.getQueryInOutMapperClass());\r\n            Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();\r\n            repositoryMethodMetadata.setQueryInOutMapperIsNormalScope(beanManager.isNormalScope(scope));\r\n        }\r\n    }\r\n\r\n    private boolean isAnnotated(RepositoryMethodMetadata repositoryMethodMetadata)\r\n    {\r\n        if (repositoryMethodMetadata.getQuery() != null)\r\n        {\r\n            return isValid(repositoryMethodMetadata.getQuery());\r\n        }\r\n        return false;\r\n    }\r\n\r\n    private boolean isValid(Query query)\r\n    {\r\n        return isNotEmpty(query.value()) || isNotEmpty(query.named());\r\n    }\r\n\r\n    private boolean isMethodExpression(RepositoryMetadata repositoryMetadata,\r\n            RepositoryMethodMetadata repositoryMethodMetadata)\r\n    {\r\n        if (!Modifier.isAbstract(repositoryMethodMetadata.getMethod().getModifiers()))\r\n        {\r\n            return false;\r\n        }\r\n        \r\n        try\r\n        {\r\n            QueryRoot.create(repositoryMethodMetadata.getMethod().getName(),\r\n                    repositoryMetadata,\r\n                    repositoryMethodMetadata.getMethodPrefix());\r\n            return true;\r\n        }\r\n        catch (MethodExpressionException e)\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n\r\n    private Class<? extends QueryInOutMapper<?>> extractMapper(Method queryMethod,\r\n            RepositoryMetadata repositoryMetadata)\r\n    {\r\n        if (queryMethod.isAnnotationPresent(MappingConfig.class))\r\n        {\r\n            return queryMethod.getAnnotation(MappingConfig.class).value();\r\n        }\r\n        \r\n        if (repositoryMetadata.getRepositoryClass().isAnnotationPresent(MappingConfig.class))\r\n        {\r\n            return repositoryMetadata.getRepositoryClass().getAnnotation(MappingConfig.class).value();\r\n        }\r\n        \r\n        return null;\r\n    }\r\n    \r\n    private void initSingleResultType(RepositoryMethodMetadata repositoryMethodMetadata)\r\n    {\r\n        SingleResultType singleResultType = repositoryMethodMetadata.getQuery() != null\r\n                ? repositoryMethodMetadata.getQuery().singleResult()\r\n                : repositoryMethodMetadata.getMethodPrefix().getSingleResultStyle();\r\n        \r\n        if (repositoryMethodMetadata.isReturnsOptional() && singleResultType == SingleResultType.JPA)\r\n        {\r\n            repositoryMethodMetadata.setSingleResultType(SingleResultType.OPTIONAL);\r\n        }\r\n        else\r\n        {\r\n            repositoryMethodMetadata.setSingleResultType(singleResultType);\r\n        }\r\n    }\r\n    \r\n    private void initRequiresTransaction(RepositoryMethodMetadata repositoryMethodMetadata)\r\n    {\r\n        boolean requiresTransaction = false;\r\n        \r\n        if (ClassUtils.containsMethod(EntityRepositoryHandler.class, repositoryMethodMetadata.getMethod()))\r\n        {\r\n            Method originalMethod = ClassUtils.extractMethod(EntityRepositoryHandler.class,\r\n                    repositoryMethodMetadata.getMethod());\r\n            if (originalMethod.isAnnotationPresent(RequiresTransaction.class))\r\n            {\r\n                requiresTransaction = true;\r\n            }\r\n        }\r\n\r\n        Query query = repositoryMethodMetadata.getQuery();\r\n        Modifying modifying = repositoryMethodMetadata.getModifying();\r\n        \r\n        if ((query != null && !query.lock().equals(LockModeType.NONE)) || modifying != null)\r\n        {\r\n            requiresTransaction = true;\r\n        }\r\n        \r\n        repositoryMethodMetadata.setRequiresTransaction(requiresTransaction);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMethodPrefix.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport org.apache.deltaspike.data.api.SingleResultType;\n\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class RepositoryMethodPrefix\n{\n    public static final String DEFAULT_PREFIX = \"findBy\";\n    public static final String DEFAULT_OPT_PREFIX = \"findOptionalBy\";\n    public static final String DEFAULT_ANY_PREFIX = \"findAnyBy\";\n    public static final String DEFAULT_DELETE_PREFIX = \"deleteBy\";\n    public static final String DEFAULT_COUNT_PREFIX = \"countBy\";\n    public static final String DEFAULT_REMOVE_PREFIX = \"removeBy\";\n    private static final String FIND_ALL_PREFIX = \"findAll\";\n    \n    private static final String FIND_FIRST_PREFIX = \"find(First|Top)(\\\\d+)(By)*\";\n    private static final String FIND_FIRST_PREFIX_PATTERN = FIND_FIRST_PREFIX + \"(.*)\";\n    private static final Pattern DIGIT_PATTERN = Pattern.compile(\"\\\\d+\");\n\n    private final String customPrefix;\n    private final String methodName;\n    private int definedMaxResults = 0;\n\n    public RepositoryMethodPrefix(String customPrefix, String methodName)\n    {\n        this.customPrefix = customPrefix;\n        this.methodName = methodName;\n        if (this.methodName != null)\n        {\n            this.parseMaxResults();\n        }\n    }\n\n    public String removePrefix(String queryPart)\n    {\n        if (hasCustomPrefix() && queryPart.startsWith(customPrefix))\n        {\n            return queryPart.substring(customPrefix.length());\n        }\n        KnownQueryPrefix known = KnownQueryPrefix.fromMethodName(queryPart);\n        if (known != null)\n        {\n            return known.removePrefix(queryPart);\n        }\n        return queryPart;\n    }\n\n    public boolean hasCustomPrefix()\n    {\n        return !\"\".equals(customPrefix);\n    }\n\n    public String getCustomPrefix()\n    {\n        return customPrefix;\n    }\n\n    public String getPrefix()\n    {\n        if (hasCustomPrefix())\n        {\n            return customPrefix;\n        }\n        KnownQueryPrefix prefix = KnownQueryPrefix.fromMethodName(methodName);\n        if (prefix != null)\n        {\n            return prefix.getPrefix();\n        }\n        return \"\";\n    }\n\n    public SingleResultType getSingleResultStyle()\n    {\n        KnownQueryPrefix prefix = KnownQueryPrefix.fromMethodName(methodName);\n        if (prefix != null)\n        {\n            return prefix.getStyle();\n        }\n        return SingleResultType.JPA;\n    }\n\n    public boolean isDelete()\n    {\n        return this.getPrefix().equalsIgnoreCase(DEFAULT_DELETE_PREFIX) ||\n                this.getPrefix().equalsIgnoreCase(DEFAULT_REMOVE_PREFIX);\n    }\n\n    public boolean isCount()\n    {\n        return this.getPrefix().equalsIgnoreCase(DEFAULT_COUNT_PREFIX);\n    }\n    \n    public int getDefinedMaxResults()\n    {\n        return definedMaxResults;\n    }\n\n    private void parseMaxResults()\n    {\n        if (this.methodName.matches(FIND_FIRST_PREFIX_PATTERN))\n        {\n            Matcher matcher = DIGIT_PATTERN.matcher(this.methodName);\n            if (matcher.find())\n            {\n                this.definedMaxResults = Integer.parseInt(matcher.group());\n            }\n        }\n    }\n\n    private enum KnownQueryPrefix\n    {\n        DEFAULT(DEFAULT_PREFIX, SingleResultType.JPA),\n        ALL(FIND_ALL_PREFIX, SingleResultType.JPA),\n        FIND_FIRST(FIND_FIRST_PREFIX, SingleResultType.JPA)\n        {\n            @Override\n            public boolean matches(String name)\n            {\n                return name.matches(FIND_FIRST_PREFIX_PATTERN);\n            }\n            @Override\n            public String removePrefix(String queryPart)\n            {\n                return queryPart.replaceFirst(FIND_FIRST_PREFIX,\"\");\n            }\n        },\n        OPTIONAL(DEFAULT_OPT_PREFIX,SingleResultType.OPTIONAL),\n        ANY(DEFAULT_ANY_PREFIX, SingleResultType.ANY),\n        DELETE_DEFAULT(DEFAULT_DELETE_PREFIX, SingleResultType.ANY),\n        REMOVE_DEFAULT(DEFAULT_REMOVE_PREFIX, SingleResultType.ANY),\n        COUNT_DEFAULT(DEFAULT_COUNT_PREFIX, SingleResultType.ANY);\n\n        private final String prefix;\n        private final SingleResultType singleResultType;\n\n        KnownQueryPrefix(String prefix, SingleResultType singleResultType)\n        {\n            this.prefix = prefix;\n            this.singleResultType = singleResultType;\n        }\n\n        public String removePrefix(String queryPart)\n        {\n            return queryPart.substring(prefix.length());\n        }\n\n        public String getPrefix()\n        {\n            return prefix;\n        }\n\n        public SingleResultType getStyle()\n        {\n            return this.singleResultType;\n        }\n\n        public boolean matches(String name)\n        {\n            return name.startsWith(getPrefix());\n        }\n\n        public static KnownQueryPrefix fromMethodName(String name)\n        {\n            for (KnownQueryPrefix mapping : values())\n            {\n                if (mapping.matches(name))\n                {\n                    return mapping;\n                }\n            }\n            return null;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMethodType.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.meta;\r\n\r\n\r\n/**\r\n * Repository method type. Stands for\r\n * <ul>\r\n * <li>Delegated methods - the Repository has a concrete implementation for this or the method is implemented in the\r\n * {@link org.apache.deltaspike.data.impl.handler.EntityRepositoryHandler}.</li>\r\n * <li>Annotated method - the query is defined via a Query annotation.</li>\r\n * <li>The method defines a query expression by its name.</li>\r\n * </ul>\r\n */\r\npublic enum RepositoryMethodType\r\n{\r\n\r\n    DELEGATE, ANNOTATED, PARSE\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RequiresTransaction.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\n@Target(METHOD)\n@Retention(RUNTIME)\npublic @interface RequiresTransaction\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/param/IndexedParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.param;\n\nimport jakarta.persistence.Query;\n\n/**\n * Query parameters which have an index (?1).\n */\npublic class IndexedParameter extends Parameter\n{\n\n    private final int index;\n\n    public IndexedParameter(int index, Object value)\n    {\n        super(value);\n        this.index = index;\n    }\n\n    @Override\n    public void apply(Query query)\n    {\n        query.setParameter(index, queryValue());\n    }\n\n    @Override\n    public boolean is(String ident)\n    {\n        try\n        {\n            return Integer.valueOf(ident).intValue() == index;\n        }\n        catch (NumberFormatException e)\n        {\n            return false;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/param/NamedParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.param;\n\nimport jakarta.persistence.Query;\n\n/**\n * Parameters which have a name (:name).\n */\npublic class NamedParameter extends Parameter\n{\n\n    private final String name;\n\n    public NamedParameter(String name, Object value)\n    {\n        super(value);\n        this.name = name;\n    }\n\n    @Override\n    public void apply(Query query)\n    {\n        query.setParameter(name, queryValue());\n    }\n\n    @Override\n    public boolean is(String ident)\n    {\n        return ident != null && ident.equals(name);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/param/Parameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.param;\n\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\n\n/**\n * Base class for parameters.\n */\npublic abstract class Parameter\n{\n    private static final Logger LOG = Logger.getLogger(Parameter.class.getName());\n\n    protected Object value;\n\n    protected Object mappedValue = null;\n\n    public Parameter(Object value)\n    {\n        this.value = value;\n    }\n\n    public abstract void apply(Query query);\n\n    public abstract boolean is(String ident);\n\n    public void applyMapper(QueryInOutMapper<?> mapper)\n    {\n        if (mapper.mapsParameter(value))\n        {\n            mappedValue = mapper.mapParameter(value);\n            LOG.log(Level.FINE, \"Converting param {0} to {1}\", new Object[] { value, mappedValue });\n        }\n    }\n\n    public void updateValue(Object newValue)\n    {\n        if (mappedValue != null)\n        {\n            mappedValue = newValue;\n        }\n        else\n        {\n            value = newValue;\n        }\n    }\n\n    protected Object queryValue()\n    {\n        return mappedValue != null ? mappedValue : value;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/param/ParameterUpdate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.param;\n\npublic interface ParameterUpdate\n{\n\n    String forParamWithId();\n\n    Object newParamValue(Object current);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/param/Parameters.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.param;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.data.api.FirstResult;\nimport org.apache.deltaspike.data.api.MaxResults;\nimport org.apache.deltaspike.data.api.QueryParam;\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata;\n\n/**\n * Convenience class to manage method and query parameters.\n */\npublic final class Parameters\n{\n\n    private static final Logger LOG = Logger.getLogger(Parameters.class.getName());\n\n    private static final int DEFAULT_MAX = 0;\n    private static final int DEFAULT_FIRST = -1;\n\n    private final List<Parameter> parameterList;\n    private final int max;\n    private final int firstResult;\n\n    private Parameters(List<Parameter> parameters, int max, int firstResult)\n    {\n        this.parameterList = parameters;\n        this.max = max;\n        this.firstResult = firstResult;\n    }\n\n    public static Parameters createEmpty()\n    {\n        List<Parameter> empty = Collections.emptyList();\n        return new Parameters(empty, DEFAULT_MAX, DEFAULT_FIRST);\n    }\n\n    public static Parameters create(Method method, Object[] parameters, RepositoryMethodMetadata repositoryMethod)\n    {\n        int max = extractSizeRestriction(method, repositoryMethod);\n        int first = DEFAULT_FIRST;\n        List<Parameter> result = new ArrayList<Parameter>(parameters.length);\n        int paramIndex = 1;\n        Annotation[][] annotations = method.getParameterAnnotations();\n        for (int i = 0; i < parameters.length; i++)\n        {\n            if (isParameter(method.getParameterAnnotations()[i]))\n            {\n                QueryParam qpAnnotation = extractFrom(annotations[i], QueryParam.class);\n                if (qpAnnotation != null)\n                {\n                    result.add(new NamedParameter(qpAnnotation.value(), parameters[i]));\n                }\n                else\n                {\n                    result.add(new IndexedParameter(paramIndex++, parameters[i]));\n                }\n            }\n            else\n            {\n                max = extractInt(parameters[i], annotations[i], MaxResults.class, max);\n                first = extractInt(parameters[i], annotations[i], FirstResult.class, first);\n            }\n        }\n        return new Parameters(result, max, first);\n    }\n\n    public void applyMapper(QueryInOutMapper<?> mapper)\n    {\n        for (Parameter param : parameterList)\n        {\n            param.applyMapper(mapper);\n        }\n    }\n\n    public void updateValues(List<ParameterUpdate> updates)\n    {\n        for (ParameterUpdate update : updates)\n        {\n            for (Parameter param : parameterList)\n            {\n                if (param.is(update.forParamWithId()))\n                {\n                    param.updateValue(update.newParamValue(param.queryValue()));\n                }\n            }\n        }\n    }\n\n    public Query applyTo(Query query)\n    {\n        for (Parameter param : parameterList)\n        {\n            param.apply(query);\n        }\n        return query;\n    }\n\n    public boolean hasSizeRestriction()\n    {\n        return max > DEFAULT_MAX;\n    }\n\n    public int getSizeRestriciton()\n    {\n        return max;\n    }\n\n    public boolean hasFirstResult()\n    {\n        return firstResult > DEFAULT_FIRST;\n    }\n\n    public int getFirstResult()\n    {\n        return firstResult;\n    }\n\n    private static int extractSizeRestriction(Method method, RepositoryMethodMetadata repositoryMethod)\n    {\n        if (repositoryMethod.getQuery() != null)\n        {\n            return repositoryMethod.getQuery().max();\n        }\n        return repositoryMethod.getMethodPrefix().getDefinedMaxResults();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private static <A extends Annotation> A extractFrom(Annotation[] annotations, Class<A> target)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (annotation.annotationType().isAssignableFrom(target))\n            {\n                return (A) annotation;\n            }\n        }\n        return null;\n    }\n\n    private static <A extends Annotation> int extractInt(Object parameter, Annotation[] annotations,\n            Class<A> target, int defaultVal)\n    {\n        if (parameter != null)\n        {\n            A result = extractFrom(annotations, target);\n            if (result != null)\n            {\n                if (parameter instanceof Integer)\n                {\n                    return (Integer) parameter;\n                }\n                else\n                {\n                    LOG.log(Level.WARNING, \"Method parameter extraction: \" +\n                            \"Param type must be int: {0}->is:{1}\",\n                            new Object[] { target, parameter.getClass() });\n                }\n            }\n        }\n        return defaultVal;\n    }\n\n    private static boolean isParameter(Annotation[] annotations)\n    {\n        return extractFrom(annotations, MaxResults.class) == null &&\n                extractFrom(annotations, FirstResult.class) == null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/param/ToUpperStringParameterUpdate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.param;\n\npublic class ToUpperStringParameterUpdate implements ParameterUpdate\n{\n\n    private final String id;\n\n    public ToUpperStringParameterUpdate(String id)\n    {\n        this.id = id;\n    }\n\n    @Override\n    public String forParamWithId()\n    {\n        return id;\n    }\n\n    @Override\n    public Object newParamValue(Object current)\n    {\n        if (current instanceof String)\n        {\n            return ((String) current).toUpperCase();\n        }\n        return current;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/FieldProperty.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.lang.reflect.Field;\n\npublic interface FieldProperty<V> extends Property<V>\n{\n\n    @Override\n    Field getAnnotatedElement();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/FieldPropertyImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Type;\n\n/**\n * A bean property based on the value contained in a field\n */\nclass FieldPropertyImpl<V> implements FieldProperty<V>\n{\n\n    private final Field field;\n\n    FieldPropertyImpl(Field field)\n    {\n        this.field = field;\n    }\n\n    @Override\n    public String getName()\n    {\n        return field.getName();\n    }\n\n    @Override\n    public Type getBaseType()\n    {\n        return field.getGenericType();\n    }\n\n    @Override\n    public Field getAnnotatedElement()\n    {\n        return field;\n    }\n\n    @Override\n    public Member getMember()\n    {\n        return field;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public Class<V> getJavaClass()\n    {\n        return (Class<V>) field.getType();\n    }\n\n    @Override\n    public V getValue(Object instance)\n    {\n        setAccessible();\n        return Reflections.getFieldValue(field, instance, getJavaClass());\n    }\n\n    @Override\n    public void setValue(Object instance, V value)\n    {\n        setAccessible();\n        Reflections.setFieldValue(true, field, instance, value);\n    }\n\n    @Override\n    public Class<?> getDeclaringClass()\n    {\n        return field.getDeclaringClass();\n    }\n\n    @Override\n    public boolean isReadOnly()\n    {\n        return false;\n    }\n\n    @Override\n    public void setAccessible()\n    {\n        Reflections.setAccessible(field);\n    }\n\n    @Override\n    public String toString()\n    {\n        return field.toString();\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return field.hashCode();\n    }\n\n    @Override\n    public boolean equals(Object obj)\n    {\n        return field.equals(obj);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/MethodProperty.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.lang.reflect.Method;\n\npublic interface MethodProperty<V> extends Property<V>\n{\n\n    @Override\n    Method getAnnotatedElement();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/MethodPropertyImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.beans.Introspector;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\n\n/**\n * A bean property based on the value represented by a getter/setter method pair\n */\nclass MethodPropertyImpl<V> implements MethodProperty<V>\n{\n    private static final String GETTER_METHOD_PREFIX = \"get\";\n    private static final String SETTER_METHOD_PREFIX = \"set\";\n    private static final String BOOLEAN_GETTER_METHOD_PREFIX = \"is\";\n\n    private static final int GETTER_METHOD_PREFIX_LENGTH = GETTER_METHOD_PREFIX.length();\n    private static final int SETTER_METHOD_PREFIX_LENGTH = SETTER_METHOD_PREFIX.length();\n    private static final int BOOLEAN_GETTER_METHOD_PREFIX_LENGTH = BOOLEAN_GETTER_METHOD_PREFIX.length();\n\n    private final Method getterMethod;\n    private final String propertyName;\n    private final Method setterMethod;\n\n    public MethodPropertyImpl(Method method)\n    {\n        final String accessorMethodPrefix;\n        final String propertyNameInAccessorMethod;\n        if (method.getName().startsWith(GETTER_METHOD_PREFIX))\n        {\n            if (method.getReturnType() == Void.TYPE)\n            {\n                throw new IllegalArgumentException(\n                        \"Invalid accessor method, must have return value if starts with 'get'. Method: \" + method);\n            }\n            else if (method.getParameterTypes().length > 0)\n            {\n                throw new IllegalArgumentException(\n                        \"Invalid accessor method, must have zero arguments if starts with 'get'. Method: \" + method);\n            }\n            propertyNameInAccessorMethod = method.getName().substring(GETTER_METHOD_PREFIX_LENGTH);\n            accessorMethodPrefix = GETTER_METHOD_PREFIX;\n        }\n        else if (method.getName().startsWith(SETTER_METHOD_PREFIX))\n        {\n            if (method.getReturnType() != Void.TYPE)\n            {\n                throw new IllegalArgumentException(\n                        \"Invalid accessor method, must not have return value if starts with 'set'. Method: \" + method);\n            }\n            else if (method.getParameterTypes().length != 1)\n            {\n                throw new IllegalArgumentException(\n                        \"Invalid accessor method, must have one argument if starts with 'set'. Method: \" + method);\n            }\n            propertyNameInAccessorMethod = method.getName().substring(SETTER_METHOD_PREFIX_LENGTH);\n            accessorMethodPrefix = SETTER_METHOD_PREFIX;\n        }\n        else if (method.getName().startsWith(BOOLEAN_GETTER_METHOD_PREFIX))\n        {\n            if (method.getReturnType() != Boolean.TYPE || !method.getReturnType().isPrimitive())\n            {\n                throw new IllegalArgumentException(\n                        \"Invalid accessor method, must return boolean primitive if starts \" +\n                        \"with 'is'. Method: \" + method);\n            }\n            propertyNameInAccessorMethod = method.getName().substring(BOOLEAN_GETTER_METHOD_PREFIX_LENGTH);\n            accessorMethodPrefix = BOOLEAN_GETTER_METHOD_PREFIX;\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Invalid accessor method, must start with 'get', 'set' or 'is'. \"\n                    + \"Method: \" + method);\n        }\n        if (propertyNameInAccessorMethod.length() == 0\n                || !Character.isUpperCase(propertyNameInAccessorMethod.charAt(0)))\n        {\n            throw new IllegalArgumentException(\"Invalid accessor method, prefix '\" + accessorMethodPrefix\n                    + \"' must be followed a non-empty property name, capitalized. Method: \" + method);\n        }\n        this.propertyName = Introspector.decapitalize(propertyNameInAccessorMethod);\n        this.getterMethod = getGetterMethod(method.getDeclaringClass(), propertyName);\n        this.setterMethod = getSetterMethod(method.getDeclaringClass(), propertyName);\n    }\n\n    @Override\n    public String getName()\n    {\n        return propertyName;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public Class<V> getJavaClass()\n    {\n        return (Class<V>) getterMethod.getReturnType();\n    }\n\n    @Override\n    public Type getBaseType()\n    {\n        return getterMethod.getGenericReturnType();\n    }\n\n    @Override\n    public Method getAnnotatedElement()\n    {\n        return getterMethod;\n    }\n\n    @Override\n    public Member getMember()\n    {\n        return getterMethod;\n    }\n\n    @Override\n    public V getValue(Object instance)\n    {\n        if (getterMethod == null)\n        {\n            throw new UnsupportedOperationException(\"Property \" + this.setterMethod.getDeclaringClass() + \".\"\n                    + propertyName + \" cannot be read, as there is no getter method.\");\n        }\n        return Reflections.cast(Reflections.invokeMethod(getterMethod, instance));\n    }\n\n    @Override\n    public void setValue(Object instance, V value)\n    {\n        if (setterMethod == null)\n        {\n            throw new UnsupportedOperationException(\"Property \" + this.getterMethod.getDeclaringClass() + \".\"\n                    + propertyName + \" is read only, as there is no setter method.\");\n        }\n        Reflections.invokeMethod(setterMethod, instance, value);\n    }\n\n    private static Method getSetterMethod(Class<?> clazz, String name)\n    {\n        Method[] methods = clazz.getMethods();\n        for (Method method : methods)\n        {\n            String methodName = method.getName();\n            if (methodName.startsWith(SETTER_METHOD_PREFIX) && method.getParameterTypes().length == 1)\n            {\n                if (Introspector.decapitalize(methodName.substring(SETTER_METHOD_PREFIX_LENGTH)).equals(name))\n                {\n                    return method;\n                }\n            }\n        }\n        return null;\n    }\n\n    private static Method getGetterMethod(Class<?> clazz, String name)\n    {\n        for (Method method : clazz.getDeclaredMethods())\n        {\n            String methodName = method.getName();\n            if (method.getParameterTypes().length == 0)\n            {\n                if (methodName.startsWith(GETTER_METHOD_PREFIX))\n                {\n                    if (Introspector.decapitalize(methodName.substring(GETTER_METHOD_PREFIX_LENGTH)).equals(name))\n                    {\n                        return method;\n                    }\n                }\n                else if (methodName.startsWith(BOOLEAN_GETTER_METHOD_PREFIX))\n                {\n                    if (Introspector.decapitalize(methodName.substring(BOOLEAN_GETTER_METHOD_PREFIX_LENGTH)).equals(\n                            name))\n                    {\n                        return method;\n                    }\n                }\n            }\n        }\n        throw new IllegalArgumentException(\"no such getter method: \" + clazz.getName() + '.' + name);\n    }\n\n    @Override\n    public Class<?> getDeclaringClass()\n    {\n        return getterMethod.getDeclaringClass();\n    }\n\n    @Override\n    public boolean isReadOnly()\n    {\n        return setterMethod == null;\n    }\n\n    @Override\n    public void setAccessible()\n    {\n        if (setterMethod != null)\n        {\n            Reflections.setAccessible(setterMethod);\n        }\n        if (getterMethod != null)\n        {\n            Reflections.setAccessible(getterMethod);\n        }\n    }\n\n    @Override\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        if (isReadOnly())\n        {\n            builder.append(\"read-only \").append(setterMethod.toString()).append(\"; \");\n        }\n        builder.append(getterMethod.toString());\n        return builder.toString();\n    }\n\n    @Override\n    public int hashCode()\n    {\n        int hash = 1;\n        hash = hash * 31 + (setterMethod == null ? 0 : setterMethod.hashCode());\n        hash = hash * 31 + getterMethod.hashCode();\n        return hash;\n    }\n\n    @Override\n    public boolean equals(Object obj)\n    {\n        if (obj instanceof MethodPropertyImpl<?>)\n        {\n            MethodPropertyImpl<?> that = (MethodPropertyImpl<?>) obj;\n            if (this.setterMethod == null)\n            {\n                return that.setterMethod == null && this.getterMethod.equals(that.getterMethod);\n            }\n            else\n            {\n                return this.setterMethod.equals(that.setterMethod) && this.getterMethod.equals(that.getterMethod);\n            }\n        }\n        else\n        {\n            return false;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/Properties.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Method;\n\n/**\n * Utility class for working with JavaBean style properties\n *\n * @see Property\n */\npublic class Properties\n{\n\n    private Properties()\n    {\n    }\n\n    /**\n     * Create a JavaBean style property from the field\n     *\n     * @param <V>\n     * @param field\n     * @return\n     */\n    public static <V> FieldProperty<V> createProperty(Field field)\n    {\n        return new FieldPropertyImpl<V>(field);\n    }\n\n    /**\n     * Create a JavaBean style property from the specified method\n     *\n     * @param <V>\n     * @param method\n     * @return\n     * @throws IllegalArgumentException\n     *             if the method does not match JavaBean conventions\n     * @see http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html\n     */\n    public static <V> MethodProperty<V> createProperty(Method method)\n    {\n        return new MethodPropertyImpl<V>(method);\n    }\n\n    /**\n     * Create a JavaBean style property from the specified member\n     *\n     * @param <V>\n     * @param member\n     * @return\n     * @throws IllegalArgumentException\n     *             if the method does not match JavaBean conventions\n     * @see http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html\n     */\n    public static <V> Property<V> createProperty(Member member)\n    {\n        if (member instanceof Method)\n        {\n            return new MethodPropertyImpl<V>(Method.class.cast(member));\n        }\n        else if (member instanceof Field)\n        {\n            return new FieldPropertyImpl<V>(Field.class.cast(member));\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Cannot make a property of \" + member\n                    + \" - it is neither a method or a field\");\n        }\n    }\n\n    /**\n     * Indicates whether this method is a valid property method.\n     */\n    public static <V> boolean isProperty(Method method)\n    {\n        try\n        {\n            new MethodPropertyImpl<V>(method);\n            return true;\n        }\n        catch (IllegalArgumentException e)\n        {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/Property.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.lang.reflect.AnnotatedElement;\nimport java.lang.reflect.Member;\nimport java.lang.reflect.Type;\n\n/**\n * A representation of a JavaBean style property\n *\n * @param <V> the type of the properties value\n * @see Properties\n */\npublic interface Property<V>\n{\n    /**\n     * Returns the name of the property. If the property is a field, then the field name is returned. Otherwise, if the\n     * property is a method, then the name that is returned is the getter method name without the \"get\" or \"is\" prefix,\n     * and a lower case first letter.\n     *\n     * @return The name of the property\n     */\n    String getName();\n\n    /**\n     * Returns the property type\n     *\n     * @return The property type\n     */\n    Type getBaseType();\n\n    /**\n     * Returns the property type\n     *\n     * @return The property type\n     */\n    Class<V> getJavaClass();\n\n    /**\n     * Get the element responsible for retrieving the property value\n     *\n     * @return\n     */\n    AnnotatedElement getAnnotatedElement();\n\n    /**\n     * Get the member responsible for retrieving the property value\n     *\n     * @return\n     */\n    Member getMember();\n\n    /**\n     * Returns the property value for the specified bean. The property to be returned is either a field or getter\n     * method.\n     *\n     * @param bean\n     *            The bean to read the property from\n     * @return The property value\n     * @throws ClassCastException\n     *             if the value is not of the type V\n     */\n    V getValue(Object instance);\n\n    /**\n     * This method sets the property value for a specified bean to the specified value. The property to be set is either\n     * a field or setter method.\n     *\n     * @param bean\n     *            The bean containing the property to set\n     * @param value\n     *            The new property value\n     */\n    void setValue(Object instance, V value);\n\n    /**\n     * Returns the class that declares the property\n     *\n     * @return\n     */\n    Class<?> getDeclaringClass();\n\n    /**\n     * Indicates whether this is a read-only property\n     *\n     * @return\n     */\n    boolean isReadOnly();\n\n    /**\n     * Calls the setAccessible method on the underlying member(s).\n     * <p/>\n     * The operation should be performed within a {@link java.security.PrivilegedAction}\n     */\n    void setAccessible();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/Reflections.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.beans.Introspector;\nimport java.io.Serializable;\nimport java.lang.reflect.AccessibleObject;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Utility class for working with JDK Reflection and also CDI's\n * {@link jakarta.enterprise.inject.spi.Annotated} metadata.\n */\npublic class Reflections\n{\n    private Reflections()\n    {\n    }\n\n    /**\n     * <p>\n     * Perform a runtime cast. Similar to {@link Class#cast(Object)}, but useful when you do not have a {@link Class}\n     * object for type you wish to cast to.\n     * </p>\n     * <p/>\n     * <p>\n     * {@link Class#cast(Object)} should be used if possible\n     * </p>\n     *\n     * @param <T>\n     *            the type to cast to\n     * @param obj\n     *            the object to perform the cast on\n     * @return the casted object\n     * @throws ClassCastException\n     *             if the type T is not a subtype of the object\n     * @see Class#cast(Object)\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <T> T cast(Object obj)\n    {\n        return (T) obj;\n    }\n\n    /**\n     * Determine if a method exists in a specified class hierarchy\n     *\n     * @param clazz\n     *            The class to search\n     * @param name\n     *            The name of the method\n     * @return true if a method is found, otherwise false\n     */\n    public static boolean methodExists(Class<?> clazz, String name)\n    {\n        for (Class<?> c = clazz; c != null && c != Object.class; c = c.getSuperclass())\n        {\n            for (Method m : c.getDeclaredMethods())\n            {\n                if (m.getName().equals(name))\n                {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Get all the declared methods on the class hierarchy. This <b>will</b> return overridden methods.\n     *\n     * @param clazz\n     *            The class to search\n     * @return the set of all declared methods or an empty set if there are none\n     */\n    public static Set<Method> getAllDeclaredMethods(Class<?> clazz)\n    {\n        HashSet<Method> methods = new HashSet<Method>();\n        for (Class<?> c = clazz; c != null && c != Object.class; c = c.getSuperclass())\n        {\n            for (Method a : c.getDeclaredMethods())\n            {\n                methods.add(a);\n            }\n        }\n        return methods;\n    }\n\n    /**\n     * Search the class hierarchy for a method with the given name and arguments. Will return the nearest match,\n     * starting with the class specified and searching up the hierarchy.\n     *\n     * @param clazz\n     *            The class to search\n     * @param name\n     *            The name of the method to search for\n     * @param args\n     *            The arguments of the method to search for\n     * @return The method found, or null if no method is found\n     */\n    public static Method findDeclaredMethod(Class<?> clazz, String name, Class<?>... args)\n    {\n        for (Class<?> c = clazz; c != null && c != Object.class; c = c.getSuperclass())\n        {\n            try\n            {\n                return c.getDeclaredMethod(name, args);\n            }\n            catch (NoSuchMethodException e)\n            {\n                // No-op, continue the search\n            }\n        }\n        return null;\n    }\n\n    private static String buildInvokeMethodErrorMessage(Method method, Object obj, Object... args)\n    {\n        StringBuilder message = new StringBuilder(String.format(\n                \"Exception invoking method [%s] on object [%s], using arguments [\", method.getName(), obj));\n        if (args != null)\n        {\n            for (int i = 0; i < args.length; i++)\n            {\n                message.append((i > 0 ? \",\" : \"\") + args[i]);\n            }\n        }\n        message.append(\"]\");\n        return message.toString();\n    }\n\n    /**\n     * Set the accessibility flag on the {@link AccessibleObject} as described in\n     * {@link AccessibleObject#setAccessible(boolean)}.\n     *\n     * @param <A>\n     *            member the accessible object type\n     * @param member\n     *            the accessible object\n     * @return the accessible object after the accessible flag has been altered\n     * @deprecated call method directly as SecurityManager got deprecated and will soon be removed from Java\n     */\n    @Deprecated\n    public static <A extends AccessibleObject> A setAccessible(final A member)\n    {\n        member.setAccessible(true);\n        return member;\n    }\n\n    /**\n     * <p>\n     * Invoke the specified method on the provided instance, passing any additional arguments included in this method as\n     * arguments to the specified method.\n     * </p>\n     * <p/>\n     * <p>\n     * This method provides the same functionality and throws the same exceptions as\n     * {@link Reflections#invokeMethod(boolean, Method, Class, Object, Object...)}, with the expected return type set to\n     * {@link Object} and no change to the method's accessibility.\n     * </p>\n     *\n     * @see Reflections#invokeMethod(boolean, Method, Class, Object, Object...)\n     * @see Method#invoke(Object, Object...)\n     */\n    public static Object invokeMethod(Method method, Object instance, Object... args)\n    {\n        return invokeMethod(false, method, Object.class, instance, args);\n    }\n\n    /**\n     * <p>\n     * Invoke the specified method on the provided instance, passing any additional arguments included in this method as\n     * arguments to the specified method.\n     * </p>\n     * <p/>\n     * <p>\n     * This method attempts to set the accessible flag of the method before invoking the\n     * method if the first argument is true.\n     * </p>\n     * <p/>\n     * <p>\n     * This method provides the same functionality and throws the same exceptions as\n     * {@link Reflections#invokeMethod(boolean, Method, Class, Object, Object...)}, with the expected return type set to\n     * {@link Object}.\n     * </p>\n     *\n     * @see Reflections#invokeMethod(boolean, Method, Class, Object, Object...)\n     * @see Method#invoke(Object, Object...)\n     */\n    public static Object invokeMethod(boolean setAccessible, Method method, Object instance, Object... args)\n    {\n        return invokeMethod(setAccessible, method, Object.class, instance, args);\n    }\n\n    /**\n     * <p>\n     * Invoke the specified method on the provided instance, passing any additional arguments included in this method as\n     * arguments to the specified method.\n     * </p>\n     * <p/>\n     * <p>\n     * This method provides the same functionality and throws the same exceptions as\n     * {@link Reflections#invokeMethod(boolean, Method, Class, Object, Object...)}, with the expected return type set to\n     * {@link Object} and honoring the accessibility of the method.\n     * </p>\n     *\n     * @see Reflections#invokeMethod(boolean, Method, Class, Object, Object...)\n     * @see Method#invoke(Object, Object...)\n     */\n    public static <T> T invokeMethod(Method method, Class<T> expectedReturnType, Object instance, Object... args)\n    {\n        return invokeMethod(false, method, expectedReturnType, instance, args);\n    }\n\n    /**\n     * <p>\n     * Invoke the method on the instance, with any arguments specified, casting the result of invoking the method to the\n     * expected return type.\n     * </p>\n     * <p/>\n     * <p>\n     * This method wraps {@link Method#invoke(Object, Object...)}, converting the checked exceptions that\n     * {@link Method#invoke(Object, Object...)} specifies to runtime exceptions.\n     * </p>\n     * <p/>\n     * <p>\n     * If instructed, this method attempts to set the accessible flag of the method before\n     * invoking the method.\n     * </p>\n     *\n     * @param setAccessible\n     *            flag indicating whether method should first be set as accessible\n     * @param method\n     *            the method to invoke\n     * @param instance\n     *            the instance to invoke the method\n     * @param args\n     *            the arguments to the method\n     * @return the result of invoking the method, or null if the method's return type is void\n     * @throws RuntimeException\n     *             if this <code>Method</code> object enforces Java language access control and the underlying method is\n     *             inaccessible or if the underlying method throws an exception or if the initialization provoked by\n     *             this method fails.\n     * @throws IllegalArgumentException\n     *             if the method is an instance method and the specified <code>instance</code> argument is not an\n     *             instance of the class or interface declaring the underlying method (or of a subclass or implementor\n     *             thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for\n     *             primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to\n     *             the corresponding formal parameter type by a method invocation conversion.\n     * @throws NullPointerException\n     *             if the specified <code>instance</code> is null and the method is an instance method.\n     * @throws ClassCastException\n     *             if the result of invoking the method cannot be cast to the expectedReturnType\n     * @throws ExceptionInInitializerError\n     *             if the initialization provoked by this method fails.\n     * @see Method#invoke(Object, Object...)\n     */\n    public static <T> T invokeMethod(boolean setAccessible, Method method, Class<T> expectedReturnType,\n            Object instance, Object... args)\n    {\n        if (setAccessible && !method.isAccessible())\n        {\n            setAccessible(method);\n        }\n\n        try\n        {\n            return expectedReturnType.cast(method.invoke(instance, args));\n        }\n        catch (IllegalAccessException ex)\n        {\n            throw new RuntimeException(buildInvokeMethodErrorMessage(method, instance, args), ex);\n        }\n        catch (IllegalArgumentException ex)\n        {\n            throw new IllegalArgumentException(buildInvokeMethodErrorMessage(method, instance, args), ex);\n        }\n        catch (InvocationTargetException ex)\n        {\n            throw new RuntimeException(buildInvokeMethodErrorMessage(method, instance, args), ex.getCause());\n        }\n        catch (NullPointerException ex)\n        {\n            NullPointerException ex2 = new NullPointerException(buildInvokeMethodErrorMessage(method, instance, args));\n            ex2.initCause(ex.getCause());\n            throw ex2;\n        }\n        catch (ExceptionInInitializerError e)\n        {\n            ExceptionInInitializerError e2 = new ExceptionInInitializerError(buildInvokeMethodErrorMessage(method,\n                    instance, args));\n            e2.initCause(e.getCause());\n            throw e2;\n        }\n    }\n\n    /**\n     * <p>\n     * Set the value of a field on the instance to the specified value.\n     * </p>\n     * <p/>\n     * <p>\n     * This method provides the same functionality and throws the same exceptions as\n     * {@link Reflections#setFieldValue(boolean, Field, Object, Object)} \n     * </p>\n     */\n    public static void setFieldValue(Field field, Object instance, Object value)\n    {\n        setFieldValue(false, field, instance, value);\n    }\n\n    /**\n     * <p>\n     * Sets the value of a field on the instance to the specified value.\n     * </p>\n     * <p/>\n     * <p>\n     * This method wraps {@link Field#set(Object, Object)}, converting the checked exceptions that\n     * {@link Field#set(Object, Object)} specifies to runtime exceptions.\n     * </p>\n     * <p/>\n     * <p>\n     * If instructed, this method attempts to set the accessible flag of the method before\n     * invoking the method.\n     * </p>\n     *\n     * @param field\n     *            the field on which to operate, or null if the field is static\n     * @param instance\n     *            the instance on which the field value should be set upon\n     * @param value\n     *            the value to set the field to\n     * @throws RuntimeException\n     *             if the underlying field is inaccessible.\n     * @throws IllegalArgumentException\n     *             if the specified <code>instance</code> is not an instance of the class or interface declaring the\n     *             underlying field (or a subclass or implementor thereof), or if an unwrapping conversion fails.\n     * @throws NullPointerException\n     *             if the specified <code>instance</code> is null and the field is an instance field.\n     * @throws ExceptionInInitializerError\n     *             if the initialization provoked by this method fails.\n     * @see Field#set(Object, Object)\n     */\n    public static void setFieldValue(boolean setAccessible, Field field, Object instance, Object value)\n    {\n        if (setAccessible && !field.isAccessible())\n        {\n            setAccessible(field);\n        }\n\n        try\n        {\n            field.set(instance, value);\n        }\n        catch (IllegalAccessException e)\n        {\n            throw new RuntimeException(buildSetFieldValueErrorMessage(field, instance, value), e);\n        }\n        catch (NullPointerException ex)\n        {\n            NullPointerException ex2 = new NullPointerException(buildSetFieldValueErrorMessage(field, instance, value));\n            ex2.initCause(ex.getCause());\n            throw ex2;\n        }\n        catch (ExceptionInInitializerError e)\n        {\n            ExceptionInInitializerError e2 = new ExceptionInInitializerError(buildSetFieldValueErrorMessage(field,\n                    instance, value));\n            e2.initCause(e.getCause());\n            throw e2;\n        }\n    }\n\n    private static String buildSetFieldValueErrorMessage(Field field, Object obj, Object value)\n    {\n        return String.format(\"Exception setting [%s] field on object [%s] to value [%s]\", field.getName(), obj, value);\n    }\n\n    private static String buildGetFieldValueErrorMessage(Field field, Object obj)\n    {\n        return String.format(\"Exception reading [%s] field from object [%s].\", field.getName(), obj);\n    }\n\n    public static Object getFieldValue(Field field, Object instance)\n    {\n        return getFieldValue(field, instance, Object.class);\n    }\n\n    /**\n     * <p>\n     * Get the value of the field, on the specified instance, casting the value of the field to the expected type.\n     * </p>\n     * <p/>\n     * <p>\n     * This method wraps {@link Field#get(Object)}, converting the checked exceptions that {@link Field#get(Object)}\n     * specifies to runtime exceptions.\n     * </p>\n     *\n     * @param <T>\n     *            the type of the field's value\n     * @param field\n     *            the field to operate on\n     * @param instance\n     *            the instance from which to retrieve the value\n     * @param expectedType\n     *            the expected type of the field's value\n     * @return the value of the field\n     * @throws RuntimeException\n     *             if the underlying field is inaccessible.\n     * @throws IllegalArgumentException\n     *             if the specified <code>instance</code> is not an instance of the class or interface declaring the\n     *             underlying field (or a subclass or implementor thereof).\n     * @throws NullPointerException\n     *             if the specified <code>instance</code> is null and the field is an instance field.\n     * @throws ExceptionInInitializerError\n     *             if the initialization provoked by this method fails.\n     */\n    public static <T> T getFieldValue(Field field, Object instance, Class<T> expectedType)\n    {\n        try\n        {\n            return Reflections.cast(field.get(instance));\n        }\n        catch (IllegalAccessException e)\n        {\n            throw new RuntimeException(buildGetFieldValueErrorMessage(field, instance), e);\n        }\n        catch (NullPointerException ex)\n        {\n            NullPointerException ex2 = new NullPointerException(buildGetFieldValueErrorMessage(field, instance));\n            ex2.initCause(ex.getCause());\n            throw ex2;\n        }\n        catch (ExceptionInInitializerError e)\n        {\n            ExceptionInInitializerError e2 = new ExceptionInInitializerError(buildGetFieldValueErrorMessage(field,\n                    instance));\n            e2.initCause(e.getCause());\n            throw e2;\n        }\n    }\n\n    /**\n     * Check if a class is serializable.\n     *\n     * @param clazz\n     *            The class to check\n     * @return true if the class implements serializable or is a primitive\n     */\n    public static boolean isSerializable(Class<?> clazz)\n    {\n        return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);\n    }\n\n    /**\n     * Gets the property name from a getter method.\n     * <p/>\n     * We extend JavaBean conventions, allowing the getter method to have parameters\n     *\n     * @param method\n     *            The getter method\n     * @return The name of the property. Returns null if method wasn't JavaBean getter-styled\n     */\n    public static String getPropertyName(Method method)\n    {\n        String methodName = method.getName();\n        if (methodName.matches(\"^(get).*\"))\n        {\n            return Introspector.decapitalize(methodName.substring(3));\n        }\n        else if (methodName.matches(\"^(is).*\"))\n        {\n            return Introspector.decapitalize(methodName.substring(2));\n        }\n        else\n        {\n            return null;\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/AnnotatedPropertyCriteria.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\n/**\n * A criteria that matches a property based on its annotations\n * @see PropertyCriteria\n */\npublic class AnnotatedPropertyCriteria implements PropertyCriteria\n{\n    private final Class<? extends Annotation> annotationClass;\n\n    public AnnotatedPropertyCriteria(Class<? extends Annotation> annotationClass)\n    {\n        this.annotationClass = annotationClass;\n    }\n\n    @Override\n    public boolean fieldMatches(Field f)\n    {\n        return f.isAnnotationPresent(annotationClass);\n    }\n\n    @Override\n    public boolean methodMatches(Method m)\n    {\n        return m.isAnnotationPresent(annotationClass);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/NamedPropertyCriteria.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\nimport java.beans.Introspector;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\n/**\n * A criteria that matches a property based on name\n * @see PropertyCriteria\n */\npublic class NamedPropertyCriteria implements PropertyCriteria\n{\n    private final String[] propertyNames;\n\n    public NamedPropertyCriteria(String... propertyNames)\n    {\n        this.propertyNames = propertyNames;\n    }\n\n    @Override\n    public boolean fieldMatches(Field f)\n    {\n        for (String propertyName : propertyNames)\n        {\n            if (propertyName.equals(f.getName()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public boolean methodMatches(Method m)\n    {\n        for (String propertyName : propertyNames)\n        {\n            if (m.getName().startsWith(\"get\") &&\n                    Introspector.decapitalize(m.getName().substring(3)).equals(propertyName))\n            {\n                return true;\n            }\n\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/PropertyCriteria.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\n/**\n * <p>\n * A property criteria can be used to filter the properties found by a {@link PropertyQuery}\n * </p>\n * <p/>\n * <p>\n * Solder provides a number of property queries ( {@link TypedPropertyCriteria}, {@link NamedPropertyCriteria} and\n * {@link AnnotatedPropertyCriteria}), or you can create a custom query by implementing this interface.\n * </p>\n *\n * @see PropertyQuery#addCriteria(PropertyCriteria)\n * @see PropertyQueries\n * @see TypedPropertyCriteria\n * @see AnnotatedPropertyCriteria\n * @see NamedPropertyCriteria\n */\npublic interface PropertyCriteria\n{\n    /**\n     * Tests whether the specified field matches the criteria\n     *\n     * @param f\n     * @return true if the field matches\n     */\n    boolean fieldMatches(Field f);\n\n    /**\n     * Tests whether the specified method matches the criteria\n     *\n     * @param m\n     * @return true if the method matches\n     */\n    boolean methodMatches(Method m);\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/PropertyQueries.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\n/**\n * Utilities for working with property queries\n *\n * @see PropertyQuery\n */\npublic class PropertyQueries\n{\n\n    private PropertyQueries()\n    {\n    }\n\n    /**\n     * Create a new {@link PropertyQuery}\n     *\n     * @param <V>\n     * @param targetClass\n     * @return\n     */\n    public static <V> PropertyQuery<V> createQuery(Class<?> targetClass)\n    {\n        return new PropertyQuery<V>(targetClass);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/PropertyQuery.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.deltaspike.data.impl.property.MethodProperty;\nimport org.apache.deltaspike.data.impl.property.Properties;\nimport org.apache.deltaspike.data.impl.property.Property;\n\n/**\n * <p>\n * Queries a target class for properties that match certain criteria. A property may either be a private or public\n * field, declared by the target class or inherited from a superclass, or a public method declared by the target class\n * or inherited from any of its superclasses. For properties that are exposed via a method, the property must be a\n * JavaBean style property, i.e. it must provide both an accessor and mutator method according to the JavaBean\n * specification.\n * </p>\n * <p/>\n * <p>\n * This class is not thread-safe, however the result returned by the getResultList() method is.\n * </p>\n *\n * @see PropertyQueries\n * @see PropertyCriteria\n */\npublic class PropertyQuery<V>\n{\n    private final Class<?> targetClass;\n    private final List<PropertyCriteria> criteria;\n\n    PropertyQuery(Class<?> targetClass)\n    {\n        if (targetClass == null)\n        {\n            throw new IllegalArgumentException(\"targetClass parameter may not be null\");\n        }\n\n        this.targetClass = targetClass;\n        this.criteria = new ArrayList<PropertyCriteria>();\n    }\n\n    /**\n     * Add a criteria to query\n     *\n     * @param criteria\n     *            the criteria to add\n     */\n    public PropertyQuery<V> addCriteria(PropertyCriteria criteria)\n    {\n        this.criteria.add(criteria);\n        return this;\n    }\n\n    /**\n     * Get the first result from the query, causing the query to be run.\n     *\n     * @return the first result, or null if there are no results\n     */\n    public Property<V> getFirstResult()\n    {\n        List<Property<V>> results = getResultList();\n        return results.isEmpty() ? null : results.get(0);\n    }\n\n    /**\n     * Get the first result from the query that is not marked as read only, causing the query to be run.\n     *\n     * @return the first writable result, or null if there are no results\n     */\n    public Property<V> getFirstWritableResult()\n    {\n        List<Property<V>> results = getWritableResultList();\n        return results.isEmpty() ? null : results.get(0);\n    }\n\n    /**\n     * Get a single result from the query, causing the query to be run. An exception is thrown if the query does not\n     * return exactly one result.\n     *\n     * @return the single result\n     * @throws RuntimeException\n     *             if the query does not return exactly one result\n     */\n    public Property<V> getSingleResult()\n    {\n        List<Property<V>> results = getResultList();\n        if (results.size() == 1)\n        {\n            return results.get(0);\n        }\n        else if (results.isEmpty())\n        {\n            throw new RuntimeException(\"Expected one property match, but the criteria did not match any properties on \"\n                    + targetClass.getName());\n        }\n        else\n        {\n            throw new RuntimeException(\"Expected one property match, but the criteria matched \" + results.size()\n                    + \" properties on \" + targetClass.getName());\n        }\n    }\n\n    /**\n     * Get a single result from the query that is not marked as read only, causing the query to be run. An exception is\n     * thrown if the query does not return exactly one result.\n     *\n     * @return the single writable result\n     * @throws RuntimeException\n     *             if the query does not return exactly one result\n     */\n    public Property<V> getWritableSingleResult()\n    {\n        List<Property<V>> results = getWritableResultList();\n        if (results.size() == 1)\n        {\n            return results.get(0);\n        }\n        else if (results.isEmpty())\n        {\n            throw new RuntimeException(\"Expected one property match, but the criteria did not match any properties on \"\n                    + targetClass.getName());\n        }\n        else\n        {\n            throw new RuntimeException(\"Expected one property match, but the criteria matched \" + results.size()\n                    + \" properties on \" + targetClass.getName());\n        }\n    }\n\n    /**\n     * Get the result from the query, causing the query to be run.\n     *\n     * @return the results, or an empty list if there are no results\n     */\n    public List<Property<V>> getResultList()\n    {\n        return getResultList(false);\n    }\n\n    /**\n     * Get the non read only results from the query, causing the query to be run.\n     *\n     * @return the results, or an empty list if there are no results\n     */\n    public List<Property<V>> getWritableResultList()\n    {\n        return getResultList(true);\n    }\n\n    /**\n     * Get the result from the query, causing the query to be run.\n     *\n     * @param writable\n     *            if this query should only return properties that are not read only\n     * @return the results, or an empty list if there are no results\n     */\n    private List<Property<V>> getResultList(boolean writable)\n    {\n        List<Property<V>> results = new ArrayList<Property<V>>();\n\n        // First check public accessor methods (we ignore private methods)\n        for (Method method : targetClass.getMethods())\n        {\n            if (!(method.getName().startsWith(\"is\") || method.getName().startsWith(\"get\")))\n            {\n                continue;\n            }\n\n            boolean match = true;\n            for (PropertyCriteria c : criteria)\n            {\n                if (!c.methodMatches(method))\n                {\n                    match = false;\n                    break;\n                }\n            }\n            if (match)\n            {\n                MethodProperty<V> property = Properties.<V> createProperty(method);\n                if (!writable || !property.isReadOnly())\n                {\n                    results.add(property);\n                }\n            }\n        }\n\n        Class<?> cls = targetClass;\n        while (cls != null && !cls.equals(Object.class))\n        {\n            // Now check declared fields\n            for (Field field : cls.getDeclaredFields())\n            {\n                boolean match = true;\n                for (PropertyCriteria c : criteria)\n                {\n                    if (!c.fieldMatches(field))\n                    {\n                        match = false;\n                        break;\n                    }\n                }\n                Property<V> prop = Properties.<V> createProperty(field);\n\n                if (match && !resultsContainsProperty(results, prop.getName()))\n                {\n                    if (!writable || !prop.isReadOnly())\n                    {\n                        results.add(prop);\n                    }\n                }\n            }\n\n            cls = cls.getSuperclass();\n        }\n\n        return results;\n    }\n\n    private boolean resultsContainsProperty(List<Property<V>> results, String propertyName)\n    {\n        for (Property<V> p : results)\n        {\n            if (propertyName.equals(p.getName()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/TypedPropertyCriteria.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\n/**\n * A criteria that matches a property based on its type\n *\n * @see PropertyCriteria\n */\npublic class TypedPropertyCriteria implements PropertyCriteria\n{\n    private final Class<?> propertyClass;\n\n    public TypedPropertyCriteria(Class<?> propertyClass)\n    {\n        this.propertyClass = propertyClass;\n    }\n\n    @Override\n    public boolean fieldMatches(Field f)\n    {\n        return propertyClass.equals(f.getType());\n    }\n\n    @Override\n    public boolean methodMatches(Method m)\n    {\n        return propertyClass.equals(m.getReturnType());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/tx/InvocationContextWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.tx;\n\nimport org.apache.deltaspike.core.util.interceptor.AbstractInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\n\npublic abstract class InvocationContextWrapper extends AbstractInvocationContext<Object>\n{\n    public InvocationContextWrapper(CdiQueryInvocationContext context)\n    {\n        super(context.getProxy(), context.getMethod(), context.getMethodParameters(), null);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/tx/ThreadLocalEntityManagerHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.tx;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.jpa.impl.entitymanager.DefaultEntityManagerHolder;\n\n@Specializes\n@ApplicationScoped\npublic class ThreadLocalEntityManagerHolder extends DefaultEntityManagerHolder\n{\n\n    private static final long serialVersionUID = 1L;\n\n    private final ThreadLocal<EntityManager> holder = new ThreadLocal<EntityManager>();\n\n    @Override\n    public void set(EntityManager entityManager)\n    {\n        holder.set(entityManager);\n    }\n\n    @Override\n    public boolean isSet()\n    {\n        return get() != null;\n    }\n\n    @Override\n    public EntityManager get()\n    {\n        return holder.get();\n    }\n\n    @Override\n    public void dispose()\n    {\n        holder.remove();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/tx/TransactionalQueryRunner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.tx;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\nimport org.apache.deltaspike.data.impl.handler.QueryRunner;\nimport org.apache.deltaspike.jpa.spi.entitymanager.ActiveEntityManagerHolder;\nimport org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy;\n\n@ApplicationScoped\npublic class TransactionalQueryRunner implements QueryRunner\n{\n\n    @Inject\n    private TransactionStrategy strategy;\n\n    @Inject\n    private ActiveEntityManagerHolder activeEntityManagerHolder;\n\n    @Override\n    public Object executeQuery(final QueryBuilder builder, final CdiQueryInvocationContext context)\n        throws Throwable\n    {\n        if (context.getRepositoryMethodMetadata().isRequiresTransaction())\n        {\n            try\n            {\n                activeEntityManagerHolder.set(context.getEntityManager());\n                return executeTransactional(builder, context);\n            }\n            finally\n            {\n                activeEntityManagerHolder.dispose();\n            }\n        }\n        return executeNonTransactional(builder, context);\n    }\n\n    protected Object executeNonTransactional(final QueryBuilder builder, final CdiQueryInvocationContext context)\n    {\n        return builder.executeQuery(context);\n    }\n\n    protected Object executeTransactional(final QueryBuilder builder, final CdiQueryInvocationContext context)\n        throws Exception\n    {\n        return strategy.execute(new InvocationContextWrapper(context)\n        {\n            @Override\n            public Object proceed() throws Exception\n            {\n                return builder.executeQuery(context);\n            }\n        });\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util;\n\nimport java.io.Serializable;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport jakarta.persistence.EmbeddedId;\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.IdClass;\nimport jakarta.persistence.Table;\nimport jakarta.persistence.Version;\nimport jakarta.persistence.metamodel.EntityType;\nimport org.apache.deltaspike.core.util.StringUtils;\n\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.apache.deltaspike.data.impl.property.query.AnnotatedPropertyCriteria;\nimport org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria;\nimport org.apache.deltaspike.data.impl.property.query.PropertyCriteria;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQueries;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQuery;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptorProvider;\n\npublic final class EntityUtils\n{\n\n    private EntityUtils()\n    {\n    }\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    public static Class<? extends Serializable> primaryKeyClass(Class<?> entityClass)\n    {\n        if (entityClass.isAnnotationPresent(IdClass.class))\n        {\n            return entityClass.getAnnotation(IdClass.class).value(); // Serializablity isn't required, could cause\n                                                                     // problems\n        }\n        Class clazz = PersistenceUnitDescriptorProvider.getInstance().primaryKeyIdClass(entityClass);\n        if (clazz != null)\n        {\n            return clazz;\n        }\n        Property<Serializable> property = primaryKeyProperty(entityClass);\n        return property.getJavaClass();\n    }\n\n    public static Object primaryKeyValue(Object entity)\n    {\n        Property<Serializable> property = primaryKeyProperty(entity.getClass());\n        return primaryKeyValue(entity, property);\n    }\n\n    public static Object primaryKeyValue(Object entity, Property<Serializable> primaryKeyProperty)\n    {\n        return primaryKeyProperty.getValue(entity);\n    }\n    \n    public static String entityName(Class<?> entityClass)\n    {\n        String result = null;\n        if (entityClass.isAnnotationPresent(Entity.class))\n        {\n            result = entityClass.getAnnotation(Entity.class).name();\n        }\n        else\n        {\n            result = PersistenceUnitDescriptorProvider.getInstance().entityName(entityClass);\n        }\n        return (result != null && !\"\".equals(result)) ? result : entityClass.getSimpleName();\n    }\n\n    public static String tableName(Class<?> entityClass, EntityManager entityManager)\n    {\n        String tableName = PersistenceUnitDescriptorProvider.getInstance().entityTableName(entityClass);\n        if (StringUtils.isEmpty(tableName))\n        {\n            Table tableAnnotation = entityClass.getAnnotation(Table.class);\n            if (tableAnnotation != null && StringUtils.isNotEmpty(tableAnnotation.name()))\n            {\n                return tableAnnotation.name();\n            }\n\n            EntityType<?> entityType = entityManager.getMetamodel().entity(entityClass);\n            return entityType.getName();\n        }\n        return tableName;\n    }\n\n    public static boolean isEntityClass(Class<?> entityClass)\n    {\n        return entityClass.isAnnotationPresent(Entity.class)\n                || PersistenceUnitDescriptorProvider.getInstance().isEntity(entityClass);\n    }\n\n    public static Property<Serializable> primaryKeyProperty(Class<?> entityClass)\n    {\n        for (PropertyCriteria c : primaryKeyPropertyCriteriaList(entityClass))\n        {\n            PropertyQuery<Serializable> query = PropertyQueries.<Serializable> createQuery(entityClass)\n                    .addCriteria(c);\n            if (query.getFirstResult() != null)\n            {\n                return query.getFirstResult();\n            }\n        }\n        throw new IllegalStateException(\"Class \" + entityClass + \" has no id defined\");\n    }\n\n    private static List<PropertyCriteria> primaryKeyPropertyCriteriaList(Class<?> entityClass)\n    {\n        List<PropertyCriteria> criteria = new LinkedList<PropertyCriteria>();\n        criteria.add(new AnnotatedPropertyCriteria(Id.class));\n        criteria.add(new AnnotatedPropertyCriteria(EmbeddedId.class));\n        String[] fromMappingFiles = PersistenceUnitDescriptorProvider.getInstance().primaryKeyFields(entityClass);\n        if (fromMappingFiles != null)\n        {\n            for (String id : fromMappingFiles)\n            {\n                criteria.add(new NamedPropertyCriteria(id));\n            }\n        }\n        return criteria;\n    }\n\n    public static Property<Serializable> getVersionProperty(Class<?> entityClass)\n    {\n        List<PropertyCriteria> criteriaList = new LinkedList<PropertyCriteria>();\n        criteriaList.add(new AnnotatedPropertyCriteria(Version.class));\n\n        String fromMappingFiles = PersistenceUnitDescriptorProvider.getInstance().versionField(entityClass);\n        if (fromMappingFiles != null)\n        {\n            criteriaList.add(new NamedPropertyCriteria(fromMappingFiles));\n        }\n\n        for (PropertyCriteria criteria : criteriaList)\n        {\n            PropertyQuery<Serializable> query =\n                PropertyQueries.<Serializable> createQuery(entityClass).addCriteria(criteria);\n            Property<Serializable> result = query.getFirstResult();\n            if (result != null)\n            {\n                return result;\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/QueryUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util;\n\nimport java.text.MessageFormat;\nimport org.apache.deltaspike.core.util.StringUtils;\n\npublic final class QueryUtils\n{\n    private static final String KEYWORD_SPLITTER = \"({0})(?=[A-Z])\";\n\n    private QueryUtils()\n    {\n    }\n\n    public static String[] splitByKeyword(String query, String keyword)\n    {\n        return query.split(MessageFormat.format(KEYWORD_SPLITTER, keyword));\n    }\n\n    public static String uncapitalize(String value)\n    {\n        if (StringUtils.isEmpty(value))\n        {\n            return null;\n        }\n        if (value.length() == 1)\n        {\n            return value.toLowerCase();\n        }\n        return value.substring(0, 1).toLowerCase() + value.substring(1);\n    }\n\n    public static boolean isString(Object value)\n    {\n        return value != null && value instanceof String;\n    }\n\n    public static String nullSafeValue(String value)\n    {\n        return nullSafeValue(value, null);\n    }\n\n    public static String nullSafeValue(String value, String fallback)\n    {\n        return value != null ? value : (fallback != null ? fallback : \"\");\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/bean/BeanDestroyable.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.bean;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\n\npublic class BeanDestroyable<T> implements Destroyable\n{\n\n    private final Bean<T> bean;\n    private final T instance;\n    private final CreationalContext<T> creationalContext;\n\n    public BeanDestroyable(Bean<T> bean, T instance, CreationalContext<T> creationalContext)\n    {\n        this.bean = bean;\n        this.instance = instance;\n        this.creationalContext = creationalContext;\n    }\n\n    @Override\n    public void destroy()\n    {\n        bean.destroy(instance, creationalContext);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/bean/DependentProviderDestroyable.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.bean;\n\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\n\npublic class DependentProviderDestroyable implements Destroyable\n{\n\n    private final DependentProvider<?> dependent;\n\n    public DependentProviderDestroyable(DependentProvider<?> dependent)\n    {\n        this.dependent = dependent;\n    }\n\n    @Override\n    public void destroy()\n    {\n        dependent.destroy();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/bean/Destroyable.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.bean;\n\npublic interface Destroyable\n{\n    void destroy();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/BaseQueryStringExtractor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\nimport java.lang.reflect.Method;\n\npublic abstract class BaseQueryStringExtractor implements QueryStringExtractor\n{\n\n    Object invoke(String methodName, Object target)\n    {\n        try\n        {\n            Method method = target.getClass().getMethod(methodName);\n            return method.invoke(target);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/EclipseLinkEjbQueryStringExtractor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\n@ProviderSpecific(\"org.eclipse.persistence.jpa.JpaQuery\")\npublic class EclipseLinkEjbQueryStringExtractor extends BaseQueryStringExtractor\n{\n\n    @Override\n    public String extractFrom(Object query)\n    {\n        Object dbQuery = invoke(\"getDatabaseQuery\", query);\n        return (String) invoke(\"getJPQLString\", dbQuery);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/Hibernate6QueryStringExtractor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\n@ProviderSpecific(\"org.hibernate.query.Query\")\npublic class Hibernate6QueryStringExtractor extends BaseQueryStringExtractor\n{\n\n    @Override\n    public String extractFrom(Object query)\n    {\n        return (String) invoke(\"getQueryString\", query);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/HibernateQueryStringExtractor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\n@ProviderSpecific(\"org.hibernate.ejb.HibernateQuery\")\npublic class HibernateQueryStringExtractor extends BaseQueryStringExtractor\n{\n\n    @Override\n    public String extractFrom(Object query)\n    {\n        Object hibernateQuery = invoke(\"getHibernateQuery\", query);\n        return (String) invoke(\"getQueryString\", hibernateQuery);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/OpenJpaPersistenceUnitUtilDelegate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\nimport org.apache.deltaspike.data.impl.util.EntityUtils;\n\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.PersistenceUnitUtil;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\npublic class OpenJpaPersistenceUnitUtilDelegate implements PersistenceUnitUtil\n{\n    private final PersistenceUnitUtil persistenceUnitUtil;\n    private final EntityManager entityManager;\n\n    public OpenJpaPersistenceUnitUtilDelegate(EntityManager entityManager)\n    {\n        this.persistenceUnitUtil = entityManager.getEntityManagerFactory().getPersistenceUnitUtil();\n        this.entityManager = entityManager;\n    }\n\n    @Override\n    public boolean isLoaded(Object entity, String attributeName)\n    {\n        return persistenceUnitUtil.isLoaded(entity, attributeName);\n    }\n\n    @Override\n    public boolean isLoaded(Object entity)\n    {\n        return persistenceUnitUtil.isLoaded(entity);\n    }\n\n    @Override\n    public Object getIdentifier(Object entity)\n    {\n        final String methodName = \"getIdObject\";\n        try\n        {\n            if (!entityManager.contains(entity))\n            {\n                entity = entityManager.getReference(entity.getClass(), EntityUtils.primaryKeyValue(entity));\n            }\n\n            final Object identifier = persistenceUnitUtil.getIdentifier(entity);\n            if (identifier != null)\n            {\n                final Method method;\n\n                method = identifier.getClass().getMethod(methodName);\n                return method.invoke(identifier);\n            }\n        }\n        catch (NoSuchMethodException e)\n        {\n            throw new RuntimeException(e);\n        }\n        catch (InvocationTargetException e)\n        {\n            throw new RuntimeException(e);\n        }\n        catch (IllegalAccessException e)\n        {\n            throw new RuntimeException(e);\n        }\n        catch (IllegalStateException e)\n        {\n            return null;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/OpenJpaQueryStringExtractor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\n@ProviderSpecific(\"org.apache.openjpa.persistence.OpenJPAQuery\")\npublic class OpenJpaQueryStringExtractor extends BaseQueryStringExtractor\n{\n    @Override\n    public String extractFrom(Object query)\n    {\n        return (String) invoke(\"getQueryString\", query);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/PersistenceUnitUtilDelegateFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.PersistenceUnitUtil;\n\npublic class PersistenceUnitUtilDelegateFactory\n{\n    private PersistenceUnitUtilDelegateFactory()\n    {\n    }\n\n    public static PersistenceUnitUtil get(EntityManager entityManager)\n    {\n        final EntityManagerFactory entityManagerFactory = entityManager.getEntityManagerFactory();\n        final String vendorName = (String) entityManagerFactory.getProperties().get(\"VendorName\");\n        if (vendorName != null && \"openjpa\".equalsIgnoreCase(vendorName))\n        {\n            return new OpenJpaPersistenceUnitUtilDelegate(entityManager);\n        }\n        return entityManagerFactory.getPersistenceUnitUtil();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/ProviderSpecific.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\n@Target({ TYPE })\n@Retention(RUNTIME)\npublic @interface ProviderSpecific\n{\n\n    String value();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/QueryStringExtractor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\npublic interface QueryStringExtractor\n{\n\n    String extractFrom(Object query);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/jpa/QueryStringExtractorFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.persistence.Query;\n\n@ApplicationScoped\npublic class QueryStringExtractorFactory\n{\n    private final QueryStringExtractor[] extractors = new QueryStringExtractor[]\n    {\n        new HibernateQueryStringExtractor(),\n        new Hibernate6QueryStringExtractor(),\n        new EclipseLinkEjbQueryStringExtractor(),\n        new OpenJpaQueryStringExtractor()\n    };\n\n    public String extract(final Query query)\n    {\n        for (final QueryStringExtractor extractor : extractors)\n        {\n            final String compare = extractor.getClass().getAnnotation(ProviderSpecific.class).value();\n            final Object implQuery = toImplQuery(compare, query);\n            if (implQuery != null)\n            {\n                return extractor.extractFrom(implQuery);\n            }\n        }\n        throw new RuntimeException(\"Persistence provider not supported\");\n    }\n\n    private static Object toImplQuery(final String clazzName, final Query query)\n    {\n        try\n        {\n            Class<?> toClass = Class.forName(clazzName);\n            try\n            {\n                // throw a persistence exception if not possible\n                return query.unwrap(toClass);\n            }\n            catch (Exception e)\n            {\n                toClass.cast(query);\n                return query;\n            }\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--\r\n  ~ Licensed to the Apache Software Foundation (ASF) under one\r\n  ~ or more contributor license agreements. See the NOTICE file\r\n  ~ distributed with this work for additional information\r\n  ~ regarding copyright ownership. The ASF licenses this file\r\n  ~ to you under the Apache License, Version 2.0 (the\r\n  ~ \"License\"); you may not use this file except in compliance\r\n  ~ with the License. You may obtain a copy of the License at\r\n  ~\r\n  ~ http://www.apache.org/licenses/LICENSE-2.0\r\n  ~\r\n  ~ Unless required by applicable law or agreed to in writing,\r\n  ~ software distributed under the License is distributed on an\r\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n  ~ KIND, either express or implied. See the License for the\r\n  ~ specific language governing permissions and limitations\r\n  ~ under the License.\r\n  -->\r\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\r\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\r\n       version=\"3.0\" bean-discovery-mode=\"all\">\r\n    <trim/>\r\n</beans>\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.data.impl.RepositoryExtension"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/DisabledRepositoryTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.test.service.DisabledRepository;\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class DisabledRepositoryTest\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        WebArchive archive = initDeployment()\n                .addClasses(SimpleRepository.class,\n                        RepositoryDeactivator.class,\n                        DisabledRepository.class\n                );\n\n        archive.delete(\"WEB-INF/classes/META-INF/apache-deltaspike.properties\");\n        archive.addAsWebInfResource(\"disabled/META-INF/apache-deltaspike.properties\",\n                \"classes/META-INF/apache-deltaspike.properties\");\n        return archive;\n    }\n\n    @Inject\n    private SimpleRepository simpleRepository;\n\n    @Inject\n    private DisabledRepository disabledRepository;\n\n    @Test\n    public void disabledSimpleRepository()\n    {\n        try\n        {\n            simpleRepository.findAll();\n            Assert.fail(\"Should have been failed because SimpleRepository was disabled\");\n        }\n        catch (RuntimeException e)\n        {\n            Assert.assertNotNull(e);\n        }\n\n    }\n\n    @Test\n    public void disabledRepository()\n    {\n        try\n        {\n            disabledRepository.findAll();\n            Assert.fail(\"Should have been failed because DisabledRepository was disabled\");\n        }\n        catch (RuntimeException e)\n        {\n            Assert.assertNotNull(e);\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/QueryResultTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\n\nimport java.util.List;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.NonUniqueResultException;\n\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.*;\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class QueryResultTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(SimpleRepository.class)\n                .addPackage(Simple.class.getPackage());\n    }\n\n    @Inject\n    private SimpleRepository repo;\n\n    private SimpleBuilder builder;\n\n    @Test\n    public void should_sort_result()\n    {\n        // given\n        final String name = \"testSortResult\";\n        builder.createSimple(name, Integer.valueOf(99));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(56));\n        builder.createSimple(name, Integer.valueOf(123));\n\n        // when\n        List<Simple> result = repo.findByName(name)\n                .orderDesc(Simple_.counter)\n                .orderAsc(Simple_.id)\n                .getResultList();\n\n        // then\n        assertNotNull(result);\n        assertFalse(result.isEmpty());\n        int lastCounter = Integer.MAX_VALUE;\n        long lastId = Long.MIN_VALUE;\n        for (Simple simple : result)\n        {\n            int currentCounter = simple.getCounter().intValue();\n            long currentId = simple.getId().longValue();\n            if (currentCounter == lastCounter)\n            {\n                assertTrue(currentId > lastId);\n            }\n            else\n            {\n                assertTrue(currentCounter < lastCounter);\n            }\n            lastCounter = currentCounter;\n            lastId = currentId;\n        }\n    }\n\n    @Test\n    public void should_change_sort_order()\n    {\n        // given\n        final String name = \"testChangeSortOrder\";\n        builder.createSimple(name, Integer.valueOf(99));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(229));\n\n        // when\n        QueryResult<Simple> query = repo.findByName(name);\n        List<Simple> result1 = query\n                .changeOrder(Simple_.counter)\n                .getResultList();\n        List<Simple> result2 = query\n                .changeOrder(Simple_.counter)\n                .getResultList();\n\n        // then\n        assertEquals(22, result1.get(0).getCounter().intValue());\n        assertEquals(229, result2.get(0).getCounter().intValue());\n    }\n\n    @Test\n    public void should_clear_sort_order()\n    {\n        // given\n        final String name = \"testClearSortOrder\";\n        builder.createSimple(name, Integer.valueOf(99));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(229));\n\n        // when\n        QueryResult<Simple> query = repo.findByName(name);\n        List<Simple> result1 = query\n                .changeOrder(Simple_.counter)\n                .getResultList();\n        List<Simple> result2 = query\n                .clearOrder()\n                .getResultList();\n\n        // then\n        assertEquals(result1.size(), result2.size());\n        for (int i = 0; i < result1.size(); i++)\n        {\n            int count1 = result1.get(i).getCounter().intValue();\n            int count2 = result2.get(i).getCounter().intValue();\n            if (count1 != count2)\n            {\n                return;\n            }\n        }\n        fail(\"Both collections sorted: \" + result1 + \",\" + result2);\n    }\n\n    @Test\n    public void should_page_result()\n    {\n        // given\n        final String name = \"testPageResult\";\n        builder.createSimple(name, Integer.valueOf(99));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(56));\n        builder.createSimple(name, Integer.valueOf(123));\n\n        // when\n        List<Simple> result = repo.findByName(name)\n                .hint(\"jakarta.persistence.query.timeout\", 10000)\n                .lockMode(LockModeType.NONE)\n                .flushMode(FlushModeType.COMMIT)\n                .orderDesc(Simple_.counter)\n                .firstResult(2)\n                .maxResults(2)\n                .getResultList();\n\n        // then\n        assertNotNull(result);\n        assertFalse(result.isEmpty());\n        assertEquals(2, result.size());\n    }\n\n    @Test\n    public void should_page_with_page_api()\n    {\n        // given\n        final String name = \"testPageAPI\";\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(56));\n        builder.createSimple(name, Integer.valueOf(99));\n        builder.createSimple(name, Integer.valueOf(123));\n        builder.createSimple(name, Integer.valueOf(229));\n        builder.createSimple(name, Integer.valueOf(299));\n        builder.createSimple(name, Integer.valueOf(389));\n\n        // when\n        QueryResult<Simple> pagedQuery = repo\n                .findByName(name)\n                .withPageSize(2);\n        List<Simple> result1 = pagedQuery.getResultList();\n        List<Simple> result2 = pagedQuery.nextPage().nextPage().getResultList();\n        int current = pagedQuery.currentPage();\n        List<Simple> result3 = pagedQuery.toPage(1).getResultList();\n        int total = pagedQuery.countPages();\n        int pageSize = pagedQuery.pageSize();\n\n        // then\n        assertEquals(2, result1.size());\n        assertEquals(2, result2.size());\n        assertEquals(2, result3.size());\n        assertEquals(2, current);\n        assertEquals(4, total);\n        assertEquals(2, pageSize);\n\n        assertEquals(22, result1.get(0).getCounter().intValue());\n        assertEquals(229, result2.get(0).getCounter().intValue());\n        assertEquals(99, result3.get(0).getCounter().intValue());\n\n    }\n\n    @Test\n    public void should_modify_named_query()\n    {\n        // given\n        final String name = \"testModifyNamedQuery\";\n        builder.createSimple(name + 0);\n        builder.createSimple(name + 1);\n        builder.createSimple(name + 2);\n        builder.createSimple(name + 3);\n\n        // when\n        List<Simple> result = repo.queryResultWithNamed(name + \"%\")\n                .orderDesc(Simple_.name)\n                .getResultList();\n\n        // then\n        assertEquals(4, result.size());\n        assertEquals(name + 3, result.get(0).getName());\n        assertEquals(name + 2, result.get(1).getName());\n    }\n\n    @Test\n    public void should_count_with_method_query()\n    {\n        // given\n        final String name = \"testCountWithMethodQuery\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        long result = repo.findByName(name).count();\n\n        // then\n        assertEquals(2L, result);\n    }\n\n    @Test\n    public void should_count_with_named_query()\n    {\n        // given\n        final String name = \"testCountWithNamedQuery\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        long result = repo.queryResultWithNamed(name).count();\n\n        // then\n        assertEquals(2L, result);\n    }\n\n    @Test\n    public void should_count_without_whereclause()\n    {\n        // given\n        final String name = \"testCountWithoutWhereclause\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        long result = repo.queryAll().count();\n\n        // then\n        assertEquals(2L, result);\n    }\n\n    @Test\n    public void should_count_with_orderby()\n    {\n        // given\n        final String name = \"testCountWithOrderBy\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        long result = repo.findByQueryWithOrderBy(name).count();\n\n        // then\n        assertEquals(2L, result);\n    }\n\n    @Test\n    public void should_query_optional()\n    {\n        // given\n        final String name = \"should_query_optional\";\n        builder.createSimple(name);\n\n        // when\n        Simple result1 = repo.queryResultWithNamed(name).getOptionalResult();\n        Simple result2 = repo.queryResultWithNamed(\"this_does_not_exist\").getOptionalResult();\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test(expected = NonUniqueResultException.class)\n    public void should_fail_query_optional_with_nonunique()\n    {\n        // given\n        final String name = \"should_fail_query_optional_with_nonunique\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        repo.queryResultWithNamed(name).getOptionalResult();\n    }\n\n    @Test\n    public void should_query_any()\n    {\n        // given\n        final String name = \"should_query_any\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        Simple result1 = repo.queryResultWithNamed(name).getAnyResult();\n        Simple result2 = repo.queryResultWithNamed(\"this_does_not_exist\").getAnyResult();\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test\n    public void should_paginate_with_orderby()\n    {\n        // given\n        SimpleStringIdBuilder builder = new SimpleStringIdBuilder(getEntityManager());\n\n\n        final String name = \"should_paginate_with_orderby\";\n        final String name2 = \"should_paginate_with_orderby2\";\n        builder.createSimple(\"a\", name);\n        builder.createSimple(\"b\", name2);\n\n        // when\n        QueryResult<SimpleStringId> allOrderByNamePaginate = repo.findAllOrderByIdPaginate(0, 10);\n\n        // then\n        assertNotNull(allOrderByNamePaginate);\n\n        List<SimpleStringId> resultList = allOrderByNamePaginate.getResultList();\n        assertEquals(2, resultList.size());\n        assertEquals(\"a\", resultList.get(0).getId());\n        assertEquals(\"b\", resultList.get(1).getId());\n    }\n\n    @Test\n    public void should_sort_all_result()\n    {\n        List<Simple> result = repo.queryAll()\n                .orderDesc(\"s.counter\",false)\n                .orderAsc(\"s.enabled\", false)\n                .getResultList();\n        // no real check here, verifying query syntax passes.\n        assertNotNull(result);\n    }\n\n    @Test\n    public void should_sort_name_results()\n    {\n        List<Simple> result = repo.queryResultWithNamed(\"name\")\n                .orderDesc(Simple_.counter, true)\n                .orderAsc(Simple_.id)\n                .getResultList();\n        // no real check here, verifying query syntax passes.\n        assertNotNull(result);\n    }\n\n    @Before\n    public void setup()\n    {\n        builder = new SimpleBuilder(getEntityManager());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/RepositoryDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.data.test.service.DisabledRepository;\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\n\npublic class RepositoryDeactivator implements ClassDeactivator\n{\n\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        if (targetClass.equals(SimpleRepository.class) || targetClass.equals(DisabledRepository.class))\n        {\n            return Boolean.FALSE;\n        }\n        return null; // no result for the given class\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/RepositoryExtensionTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl;\r\n\r\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.service.BaseRepositoryInterface;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryInterface;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryInterface2;\r\nimport org.apache.deltaspike.data.test.service.RepositoryInterface;\r\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\r\nimport org.apache.deltaspike.test.category.WebProfileCategory;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.Archive;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\nimport org.junit.runner.RunWith;\r\n\r\nimport jakarta.enterprise.inject.Instance;\r\nimport jakarta.inject.Inject;\r\n\r\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\r\nimport static org.junit.Assert.assertEquals;\r\nimport static org.junit.Assert.assertNotNull;\r\n\r\n@RunWith(Arquillian.class)\r\n@Category(WebProfileCategory.class)\r\npublic class RepositoryExtensionTest extends TransactionalTestCase\r\n{\r\n\r\n    private static final String NAME = \"a_simple\";\r\n\r\n    @Deployment\r\n    public static Archive<?> deployment()\r\n    {\r\n        return initDeployment()\r\n                .addClasses(RepositoryInterface.class,\r\n                            BaseRepositoryInterface.class,\r\n                            ExtendedRepositoryInterface.class,\r\n                            ExtendedRepositoryInterface2.class,\r\n                            SimpleRepository.class)\r\n                .addPackages(true, Simple.class.getPackage());\r\n    }\r\n\r\n    @Inject\r\n    Instance<RepositoryInterface> repo;\r\n\r\n    @Inject\r\n    Instance<ExtendedRepositoryInterface> extendedRepo;\r\n\r\n    @Inject\r\n    Instance<SimpleRepository> extendedClassRepo;\r\n\r\n    @Inject\r\n    private ExtendedRepositoryInterface2 repoOnInterface;\r\n\r\n    @Test\r\n    public void should_inject()\r\n    {\r\n        assertNotNull(repo.get());\r\n        assertNotNull(extendedRepo.get());\r\n        assertNotNull(extendedClassRepo.get());\r\n    }\r\n\r\n    @Test\r\n    public void should_work_based_on_interface()\r\n    {\r\n        testData.createSimple( NAME );\r\n        Simple find = repoOnInterface.findByName( NAME );\r\n        assertNotNull(find);\r\n        assertEquals( NAME, find.getName() );\r\n\r\n        repoOnInterface.deleteAll();\r\n\r\n        long count = repoOnInterface.count(  );\r\n        assertEquals(0, count );\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/audit/AuditEntityListenerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\n\nimport jakarta.enterprise.inject.Produces;\n\nimport org.apache.deltaspike.data.api.audit.CurrentUser;\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.AuditedEntity;\nimport org.apache.deltaspike.data.test.domain.Principal;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class AuditEntityListenerTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addPackage(AuditEntityListener.class.getPackage())\n                .addAsWebInfResource(\"test-orm.xml\", \"classes/META-INF/orm.xml\")\n                .addPackage(AuditedEntity.class.getPackage());\n    }\n\n    private final String who = \"test999\";\n    private final Principal principal = new Principal(who);\n\n    @Produces\n    @CurrentUser\n    public String who()\n    {\n        return who;\n    }\n\n    @Produces\n    @CurrentUser\n    public Principal entity() throws Exception\n    {\n        try\n        {\n            getEntityManager().persist(principal);\n        }\n        catch (Throwable e)\n        {\n        }\n        return principal;\n    }\n\n    @Test\n    public void should_set_creation_date() throws Exception\n    {\n        // given\n        AuditedEntity entity = new AuditedEntity();\n\n        // when\n        getEntityManager().persist(entity);\n        getEntityManager().flush();\n\n        // then\n        assertNotNull(entity.getCreated());\n        assertNotNull(entity.getModified());\n        assertEquals(entity.getCreated().getTime(), entity.getModified());\n    }\n\n    @Test\n    public void should_set_modification_date() throws Exception\n    {\n        // given\n        AuditedEntity entity = new AuditedEntity();\n        getEntityManager().persist(entity);\n        getEntityManager().flush();\n\n        // when\n        entity = getEntityManager().find(AuditedEntity.class, entity.getId());\n        entity.setName(\"test\");\n        getEntityManager().flush();\n\n        // then\n        assertNotNull(entity.getGregorianModified());\n        assertNotNull(entity.getTimestamp());\n    }\n\n    @Test\n    public void should_set_changing_principal()\n    {\n        // given\n        AuditedEntity entity = new AuditedEntity();\n        getEntityManager().persist(entity);\n        getEntityManager().flush();\n\n        // when\n        entity = getEntityManager().find(AuditedEntity.class, entity.getId());\n        entity.setName(\"test\");\n        getEntityManager().flush();\n\n        // then\n        assertNotNull(entity.getChanger());\n        assertEquals(who, entity.getChanger());\n        assertNotNull(entity.getPrincipal());\n        assertEquals(who, entity.getPrincipal().getName());\n        assertNotNull(entity.getChangerOnly());\n        assertEquals(who, entity.getChangerOnly());\n        assertNotNull(entity.getChangerOnlyPrincipal());\n        assertEquals(who, entity.getChangerOnlyPrincipal().getName());\n    }\n\n    @Test\n    public void should_set_creating_principal()\n    {\n        // given\n        AuditedEntity entity = new AuditedEntity();\n\n        // when\n        getEntityManager().persist(entity);\n        getEntityManager().flush();\n\n        // then\n        assertNotNull(entity.getCreator());\n        assertEquals(who, entity.getCreator());\n        assertNotNull(entity.getCreatorPrincipal());\n        assertEquals(who, entity.getCreatorPrincipal().getName());\n        assertNotNull(entity.getChanger());\n        assertEquals(who, entity.getChanger());\n        assertNotNull(entity.getPrincipal());\n        assertEquals(who, entity.getPrincipal().getName());\n        assertNull(entity.getChangerOnly());\n        assertNull(entity.getChangerOnlyPrincipal());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/audit/PrincipalProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport org.apache.deltaspike.data.api.audit.CreatedBy;\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.apache.deltaspike.data.test.domain.AuditedEntity;\nimport org.apache.deltaspike.data.test.domain.Principal;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.junit.Test;\n\nimport java.util.Date;\n\nimport static org.junit.Assert.*;\n\npublic class PrincipalProviderTest {\n\n    public static class MockPrincipalProvider extends PrincipalProvider {\n        private final String who;\n\n        MockPrincipalProvider(String who) {\n            this.who = who;\n        }\n\n        @Override\n        protected Object resolvePrincipal(Object entity, Property<Object> property)\n        {\n            if (property.getJavaClass().isAssignableFrom(Principal.class))\n            {\n                return new Principal(who);\n            }\n            return who;\n        }\n    }\n\n    @Test\n    public void should_set_users_for_creation()\n    {\n        // given\n        String creator = \"creator\";\n        MockPrincipalProvider provider = new MockPrincipalProvider(creator);\n        AuditedEntity entity = new AuditedEntity();\n\n        // when\n        provider.prePersist(entity);\n\n        // then\n        assertNotNull(entity.getCreator());\n        assertNotNull(entity.getCreatorPrincipal());\n        assertNotNull(entity.getChanger());\n        assertEquals(entity.getCreator(), creator);\n        assertEquals(entity.getCreatorPrincipal().getName(), creator);\n        assertEquals(entity.getChanger(), creator);\n        assertNull(entity.getChangerOnly());\n        assertNull(entity.getChangerOnlyPrincipal());\n    }\n\n    @Test\n    public void should_set_users_for_update()\n    {\n        // given\n        String changer = \"changer\";\n        MockPrincipalProvider provider = new MockPrincipalProvider(changer);\n        AuditedEntity entity = new AuditedEntity();\n\n        // when\n        provider.preUpdate(entity);\n\n        // then\n        assertNotNull(entity.getChanger());\n        assertNotNull(entity.getChangerOnly());\n        assertNotNull(entity.getChangerOnlyPrincipal());\n        assertEquals(entity.getChanger(), changer);\n        assertEquals(entity.getChangerOnly(), changer);\n        assertEquals(entity.getChangerOnlyPrincipal().getName(), changer);\n        assertNull(entity.getCreator());\n        assertNull(entity.getCreatorPrincipal());\n    }\n\n    @Test\n    public void should_not_fail_on_non_audited_entity()\n    {\n        // given\n        Simple entity = new Simple(\"should_not_fail_on_non_audited_entity\");\n\n        // when\n        PrincipalProvider provider = new MockPrincipalProvider(\"\");\n        provider.prePersist(entity);\n        provider.preUpdate(entity);\n\n        // then finish the test\n    }\n\n    @Test(expected = AuditPropertyException.class)\n    public void should_fail_on_invalid_entity()\n    {\n        // given\n        PrincipalProviderTest.InvalidEntity entity = new PrincipalProviderTest.InvalidEntity();\n\n        // when\n        new MockPrincipalProvider(\"\").prePersist(entity);\n\n        // then\n        fail();\n    }\n\n    private static class InvalidEntity\n    {\n        @CreatedBy\n        private Date nonUser;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/audit/TimestampsProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.audit;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.fail;\n\nimport org.apache.deltaspike.data.api.audit.CreatedOn;\nimport org.apache.deltaspike.data.test.domain.AuditedEntity;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.junit.Test;\n\npublic class TimestampsProviderTest\n{\n\n    @Test\n    public void should_set_dates_for_creation()\n    {\n        // given\n        AuditedEntity entity = new AuditedEntity();\n\n        // when\n        new TimestampsProvider().prePersist(entity);\n\n        // then\n        assertNotNull(entity.getCreated());\n        assertNotNull(entity.getModified());\n        assertNull(entity.getGregorianModified());\n        assertNull(entity.getTimestamp());\n    }\n\n    @Test\n    public void should_set_dates_for_update()\n    {\n        // given\n        AuditedEntity entity = new AuditedEntity();\n\n        // when\n        new TimestampsProvider().preUpdate(entity);\n\n        // then\n        assertNull(entity.getCreated());\n        assertNotNull(entity.getModified());\n        assertNotNull(entity.getGregorianModified());\n        assertNotNull(entity.getTimestamp());\n    }\n\n    @Test\n    public void should_not_fail_on_non_audited_entity()\n    {\n        // given\n        Simple entity = new Simple(\"should_not_fail_on_non_audited_entity\");\n\n        // when\n        TimestampsProvider provider = new TimestampsProvider();\n        provider.prePersist(entity);\n        provider.preUpdate(entity);\n\n        // then finish the test\n    }\n\n    @Test(expected = AuditPropertyException.class)\n    public void should_fail_on_invalid_entity()\n    {\n        // given\n        InvalidEntity entity = new InvalidEntity();\n\n        // when\n        new TimestampsProvider().prePersist(entity);\n\n        // then\n        fail();\n    }\n\n    private static class InvalidEntity\n    {\n\n        @CreatedOn\n        private String nonTemporal;\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/builder/part/QueryRootTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.builder.part;\r\n\r\nimport org.apache.deltaspike.data.impl.builder.MethodExpressionException;\r\nimport org.apache.deltaspike.data.impl.meta.EntityMetadata;\r\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\r\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.service.SimpleFetchRepository;\r\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\r\nimport org.junit.Test;\r\n\r\nimport static org.junit.Assert.assertEquals;\r\n\r\npublic class QueryRootTest\r\n{\r\n    private final RepositoryMetadata repo = new RepositoryMetadata(SimpleRepository.class, new EntityMetadata(Simple.class, \"Simple\", Long.class));\r\n    private final RepositoryMetadata repoFetchBy = new RepositoryMetadata(SimpleFetchRepository.class, new EntityMetadata(Simple.class, \"Simple\", Long.class));\r\n\r\n    @Test\r\n    public void should_create_simple_query()\r\n    {\r\n        // given\r\n        final String name = \"findByName\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name = ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_create_complex_query()\r\n    {\r\n        // given\r\n        final String name = \"findByNameAndTemporalBetweenOrEnabledIsNull\" +\r\n                \"AndCamelCaseLikeIgnoreCaseAndEmbedded_embeddNotEqualIgnoreCase\" +\r\n                \"OrderByEmbedded_embeddDesc\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name = ?1 \" +\r\n                        \"and e.temporal between ?2 and ?3 \" +\r\n                        \"or e.enabled IS NULL \" +\r\n                        \"and upper(e.camelCase) like ?4 \" +\r\n                        \"and upper(e.embedded.embedd) <> upper(?5) \" +\r\n                        \"order by e.embedded.embedd desc\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_create_query_with_order_by_only()\r\n    {\r\n        // given\r\n        final String name = \"findByOrderByIdAsc\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"order by e.id asc\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test(expected = MethodExpressionException.class)\r\n    public void should_fail_in_where()\r\n    {\r\n        // given\r\n        final String name = \"findByInvalid\";\r\n\r\n        // when\r\n        QueryRoot.create(name, repo, prefix(name));\r\n    }\r\n\r\n    @Test(expected = MethodExpressionException.class)\r\n    public void should_fail_with_prefix_only()\r\n    {\r\n        // given\r\n        final String name = \"findBy\";\r\n\r\n        // when\r\n        QueryRoot.create(name, repo, prefix(name));\r\n    }\r\n\r\n    @Test(expected = MethodExpressionException.class)\r\n    public void should_fail_in_order_by()\r\n    {\r\n        // given\r\n        final String name = \"findByNameOrderByInvalidDesc\";\r\n\r\n        // when\r\n        QueryRoot.create(name, repo, prefix(name));\r\n    }\r\n\r\n    @Test\r\n    public void should_use_alternative_prefix()\r\n    {\r\n        // given\r\n        final String name = \"fetchByName\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name = ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repoFetchBy, new RepositoryMethodPrefix(\"fetchBy\", name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_create_delete_query_by_name()\r\n    {\r\n        // given\r\n        final String name = \"deleteByName\";\r\n        final String expected =\r\n                \"delete from Simple e \" +\r\n                        \"where e.name = ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_create_delete_query_by_name_and_enabled()\r\n    {\r\n        // given\r\n        final String name = \"deleteByNameAndEnabled\";\r\n        final String expected =\r\n                \"delete from Simple e \" +\r\n                        \"where e.name = ?1 and e.enabled = ?2\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_order_by_in_order()\r\n    {\r\n        // given\r\n        final String name = \"findAllOrderByNameDescIdAsc\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"order by e.name desc, e.id asc\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_LessThan()\r\n    {\r\n        // given\r\n        final String name = \"findByNameLessThan\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name < ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_LessThanEquals()\r\n    {\r\n        // given\r\n        final String name = \"findByNameLessThanEquals\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name <= ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_GreaterThan()\r\n    {\r\n        // given\r\n        final String name = \"findByNameGreaterThan\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name > ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_GreaterThanEquals()\r\n    {\r\n        // given\r\n        final String name = \"findByNameGreaterThanEquals\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name >= ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_Like()\r\n    {\r\n        // given\r\n        final String name = \"findByNameLike\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name like ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_NotLike()\r\n    {\r\n        // given\r\n        final String name = \"findByNameNotLike\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name not like ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_LikeIgnoreCase()\r\n    {\r\n        // given\r\n        final String name = \"findByNameLikeIgnoreCase\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where upper(e.name) like ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_NotEqual()\r\n    {\r\n        // given\r\n        final String name = \"findByNameNotEqual\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name <> ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_NotEqualIgnoreCase()\r\n    {\r\n        // given\r\n        final String name = \"findByNameNotEqualIgnoreCase\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where upper(e.name) <> upper(?1)\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_Equal()\r\n    {\r\n        // given\r\n        final String name = \"findByNameEqual\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name = ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_EqualIgnoreCase()\r\n    {\r\n        // given\r\n        final String name = \"findByNameEqualIgnoreCase\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where upper(e.name) = upper(?1)\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_IgnoreCase()\r\n    {\r\n        // given\r\n        final String name = \"findByNameIgnoreCase\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where upper(e.name) = upper(?1)\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_In()\r\n    {\r\n        // given\r\n        final String name = \"findByNameIn\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name IN ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_Between()\r\n    {\r\n        // given\r\n        final String name = \"findByNameBetween\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name between ?1 and ?2\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_IsNotNull()\r\n    {\r\n        // given\r\n        final String name = \"findByNameIsNotNull\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name IS NOT NULL\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_IsNull()\r\n    {\r\n        // given\r\n        final String name = \"findByNameIsNull\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name IS NULL\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_NotIn()\r\n    {\r\n        // given\r\n        final String name = \"findByNameNotIn\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name NOT IN ?1\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_True()\r\n    {\r\n        // given\r\n        final String name = \"findByNameTrue\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name IS TRUE\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_False()\r\n    {\r\n        // given\r\n        final String name = \"findByNameFalse\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name IS FALSE\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_Containing()\r\n    {\r\n        // given\r\n        final String name = \"findByNameContaining\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name like CONCAT('%', CONCAT(?1, '%'))\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_StartingWith()\r\n    {\r\n        // given\r\n        final String name = \"findByNameStartingWith\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name like CONCAT(?1, '%')\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    @Test\r\n    public void should_apply_comparator_EndingWith()\r\n    {\r\n        // given\r\n        final String name = \"findByNameEndingWith\";\r\n        final String expected =\r\n                \"select e from Simple e \" +\r\n                        \"where e.name like CONCAT('%', ?1)\";\r\n\r\n        // when\r\n        String result = QueryRoot.create(name, repo, prefix(name)).getJpqlQuery().trim();\r\n\r\n        // then\r\n        assertEquals(expected, result);\r\n    }\r\n\r\n    private RepositoryMethodPrefix prefix(final String name)\r\n    {\r\n        return new RepositoryMethodPrefix(\"\", name);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/criteria/CriteriaTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.criteria;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.NonUniqueResultException;\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.OneToMany;\nimport org.apache.deltaspike.data.test.domain.OneToOne;\nimport org.apache.deltaspike.data.test.domain.Parent;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.service.ParentRepository;\nimport org.apache.deltaspike.data.test.service.SimpleCriteriaRepository;\nimport org.apache.deltaspike.data.test.service.Statistics;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.List;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.*;\n\n@Category(WebProfileCategory.class)\npublic class CriteriaTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(SimpleCriteriaRepository.class, ParentRepository.class, Statistics.class)\n                .addPackage(Simple.class.getPackage());\n    }\n\n    @Inject\n    private SimpleCriteriaRepository repo;\n\n    @Inject\n    private ParentRepository parentRepo;\n\n    @Test\n    public void should_create_criteria_query()\n    {\n        // given\n        final String name = \"testCreateCriteriaQuery\";\n        createSimple(name, 55);\n\n        // when\n        List<Simple> result1 = repo.queryByCriteria(name, Boolean.TRUE, 0, 50);\n        List<Simple> result2 = repo.queryByCriteria(name, Boolean.TRUE, 50, 100);\n        List<Simple> result3 = repo.queryByCriteria(name, Boolean.FALSE, 50, 100);\n\n        // then\n        assertEquals(0, result1.size());\n        assertEquals(1, result2.size());\n        assertEquals(0, result3.size());\n    }\n\n    @Test\n    public void should_query_with_ignore_case()\n    {\n        // given\n        final String name = \"TEST_query_EQ_with_igNOREe_case\";\n        final String nameLike = \"TEST_query_LIKE_with_igNOREe_case\";\n        createSimple(name, 155);\n        createSimple(nameLike, 166);\n\n        // when\n        List<Simple> result1 = repo.queryByIgnoreCase(name.toLowerCase(), \"no_match\");\n        List<Simple> result2 = repo.queryByIgnoreCase(\"no_match\", \"%\" + nameLike.substring(5, 22) + \"%\");\n\n        // then\n        assertEquals(1, result1.size());\n        assertEquals(Integer.valueOf(155), result1.get(0).getCounter());\n        assertEquals(1, result2.size());\n        assertEquals(Integer.valueOf(166), result2.get(0).getCounter());\n    }\n\n    @Test\n    public void should_create_join_criteria_query()\n    {\n        // given\n        final String name = \"testCreateJoinCriteriaQuery\";\n        final String nameOne = name + \"-one\";\n        final String nameMany = name + \"-many\";\n        Parent parent = new Parent(name);\n        parent.setOne(new OneToOne(nameOne));\n        parent.add(new OneToMany(nameMany));\n\n        getEntityManager().persist(parent);\n        getEntityManager().flush();\n\n        // when\n        List<Parent> result = parentRepo.joinQuery(name, nameOne, nameMany);\n\n        // then\n        assertEquals(1, result.size());\n        assertNotNull(result.get(0));\n\n        Parent queried = result.get(0);\n        assertEquals(name, queried.getName());\n        assertNotNull(queried.getOne());\n        assertEquals(nameOne, queried.getOne().getName());\n        assertEquals(1, queried.getMany().size());\n        assertEquals(nameMany, queried.getMany().get(0).getName());\n    }\n\n    @Test\n    public void should_create_or_query()\n    {\n        // given\n        final String name = \"testCreateOrQuery\";\n        Parent parent1 = new Parent(name + \"1\");\n        parent1.setValue(25L);\n        Parent parent2 = new Parent(name + \"2\");\n        parent2.setValue(75L);\n        Parent parent3 = new Parent(name + \"3\");\n        parent3.setValue(25L);\n        Parent parent4 = new Parent(name + \"1\");\n        parent4.setValue(75L);\n\n        getEntityManager().persist(parent1);\n        getEntityManager().persist(parent2);\n        getEntityManager().persist(parent3);\n        getEntityManager().persist(parent4);\n        getEntityManager().flush();\n\n        // when\n        List<Parent> result = parentRepo.orQuery(name + \"1\", name + \"2\");\n\n        // then\n        assertEquals(2, result.size());\n    }\n\n    @Test\n    public void should_create_ordered_query()\n    {\n        // given\n        final String name = \"testCreateOrderedQuery\";\n        Parent parent1 = new Parent(name + \"99\");\n        Parent parent2 = new Parent(name + \"12\");\n        Parent parent3 = new Parent(name + \"19\");\n        Parent parent4 = new Parent(name + \"02\");\n\n        getEntityManager().persist(parent1);\n        getEntityManager().persist(parent2);\n        getEntityManager().persist(parent3);\n        getEntityManager().persist(parent4);\n        getEntityManager().flush();\n\n        // when\n        List<Parent> result = parentRepo.orderedQuery();\n\n        // then\n        assertEquals(4, result.size());\n        assertEquals(name + \"02\", result.get(0).getName());\n        assertEquals(name + \"12\", result.get(1).getName());\n        assertEquals(name + \"19\", result.get(2).getName());\n        assertEquals(name + \"99\", result.get(3).getName());\n    }\n\n    @Test\n    public void should_create_query_wihtout_nulls()\n    {\n        // given\n        final String name = \"testCreateQueryWihtoutNulls\";\n        Parent parent = new Parent(name);\n\n        getEntityManager().persist(parent);\n        getEntityManager().flush();\n\n        // when\n        List<Parent> result = parentRepo.nullAwareQuery(name, null, null);\n\n        // then\n        assertEquals(1, result.size());\n        assertEquals(name, result.get(0).getName());\n    }\n\n    @Test\n    public void should_create_fetch_query()\n    {\n        // given\n        final String name = \"testCreateFetchQuery\";\n        Parent parent = new Parent(name);\n        parent.add(new OneToMany(name + \"-1\"));\n        parent.add(new OneToMany(name + \"-2\"));\n\n        getEntityManager().persist(parent);\n        getEntityManager().flush();\n\n        // when\n        Parent result = parentRepo.fetchQuery(name);\n\n        // then\n        assertNotNull(result);\n        assertEquals(name, result.getName());\n        assertNotNull(result.getMany());\n        assertEquals(2, result.getMany().size());\n    }\n\n    @Test\n    public void should_create_in_query()\n    {\n        // given\n        final String name = \"testCreateInQuery\";\n        Parent parent1 = new Parent(name + \"-1\");\n        Parent parent2 = new Parent(name + \"-2\");\n        Parent parent3 = new Parent(name + \"-3\");\n\n        getEntityManager().persist(parent1);\n        getEntityManager().persist(parent2);\n        getEntityManager().persist(parent3);\n        getEntityManager().flush();\n\n        // when\n        List<Parent> result = parentRepo.fetchByName(name + \"-1\", name + \"-2\", name + \"-3\");\n\n        // then\n        assertNotNull(result);\n        assertEquals(3, result.size());\n    }\n\n    @Test\n    public void should_create_select_criteria_with_result_type()\n    {\n        // given\n        final String name = \"testCreateSelectCriteriaWithResultType\";\n        createSimple(name, 1);\n        createSimple(name, 2);\n        createSimple(name, 3);\n        createSimple(name, 4);\n        createSimple(name, 99);\n\n        // when\n        Statistics result = repo.queryWithSelect(name);\n\n        // then\n        assertNotNull(result.getAverage());\n        assertEquals(Long.valueOf(5l), result.getCount());\n    }\n\n    @Test\n    public void should_create_select_criteria_without_result_type()\n    {\n        // given\n        final String name = \"testCreateSelectCriteriaWithoutResultType\";\n        createSimple(name, 10);\n        createSimple(name, 99);\n\n        // when\n        Object[] result = repo.queryWithSelectAggregateReturnArray(name);\n\n        // then\n        assertEquals(Integer.valueOf(10), result[0]);\n        assertEquals(Integer.valueOf(99), result[1]);\n        assertTrue(result[2] instanceof java.sql.Date);\n        assertTrue(result[3] instanceof java.sql.Time || result[3] instanceof java.time.OffsetTime);\n        assertTrue(result[4] instanceof java.sql.Timestamp || result[4] instanceof java.time.OffsetDateTime);\n    }\n\n    @Test\n    public void should_create_select_criteria_with_attributes()\n    {\n        // given\n        final String name = \"testCreateSelectCriteriaWithAttributes\";\n        createSimple(name, 10);\n        createSimple(name, 99);\n\n        // when\n        List<Object[]> results = repo.queryWithSelectAttributes(name);\n\n        // then\n        for (Object[] result : results)\n        {\n            assertEquals(name, result[0]);\n            assertEquals(name.toUpperCase(), result[1]);\n            assertEquals(name.toLowerCase(), result[2]);\n            assertEquals(name.substring(1), result[3]);\n            assertEquals(name.substring(1, 1 + 2), result[4]);\n        }\n    }\n\n    @Test\n    public void should_create_select_criteria_with_optional_result()\n    {\n        // given\n        final String name = \"should_create_select_criteria_with_optional_result\";\n        createSimple(name, 10);\n\n        // when\n        Simple result1 = repo.queryOptional(name);\n        Simple result2 = repo.queryOptional(name + \"_doesnt exist\");\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test(expected = NonUniqueResultException.class)\n    public void should_fail_with_optional_nonunique_result()\n    {\n        // given\n        final String name = \"should_fail_with_optional_nonunique_result\";\n        createSimple(name, 10);\n        createSimple(name, 10);\n\n        // when\n        repo.queryOptional(name);\n\n    }\n\n    @Test\n    public void should_create_select_criteria_with_any_result()\n    {\n        // given\n        final String name = \"should_create_select_criteria_with_any_result\";\n        createSimple(name, 10);\n        createSimple(name, 10);\n\n        // when\n        Simple result1 = repo.queryAny(name);\n        Simple result2 = repo.queryAny(name + \"_doesnt exist\");\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test // SELECT COUNT(DISTINCT(s.name)) FROM Simple s WHERE s.name = 'should_create_count_criteria'\n    public void should_create_count_criteria()\n    {\n        // given\n        final String name = \"should_create_count_criteria\";\n        createSimple(name, 10);\n        createSimple(name, 11);\n\n        // when\n        Long result = repo.criteriaCount(name);\n\n        // then\n        assertNotNull(result);\n        assertEquals(1l, result.longValue());\n    }\n\n    @Test\n    public void should_create_date_criteria()\n    {\n        // given\n        final String name = \"should_create_date_criteria\";\n        final Simple simple = new Simple(name);\n        simple.setTemporal(new Date());\n        getEntityManager().persist(simple);\n        getEntityManager().flush();\n\n        Calendar cal = Calendar.getInstance();\n        cal.setTime(simple.getTemporal());\n        cal.add(Calendar.MINUTE, -1);\n        Date from = cal.getTime();\n        cal.add(Calendar.MINUTE, 2);\n        Date to = cal.getTime();\n\n        // when\n        final List<Simple> result = repo.findByTimeBetween(from, to);\n\n        // then\n        assertNotNull(result);\n        assertEquals(1, result.size());\n    }\n\n    @Test\n    public void should_query_with_att_from_mapped_super()\n    {\n        // given\n        final String name = \"should_create_date_criteria\";\n        final String superName = \"super_should_create_date_criteria\";\n        final Simple simple = new Simple(name);\n        simple.setSuperName(superName);\n        getEntityManager().persist(simple);\n        getEntityManager().flush();\n\n        // when\n        final Simple result = repo.findBySuperName(superName);\n\n        // then\n        assertEquals(superName, result.getSuperName());\n    }\n\n    @Test\n    public void should_apply_multiply_orderby()\n    {\n        // given\n        createSimple(\"a\", 1);\n        createSimple(\"b\", 2);\n\n        // when\n        final List<Simple> orderByNameAndCounter = repo.findOrderByNameAndCounter();\n\n        // then\n        assertEquals(new Integer(2), orderByNameAndCounter.get(0).getCounter());\n        assertEquals(new Integer(1), orderByNameAndCounter.get(1).getCounter());\n    }\n\n    @Test\n    public void should_apply_trim()\n    {\n        // given\n        final String name = \" should_apply_trim \";\n        createSimple(name, 10);\n\n        // when\n        Object[] objects = repo.queryWithSelectAttributesAndTrim(name);\n        assertNotNull(objects);\n        assertEquals(name, objects[0]);\n        assertEquals(name.trim(), objects[1]);\n        assertEquals(\"should_apply_trim \", objects[2]);\n    }\n\n    private Simple createSimple(String name, Integer counter)\n    {\n        Simple result = new Simple(name);\n        result.setCounter(counter);\n        getEntityManager().persist(result);\n        getEntityManager().flush();\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\n\nimport java.lang.reflect.Method;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix;\nimport org.apache.deltaspike.data.impl.meta.EntityMetadata;\nimport org.apache.deltaspike.data.impl.meta.RepositoryMetadata;\n\nimport org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\nimport org.junit.Test;\n\npublic class CdiQueryContextHolderTest\n{\n\n    @Test\n    public void should_dispose_tl_when_all_empty()\n    {\n        // given\n        CdiQueryContextHolder holder = new CdiQueryContextHolder();\n        CdiQueryInvocationContext context = dummyInvocationContext();\n\n        // when\n        holder.set(context);\n        CdiQueryInvocationContext temp1 = holder.get();\n        CdiQueryInvocationContext temp2 = holder.get();\n        holder.dispose();\n\n        // then\n        assertEquals(context, temp1);\n        assertEquals(context, temp2);\n        assertNull(holder.get());\n    }\n\n    @Test\n    public void should_not_dispose_when_stack_not_empty()\n    {\n        // given\n        CdiQueryContextHolder holder = new CdiQueryContextHolder();\n        CdiQueryInvocationContext context1 = dummyInvocationContext();\n        CdiQueryInvocationContext context2 = dummyInvocationContext();\n\n        // when\n        holder.set(context1);\n        holder.set(context2);\n        CdiQueryInvocationContext temp1 = holder.get();\n        holder.dispose();\n        CdiQueryInvocationContext temp2 = holder.get();\n        holder.dispose();\n\n        // then\n        assertEquals(context2, temp1);\n        assertEquals(context1, temp2);\n        assertNull(holder.get());\n    }\n\n    private CdiQueryInvocationContext dummyInvocationContext()\n    {\n        return new CdiQueryInvocationContext(null, dummyMethod(), null, dummyRepo(), dummyRepoMethod(dummyRepo()), null);\n    }\n\n    private Method dummyMethod()\n    {\n        try\n        {\n            return SimpleRepository.class.getMethod(\"findAnyByName\", String.class);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private RepositoryMethodMetadata dummyRepoMethod(RepositoryMetadata metadata)\n    {\n        RepositoryMethodMetadata methodMetadata = new RepositoryMethodMetadata(dummyMethod());\n        methodMetadata.setMethodPrefix(new RepositoryMethodPrefix(\n                    metadata.getRepositoryClass().getAnnotation(Repository.class).methodPrefix(),\n                    dummyMethod().getName()));\n        \n        return methodMetadata;\n    }\n\n    private RepositoryMetadata dummyRepo()\n    {\n        return new RepositoryMetadata(SimpleRepository.class, new EntityMetadata(Simple.class));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerDelegateHandlerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryInterface;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class EntityManagerDelegateHandlerTest extends TransactionalTestCase\n{\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(ExtendedRepositoryInterface.class)\n                .addPackage(Simple.class.getPackage());\n    }\n\n    @Inject\n    private ExtendedRepositoryInterface repository;\n\n    @Test\n    public void should_delete_detached_entity() {\n        // given\n        Simple simple = testData.createSimple(\"should_merge_entity\");\n        Long id = simple.getId();\n\n        // when\n        repository.detach(simple);\n        repository.remove(repository.merge(simple));\n\n        // then\n        assertNotNull(id);\n        Simple search = repository.findBy(id);\n        assertNull(search);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\r\nimport static org.junit.Assert.assertEquals;\r\nimport static org.junit.Assert.assertNotNull;\r\nimport static org.junit.Assert.fail;\r\n\r\nimport java.util.List;\r\n\r\nimport jakarta.inject.Inject;\r\n\r\nimport org.apache.deltaspike.data.api.QueryInvocationException;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.service.*;\r\nimport org.apache.deltaspike.test.category.WebProfileCategory;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.Archive;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\n@Category(WebProfileCategory.class)\r\npublic class EntityManagerTest\r\n{\r\n\r\n    @Deployment\r\n    public static Archive<?> deployment()\r\n    {\r\n        return initDeployment(false)\r\n                .addPackage(Simple.class.getPackage())\r\n                .addClasses(SimpleRepositoryWithEntityManager.class,\r\n                        SimpleRepositoryWithEntityManagerResolver.class,\r\n                        QualifiedEntityManagerTestProducer.class,\r\n                        NonQualifiedEntityManagerTestProducer.class,\r\n                        BasicEntityManagerResolver.class,\r\n                        LegacyRepositoryWithEntityManagerResolver.class,\r\n                        Simplistic.class, SimplisticEntityManagerResolver.class);\r\n    }\r\n\r\n    @Inject\r\n    private SimpleRepositoryWithEntityManager repoWithDefaultEm;\r\n\r\n    @Inject\r\n    private SimpleRepositoryWithEntityManagerResolver repoWithInjection;\r\n\r\n    @Test\r\n    public void should_use_default_entity_manager()\r\n    {\r\n        // when\r\n        List<Simple> result = repoWithDefaultEm.findByName(\"testUseQualifiedEntityManager\");\r\n\r\n        // then\r\n        assertNotNull(result);\r\n        assertEquals(0, result.size());\r\n    }\r\n\r\n    /*\r\n     * Injected EM throws UnsupportedOperationException on all methods.\r\n     * Shortcutting the creation of multiple PUs (lazy guy...)\r\n     */\r\n    @Test(expected = QueryInvocationException.class)\r\n    public void should_use_entity_manager_from_resolver()\r\n    {\r\n        // when\r\n        repoWithInjection.findByName(\"testUseQualifiedEntityManager\");\r\n\r\n        // then\r\n        fail(\"Fake EM should have thrown Exception\");\r\n    }\r\n\r\n    @Test\r\n    public void shouldWorkWithLegacyConfigAsWell()\r\n    {\r\n        // when\r\n        List<Simple> result = repoWithDefaultEm.findByName(\"testUseQualifiedEntityManager\");\r\n\r\n        // then\r\n        assertNotNull(result);\r\n        assertEquals(0, result.size());\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityRepositoryHandlerInheritedTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\r\nimport static org.junit.Assert.assertEquals;\r\nimport static org.junit.Assert.assertNull;\r\n\r\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.domain.Simple5;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryAbstractInherited;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryAbstractIntermediate;\r\nimport org.apache.deltaspike.test.category.WebProfileCategory;\r\nimport org.apache.deltaspike.test.utils.BeansXmlUtil;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.shrinkwrap.api.Archive;\r\nimport org.jboss.shrinkwrap.api.asset.Asset;\r\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\n\r\nimport jakarta.inject.Inject;\r\n\r\n@Category(WebProfileCategory.class)\r\npublic class EntityRepositoryHandlerInheritedTest extends TransactionalTestCase\r\n{\r\n    \r\n    @Deployment\r\n    public static Archive<?> deployment()\r\n    {\r\n        return initDeployment(true)\r\n                .addClasses(ExtendedRepositoryAbstractIntermediate.class, \r\n                        ExtendedRepositoryAbstractInherited.class,\r\n                        NamedQualifiedEntityManagerTestProducer.class)\r\n                .addPackage(Simple.class.getPackage());\r\n    }\r\n\r\n    @Inject\r\n    private ExtendedRepositoryAbstractInherited repo;\r\n\r\n    @Test\r\n    public void should_return_entity_name()\r\n    {\r\n        final String entityName = repo.getEntityName();\r\n\r\n        assertEquals(\"EntitySimple5\", entityName);\r\n    }\r\n\r\n    @Test\r\n    public void should_return_null_entity()\r\n    {\r\n        final Simple5 entity = repo.findByIdAndName(-1L, \"any\");\r\n\r\n        assertNull(entity);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityRepositoryHandlerTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\r\nimport static org.junit.Assert.assertEquals;\r\nimport static org.junit.Assert.assertFalse;\r\nimport static org.junit.Assert.assertNotNull;\r\nimport static org.junit.Assert.assertNull;\r\n\r\nimport java.util.List;\r\nimport java.util.Optional;\r\n\r\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.domain.Simple2;\r\nimport org.apache.deltaspike.data.test.domain.SimpleStringId;\r\nimport org.apache.deltaspike.data.test.domain.Simple_;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryAbstract;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryAbstract2;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryAbstract4;\r\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryInterface;\r\nimport org.apache.deltaspike.data.test.service.SimpleIntermediateRepository;\r\nimport org.apache.deltaspike.data.test.service.SimpleStringIdRepository;\r\nimport org.apache.deltaspike.test.category.WebProfileCategory;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.shrinkwrap.api.Archive;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\n\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.metamodel.SingularAttribute;\r\n\r\n@Category(WebProfileCategory.class)\r\npublic class EntityRepositoryHandlerTest extends TransactionalTestCase\r\n{\r\n\r\n    @Deployment\r\n    public static Archive<?> deployment()\r\n    {\r\n        return initDeployment()\r\n                .addClasses(ExtendedRepositoryInterface.class)\r\n                .addClasses(ExtendedRepositoryAbstract.class)\r\n                .addClasses(ExtendedRepositoryAbstract2.class)\r\n                .addClasses(ExtendedRepositoryAbstract4.class)\r\n                .addClasses(SimpleStringIdRepository.class, SimpleIntermediateRepository.class)\r\n                .addPackage(Simple.class.getPackage());\r\n    }\r\n\r\n    @Inject\r\n    private ExtendedRepositoryInterface repo;\r\n\r\n    @Inject\r\n    private ExtendedRepositoryAbstract repoAbstract;\r\n\r\n    @Inject\r\n    private ExtendedRepositoryAbstract2 repoAbstract2;\r\n\r\n    @Inject\r\n    private ExtendedRepositoryAbstract4 repoAbstract4;\r\n    \r\n    @Inject\r\n    private SimpleStringIdRepository stringIdRepo;\r\n\r\n    @Inject\r\n    private SimpleIntermediateRepository intermediate;\r\n\r\n    @Test\r\n    public void should_save() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        simple = repo.save(simple);\r\n\r\n        // then\r\n        assertNotNull(simple.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_merge() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testMerge\");\r\n        Long id = simple.getId();\r\n\r\n        // when\r\n        final String newName = \"testMergeUpdated\";\r\n        simple.setName(newName);\r\n        simple = repo.save(simple);\r\n\r\n        // then\r\n        assertEquals(id, simple.getId());\r\n        assertEquals(newName, simple.getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_save_and_flush() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        simple = repo.saveAndFlush(simple);\r\n        Simple fetch = (Simple) getEntityManager()\r\n                .createNativeQuery(\"select * from SIMPLE_TABLE where id = ?\", Simple.class)\r\n                .setParameter(1, simple.getId())\r\n                .getSingleResult();\r\n\r\n        // then\r\n        assertEquals(simple.getId(), fetch.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_save_with_string_id()\r\n    {\r\n        // given\r\n        SimpleStringId foo = new SimpleStringId(\"foo\", \"bar\");\r\n\r\n        // when\r\n        foo = stringIdRepo.save(foo);\r\n\r\n        // then\r\n        assertNotNull(foo);\r\n    }\r\n\r\n\r\n    @Test\r\n    public void should_refresh() throws Exception\r\n    {\r\n        // given\r\n        final String name = \"testRefresh\";\r\n        Simple simple = testData.createSimple(name);\r\n\r\n        // when\r\n        simple.setName(\"override\");\r\n        repo.refresh(simple);\r\n\r\n        // then\r\n        assertEquals(name, simple.getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_find_by_pk() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindByPk\");\r\n\r\n        // when\r\n        Simple find = repo.findBy(simple.getId());\r\n\r\n        // then\r\n        assertEquals(simple.getName(), find.getName());\r\n    }\r\n    \r\n    @Test\r\n    public void should_find__by_pk() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindByPk\");\r\n\r\n        // when\r\n        Optional<Simple> find = repo.findOptionalBy(simple.getId());\r\n\r\n        // then\r\n        assertEquals(simple.getName(), find.get().getName());\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_find_by_example() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindByExample\");\r\n\r\n        // when\r\n        List<Simple> find = repo.findBy(simple, Simple_.name);\r\n\r\n        // then\r\n        assertNotNull(find);\r\n        assertFalse(find.isEmpty());\r\n        assertEquals(simple.getName(), find.get(0).getName());\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_find_by_example_with_start_and_max() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindByExample1\", Integer.valueOf(10));\r\n        testData.createSimple(\"testFindByExample1\", Integer.valueOf(10));\r\n\r\n        // when\r\n        List<Simple> find = repo.findBy(simple, 0, 1, Simple_.name, Simple_.counter);\r\n\r\n        // then\r\n        assertNotNull(find);\r\n        assertFalse(find.isEmpty());\r\n        assertEquals(1, find.size());\r\n        assertEquals(simple.getName(), find.get(0).getName());\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_find_by_example_with_no_attributes() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindByExample\");\r\n        SingularAttribute<Simple, ?>[] attributes = new SingularAttribute[] {};\r\n\r\n        // when\r\n        List<Simple> find = repo.findBy(simple, attributes);\r\n\r\n        // then\r\n        assertNotNull(find);\r\n        assertFalse(find.isEmpty());\r\n        assertEquals(simple.getName(), find.get(0).getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_find_all()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testFindAll1\");\r\n        testData.createSimple(\"testFindAll2\");\r\n\r\n        // when\r\n        List<Simple> find = repo.findAll();\r\n\r\n        // then\r\n        assertEquals(2, find.size());\r\n    }\r\n\r\n    @Test\r\n    public void should_find_by_all_with_start_and_max()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testFindAll1\");\r\n        testData.createSimple(\"testFindAll2\");\r\n\r\n        // when\r\n        List<Simple> find = repo.findAll(0, 1);\r\n\r\n        // then\r\n        assertEquals(1, find.size());\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings({ \"unchecked\" })\r\n    public void should_find_by_like()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testFindAll1\");\r\n        testData.createSimple(\"testFindAll2\");\r\n        Simple example = new Simple(\"test\");\r\n\r\n        // when\r\n        List<Simple> find = repo.findByLike(example, Simple_.name);\r\n\r\n        // then\r\n        assertEquals(2, find.size());\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_find_by_like_with_start_and_max()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testFindAll1\");\r\n        testData.createSimple(\"testFindAll2\");\r\n        Simple example = new Simple(\"test\");\r\n\r\n        // when\r\n        List<Simple> find = repo.findByLike(example, 1, 10, Simple_.name);\r\n\r\n        // then\r\n        assertEquals(1, find.size());\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_find_by_like_non_string()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testFindAll1\", 1);\r\n        testData.createSimple(\"testFindAll2\", 2);\r\n        Simple example = new Simple(\"test\");\r\n        example.setCounter(1);\r\n\r\n        // when\r\n        List<Simple> find = repo.findByLike(example, Simple_.name, Simple_.counter);\r\n\r\n        // then\r\n        assertEquals(1, find.size());\r\n    }\r\n\r\n    @Test\r\n    public void should_count_all()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testCountAll\");\r\n\r\n        // when\r\n        Long result = repo.count();\r\n\r\n        // then\r\n        assertEquals(Long.valueOf(1), result);\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_count_with_attributes()\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindAll1\", Integer.valueOf(55));\r\n        testData.createSimple(\"testFindAll2\", Integer.valueOf(55));\r\n\r\n        // when\r\n        Long result = repo.count(simple, Simple_.name, Simple_.counter);\r\n\r\n        // then\r\n        assertEquals(Long.valueOf(1), result);\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_count_with_no_attributes()\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testFindAll1\");\r\n        testData.createSimple(\"testFindAll2\");\r\n        SingularAttribute<Simple, Object>[] attributes = new SingularAttribute[] {};\r\n\r\n        // when\r\n        Long result = repo.count(simple, attributes);\r\n\r\n        // then\r\n        assertEquals(Long.valueOf(2), result);\r\n    }\r\n\r\n    @Test\r\n    @SuppressWarnings(\"unchecked\")\r\n    public void should_count_by_like()\r\n    {\r\n        // given\r\n        testData.createSimple(\"testFindAll1\");\r\n        testData.createSimple(\"testFindAll2\");\r\n        Simple example = new Simple(\"test\");\r\n\r\n        // when\r\n        Long count = repo.countLike(example, Simple_.name);\r\n\r\n        // then\r\n        assertEquals(Long.valueOf(2), count);\r\n    }\r\n\r\n    @Test\r\n    public void should_remove()\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testRemove\");\r\n\r\n        // when\r\n        repo.remove(simple);\r\n        repo.flush();\r\n        Simple lookup = getEntityManager().find(Simple.class, simple.getId());\r\n\r\n        // then\r\n        assertNull(lookup);\r\n    }\r\n\r\n    @Test\r\n    public void should_remove_and_flush() {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testRemoveAndFlush\");\r\n\r\n        // when\r\n        repo.removeAndFlush(simple);\r\n        Simple lookup = getEntityManager().find(Simple.class, simple.getId());\r\n\r\n        // then\r\n        assertNull(lookup);\r\n    }\r\n\r\n    @Test\r\n    public void should_remove_detach_entity() {\r\n        //given\r\n        Simple simple = testData.createSimple(\"testeAttachAndRemove\");\r\n\r\n        //when\r\n        repo.detach(simple);\r\n        repo.attachAndRemove(simple);\r\n        repo.flush();\r\n        Simple lookup = getEntityManager().find(Simple.class, simple.getId());\r\n\r\n        // then\r\n        assertNull(lookup);\r\n    }\r\n\r\n    @Test\r\n    public void should_return_table_name()\r\n    {\r\n        final String tableName = repoAbstract.getTableName();\r\n        final String tableName2 = repoAbstract2.getTableName();\r\n\r\n        assertEquals(\"SIMPLE_TABLE\", tableName);\r\n        assertEquals(Simple2.class.getSimpleName(), tableName2);\r\n    }\r\n\r\n    @Test\r\n    public void should_return_entity_name()\r\n    {\r\n        final String entityName = repoAbstract.getEntityName();\r\n        final String entityName2 = repoAbstract4.getEntityName();\r\n\r\n        assertEquals(\"Simple\", entityName);\r\n        assertEquals(\"EntitySimple4\", entityName2);\r\n    }\r\n\r\n    @Test\r\n    public void should_return_entity_primary_key()\r\n    {\r\n        //given\r\n        Simple simple = testData.createSimple(\"should_return_entity_primary_key\");\r\n        Long id = simple.getId();\r\n\r\n        //when\r\n        Long primaryKey = repo.getPrimaryKey(simple);\r\n\r\n        // then\r\n        assertNotNull(primaryKey);\r\n        assertEquals(id, primaryKey);\r\n    }\r\n\r\n    @Test\r\n    public void should_return_null_primary_key()\r\n    {\r\n        //given\r\n        Simple simple = new Simple(\"should_return_null_primary_key\");\r\n\r\n        //when\r\n        Long primaryKey = repo.getPrimaryKey(simple);\r\n\r\n        // then\r\n        assertNull(primaryKey);\r\n    }\r\n\r\n    @Test\r\n    public void should_return_entity_primary_key_detached_entity()\r\n    {\r\n        //given\r\n        Simple simple = testData.createSimple(\"should_return_entity_primary_key\");\r\n        Long id = simple.getId();\r\n\r\n        //when\r\n        getEntityManager().detach(simple);\r\n        Long primaryKey = repo.getPrimaryKey(simple);\r\n\r\n        // then\r\n        assertNotNull(primaryKey);\r\n        assertEquals(id, primaryKey);\r\n    }\r\n\r\n    @Test\r\n    public void should_query_with_hints()\r\n    {\r\n        Simple simple = testData.createSimple(\"should_return_entity_primary_key\");\r\n        Long id = simple.getId();\r\n\r\n        getEntityManager().flush();\r\n        getEntityManager().clear();\r\n\r\n        Simple found = intermediate.findBy(id);\r\n\r\n        assertEquals(id, found.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_query_names()\r\n    {\r\n        String name = \"should_return_entity_primary_key\";\r\n        testData.createSimple(name);\r\n\r\n        List<String> names = intermediate.findAllNames();\r\n\r\n        assertEquals(name, names.get(0));\r\n    }\r\n\r\n    @Test\r\n    public void should_query_by_name()\r\n    {\r\n        String name = \"should_return_entity_primary_key\";\r\n        Simple simple = testData.createSimple(name);\r\n\r\n        Simple byName = stringIdRepo.findByName(name);\r\n\r\n        assertEquals(simple, byName);\r\n    }\r\n\r\n    @Test\r\n    public void should_query_list_by_name()\r\n    {\r\n        String name = \"should_return_entity_primary_key\";\r\n        Simple simple = testData.createSimple(name);\r\n\r\n        List<Simple> byName = stringIdRepo.findByName2(name);\r\n\r\n        assertEquals(byName.size(), 1);\r\n        assertEquals(simple, byName.get(0));\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/FullEntityRepositoryTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\r\nimport static org.junit.Assert.assertEquals;\r\nimport static org.junit.Assert.assertNotNull;\r\n\r\nimport jakarta.inject.Inject;\r\n\r\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.service.FullRepositoryAbstract;\r\nimport org.apache.deltaspike.data.test.service.FullRepositoryInterface;\r\nimport org.apache.deltaspike.test.category.WebProfileCategory;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.shrinkwrap.api.Archive;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\n\r\n@Category(WebProfileCategory.class)\r\npublic class FullEntityRepositoryTest extends TransactionalTestCase\r\n{\r\n\r\n    @Deployment\r\n    public static Archive<?> deployment()\r\n    {\r\n        return initDeployment()\r\n                .addClasses(FullRepositoryInterface.class)\r\n                .addClasses(FullRepositoryAbstract.class)\r\n                .addPackage(Simple.class.getPackage());\r\n    }\r\n\r\n    @Inject\r\n    private FullRepositoryInterface repo;\r\n\r\n    @Inject\r\n    private FullRepositoryAbstract repoAbstract;\r\n\r\n    @Test\r\n    public void should_save() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        simple = repo.save(simple);\r\n\r\n        // then\r\n        assertNotNull(simple.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_save_abstract() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        simple = repoAbstract.save(simple);\r\n\r\n        // then\r\n        assertNotNull(simple.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_persist() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        repo.persist(simple);\r\n\r\n        // then\r\n        assertNotNull(simple.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_persist_abstract() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        repoAbstract.persist(simple);\r\n\r\n        // then\r\n        assertNotNull(simple.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_save_with_merge() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testMerge\");\r\n        Long id = simple.getId();\r\n\r\n        // when\r\n        final String newName = \"testMergeUpdated\";\r\n        simple.setName(newName);\r\n        simple = repo.save(simple);\r\n\r\n        // then\r\n        assertEquals(id, simple.getId());\r\n        assertEquals(newName, simple.getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_save_with_merge_abstract() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testMerge\");\r\n        Long id = simple.getId();\r\n\r\n        // when\r\n        final String newName = \"testMergeUpdated\";\r\n        simple.setName(newName);\r\n        simple = repoAbstract.save(simple);\r\n\r\n        // then\r\n        assertEquals(id, simple.getId());\r\n        assertEquals(newName, simple.getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_merge() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testMerge\");\r\n        Long id = simple.getId();\r\n\r\n        // when\r\n        final String newName = \"testMergeUpdated\";\r\n        simple.setName(newName);\r\n        simple = repo.merge(simple);\r\n\r\n        // then\r\n        assertEquals(id, simple.getId());\r\n        assertEquals(newName, simple.getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_merge_abstract() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = testData.createSimple(\"testMerge\");\r\n        Long id = simple.getId();\r\n\r\n        // when\r\n        final String newName = \"testMergeUpdated\";\r\n        simple.setName(newName);\r\n        simple = repoAbstract.merge(simple);\r\n\r\n        // then\r\n        assertEquals(id, simple.getId());\r\n        assertEquals(newName, simple.getName());\r\n    }\r\n\r\n    @Test\r\n    public void should_save_and_flush() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"test\");\r\n\r\n        // when\r\n        simple = repo.saveAndFlush(simple);\r\n        Simple fetch = (Simple) getEntityManager()\r\n                .createNativeQuery(\"select * from SIMPLE_TABLE where id = ?\", Simple.class)\r\n                .setParameter(1, simple.getId())\r\n                .getSingleResult();\r\n\r\n        // then\r\n        assertEquals(simple.getId(), fetch.getId());\r\n    }\r\n\r\n    @Test\r\n    public void should_find_by_criteria() throws Exception\r\n    {\r\n        // given\r\n        Simple simple = new Simple(\"criteria\");\r\n        \r\n        // when\r\n        simple = repoAbstract.saveAndFlush(simple);\r\n        Simple fetch = repoAbstract.fetchByName(\"criteria\");\r\n\r\n        // then\r\n        assertEquals(simple.getId(), fetch.getId());\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/NamedQualifiedEntityManagerTestProducer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport org.apache.deltaspike.data.test.util.EntityManagerProducer;\r\n\r\nimport jakarta.enterprise.inject.Produces;\r\nimport jakarta.enterprise.inject.Specializes;\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.persistence.PersistenceContext;\r\n\r\n@Specializes\r\npublic class NamedQualifiedEntityManagerTestProducer extends EntityManagerProducer\r\n{\r\n\r\n    @Produces\r\n    @PersistenceContext(unitName = \"test\")\r\n    private EntityManager entityManager;\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/NonQualifiedEntityManagerTestProducer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.impl.handler;\r\n\r\nimport jakarta.enterprise.inject.Default;\r\nimport jakarta.enterprise.inject.Produces;\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.persistence.PersistenceContext;\r\n\r\n@Default\r\npublic class NonQualifiedEntityManagerTestProducer\r\n{\r\n\r\n    @Produces\r\n    @PersistenceContext\r\n    private EntityManager entityManager;\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/QualifiedEntityManagerTestProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport java.util.Map;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityGraph;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.EntityTransaction;\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.Query;\nimport jakarta.persistence.StoredProcedureQuery;\nimport jakarta.persistence.TypedQuery;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaDelete;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.CriteriaUpdate;\nimport jakarta.persistence.metamodel.Metamodel;\nimport java.util.List;\n\nimport org.apache.deltaspike.data.test.service.Simplistic;\n\npublic class QualifiedEntityManagerTestProducer\n{\n\n    @Produces\n    @Simplistic\n    private final EntityManager entityManager = new EntityManager()\n    {\n\n        @Override\n        public <T> T unwrap(Class<T> arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void setProperty(String arg0, Object arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void setFlushMode(FlushModeType arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void remove(Object arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void refresh(Object arg0, LockModeType arg1, Map<String, Object> arg2)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void refresh(Object arg0, LockModeType arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void refresh(Object arg0, Map<String, Object> arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void refresh(Object arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void persist(Object arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> T merge(T arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void lock(Object arg0, LockModeType arg1, Map<String, Object> arg2)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void lock(Object arg0, LockModeType arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void joinTransaction()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public boolean isOpen()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public EntityTransaction getTransaction()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> T getReference(Class<T> arg0, Object arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Map<String, Object> getProperties()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Metamodel getMetamodel()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public LockModeType getLockMode(Object arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public FlushModeType getFlushMode()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public EntityManagerFactory getEntityManagerFactory()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Object getDelegate()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public CriteriaBuilder getCriteriaBuilder()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void flush()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2, Map<String, Object> arg3)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> T find(Class<T> arg0, Object arg1, Map<String, Object> arg2)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> T find(Class<T> arg0, Object arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void detach(Object arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> TypedQuery<T> createQuery(String arg0, Class<T> arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> TypedQuery<T> createQuery(CriteriaQuery<T> arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Query createQuery(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Query createNativeQuery(String arg0, String arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @SuppressWarnings(\"rawtypes\")\n        @Override\n        public Query createNativeQuery(String arg0, Class arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Query createNativeQuery(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> TypedQuery<T> createNamedQuery(String arg0, Class<T> arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Query createNamedQuery(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public boolean contains(Object arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void close()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public void clear()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Query createQuery(CriteriaUpdate arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public Query createQuery(CriteriaDelete arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public StoredProcedureQuery createNamedStoredProcedureQuery(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public StoredProcedureQuery createStoredProcedureQuery(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public StoredProcedureQuery createStoredProcedureQuery(String arg0, Class... arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public StoredProcedureQuery createStoredProcedureQuery(String arg0, String... arg1)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public boolean isJoinedToTransaction()\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> EntityGraph<T> createEntityGraph(Class<T> arg0)\n            {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public EntityGraph<?> createEntityGraph(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public EntityGraph<?> getEntityGraph(String arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n\n        @Override\n        public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> arg0)\n        {\n            throw new UnsupportedOperationException();\n        }\n    };\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/QueryHandlerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.handler;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\n\nimport java.util.List;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.NonUniqueResultException;\n\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.Simple2;\nimport org.apache.deltaspike.data.test.domain.SimpleBuilder;\nimport org.apache.deltaspike.data.test.service.Simple2Repository;\nimport org.apache.deltaspike.data.test.service.SimpleRepository;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class QueryHandlerTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(SimpleRepository.class, Simple2Repository.class)\n                .addPackage(Simple.class.getPackage());\n    }\n\n    @Inject\n    private SimpleRepository repo;\n\n    @Inject\n    private Simple2Repository repo2;\n\n    private SimpleBuilder builder;\n\n    @Test\n    public void should_delegate_to_implementation()\n    {\n        // given\n        final String name = \"testDelegateToImplementation\";\n        builder.createSimple(name);\n\n        // when\n        List<Simple> result = repo.implementedQueryByName(name);\n\n        // then\n        assertNotNull(result);\n        assertEquals(1, result.size());\n    }\n\n    @Test\n    public void should_create_named_query_index()\n    {\n        // given\n        final String name = \"testCreateNamedQueryIndex\";\n        builder.createSimple(name);\n\n        // when\n        List<Simple> result = repo.findByNamedQueryIndexed(name, Boolean.TRUE);\n\n        // then\n        assertNotNull(result);\n        assertEquals(1, result.size());\n        assertEquals(name, result.get(0).getName());\n    }\n\n    @Test\n    public void should_create_named_query_named()\n    {\n        // given\n        final String name = \"testCreateNamedQueryNamed\";\n        Simple simple = builder.createSimple(name);\n\n        // when\n        Simple result = repo.findByNamedQueryNamed(simple.getId(), Boolean.TRUE);\n\n        // then\n        assertNotNull(result);\n        assertEquals(name, result.getName());\n    }\n\n    @Test\n    public void should_run_annotated_query()\n    {\n        // given\n        final String name = \"testRunAnnotatedQuery\";\n        builder.createSimple(name);\n\n        // when\n        Simple result = repo.findByQuery(name);\n\n        // then\n        assertNotNull(result);\n        assertEquals(name, result.getName());\n    }\n\n    @Test\n    public void should_create_query_by_method_name()\n    {\n        // given\n        final String name = \"testCreateQueryByMethodName\";\n        builder.createSimple(name);\n\n        // when\n        Simple result = repo.findByNameAndEnabled(name, Boolean.TRUE);\n\n        // then\n        assertNotNull(result);\n        assertEquals(name, result.getName());\n    }\n\n    @Test\n    public void should_create_query_delete_by_method_name()\n    {\n        // given\n        final String name = \"testCreateQueryByMethodName\";\n        builder.createSimple(name);\n\n        // when\n        repo.deleteByName(name);\n        repo.flush();\n        Simple result = repo.findAnyByName(name);\n\n        // then\n        assertNull(result);\n    }\n\n    @Test\n    public void should_create_query_remove_by_method_name()\n    {\n        // given\n        final String name = \"testCreateQueryByMethodName\";\n        builder.createSimple(name);\n\n        // when\n        repo.removeByName(name);\n        repo.flush();\n        Simple result = repo.findAnyByName(name);\n\n        // then\n        assertNull(result);\n    }\n\n    @Test\n    public void should_create_query_remove_by_method_name_with_multiply_params()\n    {\n        // given\n        final String name = \"testCreateQueryByMethodName\";\n        builder.createSimple(name);\n\n        // when\n        repo.removeByNameAndEnabled(name, Boolean.TRUE);\n        repo.flush();\n        Simple result = repo.findAnyByName(name);\n\n        // then\n        assertNull(result);\n    }\n\n    @Test\n    public void should_create_query_delete_by_method_name_with_multiply_params()\n    {\n        // given\n        final String name = \"testCreateQueryByMethodName\";\n        builder.createSimple(name);\n\n        // when\n        repo.deleteByNameAndEnabled(name, Boolean.TRUE);\n        repo.flush();\n        Simple result = repo.findAnyByName(name);\n\n        // then\n        assertNull(result);\n    }\n\n    @Test\n    public void should_restrict_result_size_by_annotation()\n    {\n        // given\n        final String name = \"testRestrictResultSizeByAnnotation\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        List<Simple> result = repo.findByNamedQueryIndexed(name, Boolean.TRUE);\n\n        // then\n        assertNotNull(result);\n        assertEquals(1, result.size());\n    }\n\n    @Test\n    public void should_restrict_result_size_by_parameters()\n    {\n        // given\n        final String name = \"testRestrictResultSizeByParameters\";\n        builder.createSimple(name);\n        Simple second = builder.createSimple(name);\n\n        // when\n        List<Simple> result = repo.findByNamedQueryRestricted(name, Boolean.TRUE, 1, 1);\n\n        // then\n        assertNotNull(result);\n        assertEquals(1, result.size());\n        assertEquals(second.getId(), result.get(0).getId());\n    }\n\n    @Test\n    public void should_work_with_2nd_repo()\n    {\n        // given\n        final String name = \"testWorkWith2ndRepository\";\n        Simple2 simple = createSimple2(name);\n\n        // when\n        Simple2 result = repo2.findByName(name);\n\n        // then\n        assertNotNull(result);\n        assertEquals(simple.getId(), result.getId());\n        assertEquals(name, result.getName());\n    }\n\n    @Test\n    public void should_return_aggregate()\n    {\n        // given\n        final String name = \"testReturnAggregate\";\n        builder.createSimple(name);\n\n        // when\n        Long result = repo.findCountByQuery(name);\n\n        // then\n        assertNotNull(result);\n    }\n\n    @Test\n    public void should_find_with_native_query()\n    {\n        // given\n        final String name = \"testFindWithNativeQuery\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        List<Simple> result = repo.findWithNative(name);\n\n        // then\n        assertNotNull(result);\n        assertEquals(2, result.size());\n        assertTrue(result.get(0) instanceof Simple);\n        assertEquals(name, result.get(0).getName());\n    }\n\n    @Test\n    public void should_order_result_by_method_order_by()\n    {\n        // given\n        final String name = \"testFindWithNativeQuery\";\n        builder.createSimple(name, Integer.valueOf(33));\n        builder.createSimple(name, Integer.valueOf(66));\n        builder.createSimple(name, Integer.valueOf(66));\n        builder.createSimple(name, Integer.valueOf(22));\n        builder.createSimple(name, Integer.valueOf(55));\n\n        // when\n        List<Simple> result = repo.findByOrderByCounterAscIdDesc();\n\n        // then\n        assertNotNull(result);\n        assertFalse(result.isEmpty());\n        long lastId = Long.MAX_VALUE;\n        int lastCounter = Integer.MIN_VALUE;\n        for (Simple simple : result)\n        {\n            long currentId = simple.getId().longValue();\n            int currentCounter = simple.getCounter().intValue();\n            if (currentCounter == lastCounter)\n            {\n                assertTrue(currentId < lastId);\n            }\n            else\n            {\n                assertTrue(currentCounter > lastCounter);\n            }\n            lastId = currentId;\n            lastCounter = currentCounter;\n        }\n    }\n\n    @Test\n    public void should_execute_update()\n    {\n        // given\n        final String name = \"testFindWithNativeQuery\";\n        final String newName = \"testFindWithNativeQueryUpdated\" + System.currentTimeMillis();\n        Simple s = builder.createSimple(name);\n\n        // when\n        int count = repo.updateNameForId(newName, s.getId());\n\n        // then\n        assertEquals(1, count);\n    }\n\n    @Test\n    public void should_create_optinal_query_by_name()\n    {\n        // given\n        final String name = \"should_create_optinal_query_by_name\";\n        builder.createSimple(name);\n\n        // when\n        Simple result1 = repo.findOptionalByName(name);\n        Simple result2 = repo.findOptionalByName(name + \"_doesnt_exist\");\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test\n    public void should_create_optinal_query_by_annotation()\n    {\n        // given\n        final String name = \"should_create_optinal_query_by_annotation\";\n        builder.createSimple(name);\n\n        // when\n        Simple result1 = repo.findByNameOptional(name);\n        Simple result2 = repo.findByNameOptional(name + \"_doesnt_exist\");\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test(expected = NonUniqueResultException.class)\n    public void should_fail_optinal_query_by_name_with_nonunique()\n    {\n        // given\n        final String name = \"should_fail_optinal_query_by_name_with_nonunique\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        repo.findOptionalByName(name);\n    }\n\n    @Test(expected = NonUniqueResultException.class)\n    public void should_fail_optinal_query_by_annotation_with_nonunique()\n    {\n        // given\n        final String name = \"should_fail_optinal_query_by_annotation_with_nonunique\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        repo.findByNameOptional(name);\n    }\n\n    @Test\n    public void should_create_any_query_by_name()\n    {\n        // given\n        final String name = \"should_create_any_query_by_name\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        Simple result1 = repo.findAnyByName(name);\n        Simple result2 = repo.findAnyByName(name + \"_doesnt_exist\");\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test\n    public void should_create_any_query_by_annotation()\n    {\n        // given\n        final String name = \"should_create_any_query_by_annotation\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n\n        // when\n        Simple result1 = repo.findByNameAny(name);\n        Simple result2 = repo.findByNameAny(name + \"_doesnt_exist\");\n\n        // then\n        assertNotNull(result1);\n        assertEquals(name, result1.getName());\n        assertNull(result2);\n    }\n\n    @Test\n    public void should_create_case_insensitive_query_for_like_comparator()\n    {\n        // given\n        final String name = \"Should_Create_Case_Insensitive_Query_For_Like\";\n        builder.createSimple(name);\n\n        // when\n        Simple result = repo.findByNameLikeIgnoreCase(\"should_create_CASE_Insensitive_QUERY_for_l%\");\n\n        // then\n        assertEquals(name, result.getName());\n    }\n\n    @Test\n    public void should_create_case_insensitive_query_for_equals_comparator()\n    {\n        // given\n        final String name = \"Should_Create_Case_Insensitive_Query_for_Equals\";\n        builder.createSimple(name);\n\n        // when\n        Simple result = repo.findByNameIgnoreCase(name.toLowerCase());\n\n        // then\n        assertEquals(name, result.getName());\n    }\n\n    @Test\n    public void should_find_first_2()\n    {\n        final String name = \"Should_Create_Case_Insensitive_Query_for_Equals\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n        builder.createSimple(name);\n        builder.createSimple(\"this is something else\");\n\n        List<Simple> result = repo.findFirst2ByName(name);\n\n        assertEquals(2, result.size());\n    }\n\n    @Test\n    public void should_find_top_2()\n    {\n        final String name = \"Should_Create_Case_Insensitive_Query_for_Equals\";\n        builder.createSimple(name);\n        builder.createSimple(name);\n        builder.createSimple(name);\n        builder.createSimple(\"this is something else\");\n\n        List<Simple> result = repo.findTop2ByName(name);\n\n        assertEquals(2, result.size());\n    }\n\n    @Test\n    public void should_find_top_3_ordered()\n    {\n        builder.createSimple(\"zebra\");\n        builder.createSimple(\"willow\");\n        builder.createSimple(\"kangaroo\");\n        builder.createSimple(\"bologna\");\n\n        List<Simple> result = repo.findFirst3OrderByName();\n\n        assertEquals(\"bologna\", result.get(0).getName());\n        assertEquals(\"kangaroo\", result.get(1).getName());\n        assertEquals(\"willow\", result.get(2).getName());\n    }\n\n    @Test\n    public void should_find_all_ordered()\n    {\n        builder.createSimple(\"zebra\");\n        builder.createSimple(\"willow\");\n        builder.createSimple(\"kangaroo\");\n        builder.createSimple(\"bologna\");\n\n        List<Simple> result = repo.findAllOrderByName();\n\n        assertEquals(\"bologna\", result.get(0).getName());\n        assertEquals(\"kangaroo\", result.get(1).getName());\n        assertEquals(\"willow\", result.get(2).getName());\n        assertEquals(\"zebra\", result.get(3).getName());\n    }\n    \n    @Test\n    public void should_count_by_name()\n    {\n        builder.createSimple(\"zebra\");\n        builder.createSimple(\"zebra\");\n        builder.createSimple(\"willow\");\n        builder.createSimple(\"kangaroo\");\n        builder.createSimple(\"kangaroo\");\n        builder.createSimple(\"kangaroo\");\n        builder.createSimple(\"bologna\");\n\n        assertEquals(repo.countByName(\"bologna\"), 1);\n        assertEquals(repo.countByName(\"kangaroo\"), 3);\n        assertEquals(repo.countByName(\"willow\"), 1);\n        assertEquals(repo.countByName(\"zebra\"), 2);\n    }\n\n    @Before\n    public void setup()\n    {\n        builder = new SimpleBuilder(getEntityManager());\n    }\n\n    private Simple2 createSimple2(String name)\n    {\n        Simple2 result = new Simple2(name);\n        getEntityManager().persist(result);\n        getEntityManager().flush();\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/mapping/MappedRepositoryTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.mapping;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\n\nimport java.util.List;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.Simple_;\nimport org.apache.deltaspike.data.test.domain.dto.BooleanWrapper;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleDto;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleId;\nimport org.apache.deltaspike.data.test.service.SimpleMappedDtoRepository;\nimport org.apache.deltaspike.data.test.service.SimpleMappedRepository;\nimport org.apache.deltaspike.data.test.service.SimpleMapper;\nimport org.apache.deltaspike.data.test.service.SimpleQueryInOutMapper;\nimport org.apache.deltaspike.data.test.service.WrappedMapper;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class MappedRepositoryTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(\n                        SimpleMappedRepository.class,\n                        SimpleMappedDtoRepository.class,\n                        SimpleMapper.class,\n                        WrappedMapper.class,\n                        SimpleQueryInOutMapper.class)\n                .addPackages(false,\n                        Simple.class.getPackage(),\n                        SimpleDto.class.getPackage());\n    }\n\n    @Inject\n    private SimpleMappedRepository repository;\n\n    @Inject\n    private SimpleMappedDtoRepository dtoRepository;\n\n    @Test\n    public void should_map_entityrepo_methods()\n    {\n        // given\n        SimpleDto dto = new SimpleDto();\n        dto.setName(\"should_map_entityrepo_methods\");\n        dto.setEnabled(Boolean.TRUE);\n\n        // when\n        SimpleDto saved = repository.saveAndFlush(dto);\n        SimpleDto loadedDto = repository.findBy(saved.getId());\n        Simple loaded = getEntityManager().find(Simple.class, saved.getId().getId());\n\n        // then\n        assertNotNull(loadedDto);\n        assertNotNull(loaded);\n        assertEquals(saved.getName(), loaded.getName());\n        assertEquals(saved.getEnabled(), loaded.getEnabled());\n    }\n\n    @Test\n    public void should_map_method_expression()\n    {\n        // given\n        Simple simple = new Simple(\"should_map_method_expression\");\n        simple.setEnabled(Boolean.TRUE);\n        getEntityManager().persist(simple);\n\n        // when\n        List<SimpleDto> result = repository.findByEnabled(Boolean.TRUE);\n\n        // then\n        boolean found = false;\n        for (SimpleDto dto : result)\n        {\n            if (dto.getName().equals(simple.getName()))\n            {\n                found = true;\n                break;\n            }\n        }\n        assertTrue(found);\n    }\n\n    @Test\n    public void should_override_class_config_with_method_config()\n    {\n        // given\n        Simple simple = new Simple(\"should_map_method_expression\");\n        simple.setEnabled(Boolean.TRUE);\n        getEntityManager().persist(simple);\n\n        // when\n        List<SimpleDto> result = repository.findByEnabled(new BooleanWrapper(Boolean.TRUE));\n\n        // then\n        boolean found = false;\n        for (SimpleDto dto : result)\n        {\n            if (dto.getName().equals(simple.getName()))\n            {\n                found = true;\n                break;\n            }\n        }\n        assertTrue(found);\n    }\n\n    @Test\n    public void should_find_with_queryresult()\n    {\n        // given\n        final String name = \"should_find_with_queryresult\";\n        Simple simple = new Simple(name);\n        simple.setEnabled(Boolean.TRUE);\n        getEntityManager().persist(simple);\n\n        // when\n        List<SimpleDto> result = repository.findByNameToo(name)\n                .changeOrder(Simple_.name.getName())\n                .getResultList();\n\n        // then\n        assertTrue(result.size() > 0);\n    }\n\n    @Test\n    public void should_save_new_entity_with_simplemapper()\n    {\n        // given\n        SimpleDto dto = new SimpleDto();\n        dto.setName(\"should_save_new_entity_with_simplemapper\");\n        dto.setEnabled(Boolean.TRUE);\n\n        // when\n        SimpleDto result = dtoRepository.save(dto);\n\n        // then\n        assertNotNull(result);\n        assertNotNull(result.getId());\n    }\n\n    @Test\n    public void should_update_existing_entity_with_simplemapper()\n    {\n        // given\n        final String name = \"should_update_existing_entity_with_simplemapper\";\n        Simple simple = new Simple(name);\n        simple.setEnabled(Boolean.TRUE);\n        getEntityManager().persist(simple);\n\n        SimpleDto dto = new SimpleDto();\n        dto.setName(name + \"_updated\");\n        dto.setEnabled(Boolean.TRUE);\n        dto.setId(new SimpleId(simple.getId()));\n\n        // when\n        dtoRepository.save(dto);\n        Simple lookup = getEntityManager().find(Simple.class, simple.getId());\n\n        // then\n        assertNotNull(lookup);\n        assertEquals(name + \"_updated\", lookup.getName());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/MethodPrefixTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class MethodPrefixTest\n{\n    @Test\n    public void shouldParseArbitraryMethodFindPrefix()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findTop20ByName\");\n\n        String resultingQuery = methodPrefix.removePrefix(\"findTop20ByName\");\n\n        assertEquals(\"Name\", resultingQuery);\n    }\n\n    @Test\n    public void shouldParseFirst20MethodFindPrefix()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findFirst20ByName\");\n\n        String resultingQuery = methodPrefix.removePrefix(\"findFirst20ByName\");\n\n        assertEquals(\"Name\", resultingQuery);\n    }\n\n    @Test\n    public void shouldParseDefinedMaxResults()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findFirst20ByName\");\n\n        int maxResults = methodPrefix.getDefinedMaxResults();\n\n        assertEquals(20, maxResults);\n    }\n\n    @Test\n    public void shouldNotParseNonMatchingMethodName()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findAnyByName\");\n\n        int maxResults = methodPrefix.getDefinedMaxResults();\n\n        assertEquals(0, maxResults);\n    }\n\n    @Test\n    public void shouldParseOrderByEmailDesc()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findFirst3OrderByEmailDesc\");\n\n        String resultingQuery = methodPrefix.removePrefix(\"findFirst3OrderByEmailDesc\");\n\n        assertEquals(\"OrderByEmailDesc\", resultingQuery);\n    }\n\n    @Test\n    public void shouldParseOrderByEmail()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findFirst3OrderByEmail\");\n\n        String resultingQuery = methodPrefix.removePrefix(\"findFirst3OrderByEmail\");\n\n        assertEquals(\"OrderByEmail\", resultingQuery);\n    }\n\n    @Test\n    public void shouldParseFindAllOrderByName()\n    {\n        RepositoryMethodPrefix methodPrefix = new RepositoryMethodPrefix(\"\",\"findAllOrderByName\");\n\n        String resultingQuery = methodPrefix.removePrefix(\"findAllOrderByName\");\n\n        assertEquals(\"OrderByName\", resultingQuery);\n    }\n\n}"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/unit/DescriptorHierarchyBuilderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta.unit;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\n\nimport java.util.LinkedList;\nimport java.util.List;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.AbstractEntityHierarchyBuilder;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.EntityDescriptor;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.MappedSuperclassDescriptor;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class DescriptorHierarchyBuilderTest\n{\n\n    private final List<EntityDescriptor> entities = new LinkedList<EntityDescriptor>();\n    private final List<MappedSuperclassDescriptor> superClasses = new LinkedList<MappedSuperclassDescriptor>();\n\n    @Before\n    public void before()\n    {\n        entities.add(new EntityDescriptor(null, null, \"test\", EntityLevel3.class, null, null, null));\n        entities.add(new EntityDescriptor(null, null, \"test\", EntityLevel5.class, null, null, null));\n\n        superClasses.add(new MappedSuperclassDescriptor(new String[] { \"id\" }, null, \"test\", MappedLevel1.class,\n            null, null));\n        superClasses.add(new MappedSuperclassDescriptor(null, null, \"test\", MappedLevel4.class, null, null));\n        superClasses.add(new MappedSuperclassDescriptor(null, null, \"test\", MappedUnrelated.class, null, null));\n        superClasses.add(new MappedSuperclassDescriptor(null, null, \"test\", MappedLevel2.class, null, null));\n    }\n\n    @Test\n    public void should_build_hierarchy()\n    {\n        // when\n        AbstractEntityHierarchyBuilder.buildHierarchy(entities, superClasses);\n\n        // then\n        assertEquals(entities.size(), 2);\n        assertEquals(EntityLevel3.class, entities.get(0).getEntityClass());\n        assertEquals(EntityLevel5.class, entities.get(1).getEntityClass());\n        assertEquals(MappedLevel2.class, entities.get(0).getParent().getEntityClass());\n        assertEquals(MappedLevel4.class, entities.get(1).getParent().getEntityClass());\n\n        assertEquals(superClasses.size(), 4);\n        assertNull(superClasses.get(0).getParent());\n        assertEquals(EntityLevel3.class, superClasses.get(1).getParent().getEntityClass());\n        assertNull(superClasses.get(2).getParent());\n        assertEquals(MappedLevel1.class, superClasses.get(3).getParent().getEntityClass());\n    }\n\n    private static class MappedLevel1\n    {\n        @SuppressWarnings(\"unused\")\n        private Long id;\n    }\n\n    private static class MappedLevel2 extends MappedLevel1\n    {\n    }\n\n    private static class EntityLevel3 extends MappedLevel2\n    {\n    }\n\n    private static class MappedLevel4 extends EntityLevel3\n    {\n    }\n\n    private static class EntityLevel5 extends MappedLevel4\n    {\n    }\n\n    private static class MappedUnrelated\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/unit/OrmXmlBasedRepositoryTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta.unit;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertEquals;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.mapped.MappedOne;\nimport org.apache.deltaspike.data.test.service.MappedOneRepository;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ArchivePaths;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class OrmXmlBasedRepositoryTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(MappedOneRepository.class)\n                .addAsLibraries(\n                        ShrinkWrap.create(JavaArchive.class, \"domain.jar\")\n                                .addPackage(MappedOne.class.getPackage())\n                                .addAsResource(\"test-custom-orm.xml\", ArchivePaths.create(\"META-INF/custom-orm.xml\"))\n                )\n                .addAsWebInfResource(\"test-mapped-persistence.xml\",\n                        ArchivePaths.create(\"classes/META-INF/persistence.xml\"))\n                .addAsWebInfResource(\"test-default-orm.xml\", ArchivePaths.create(\"classes/META-INF/orm.xml\"));\n    }\n\n    @Inject\n    private MappedOneRepository mappedOneRepository;\n\n    @Test\n    public void should_find_by()\n    {\n        // given\n        MappedOne one = createMappedOne(\"shouldFindBy\");\n\n        // when\n        MappedOne byPk = mappedOneRepository.findBy(one.getId());\n        MappedOne byName = mappedOneRepository.findByName(\"shouldFindBy\");\n\n        // then\n        assertEquals(one.getId(), byPk.getId());\n        assertEquals(one.getId(), byName.getId());\n    }\n\n    private MappedOne createMappedOne(String name)\n    {\n        MappedOne result = new MappedOne(name);\n        getEntityManager().persist(result);\n        getEntityManager().flush();\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/unit/PersistenceUnitsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.meta.unit;\n\nimport org.apache.deltaspike.data.impl.meta.EntityMetadata;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\n\nimport org.apache.deltaspike.data.impl.util.EntityUtils;\nimport org.apache.deltaspike.data.test.domain.Parent;\nimport org.apache.deltaspike.data.test.domain.TeeId;\nimport org.apache.deltaspike.data.test.domain.mapped.MappedOne;\nimport org.apache.deltaspike.data.test.domain.mapped.MappedThree;\nimport org.apache.deltaspike.data.test.domain.mapped.MappedTwo;\nimport org.apache.deltaspike.data.test.service.MappedOneRepository;\nimport org.apache.deltaspike.data.test.util.TestDeployments;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.EntityDescriptor;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptorProvider;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class PersistenceUnitsTest\n{    \n    @Deployment\n    public static Archive<?> deployment()\n    {\n        WebArchive war = TestDeployments.initDeployment();\n\n        war.delete(\"WEB-INF/classes/META-INF/persistence.xml\");\n\n        return war.addPackages(true, Parent.class.getPackage())\n                .addClasses(MappedOneRepository.class)\n                .addAsWebInfResource(\"test-mapped-persistence.xml\",\n                        \"classes/META-INF/persistence.xml\")\n                .addAsWebInfResource(\"test-default-orm.xml\", \"classes/META-INF/orm.xml\")\n                .addAsWebInfResource(\"test-custom-orm.xml\", \"classes/META-INF/custom-orm.xml\");\n    }\n\n    @Test\n    public void should_recognize_entity_data()\n    {\n        // given\n\n        // when\n        boolean positive1 = PersistenceUnitDescriptorProvider.getInstance().isEntity(MappedOne.class);\n        boolean positive2 = PersistenceUnitDescriptorProvider.getInstance().isEntity(MappedTwo.class);\n        boolean positive3 = PersistenceUnitDescriptorProvider.getInstance().isEntity(MappedThree.class);\n        boolean negative = PersistenceUnitDescriptorProvider.getInstance().isEntity(Long.class);\n\n        // then\n        assertTrue(positive1);\n        assertTrue(positive2);\n        assertTrue(positive3);\n        assertFalse(negative);\n    }\n\n    @Test\n    public void should_recognize_ids()\n    {\n        // given\n\n        // when\n        String[] idField1 = PersistenceUnitDescriptorProvider.getInstance().primaryKeyFields(MappedOne.class);\n        String[] idField2 = PersistenceUnitDescriptorProvider.getInstance().primaryKeyFields(MappedThree.class);\n\n        // then\n        assertEquals(1, idField1.length);\n        assertEquals(\"id\", idField1[0]);\n        assertEquals(1, idField2.length);\n        assertEquals(\"id\", idField2[0]);\n    }\n\n    @Test\n    public void should_recognize_name()\n    {\n        // given\n\n        // when\n        String name = PersistenceUnitDescriptorProvider.getInstance().entityName(MappedOne.class);\n\n        // then\n        assertEquals(\"Mapped_One\", name);\n    }\n\n    @Test\n    public void should_recognize_id_class()\n    {\n        // given\n\n        // when\n        Class<?> idClass = PersistenceUnitDescriptorProvider.getInstance().primaryKeyIdClass(MappedTwo.class);\n\n        // then\n        assertEquals(TeeId.class, idClass);\n    }\n\n    @Test\n    public void should_prepare_repo_entity()\n    {\n        // given\n\n        // when\n        EntityMetadata entity1 = lookupMetadata(MappedOne.class);\n        EntityMetadata entity2 = lookupMetadata(MappedTwo.class);\n        EntityMetadata entity3 = lookupMetadata(MappedThree.class);\n\n        // then\n        assertNotNull(entity1);\n        assertNotNull(entity2);\n        assertEquals(Long.class, entity1.getPrimaryKeyClass());\n        assertEquals(TeeId.class, entity2.getPrimaryKeyClass());\n        assertEquals(Long.class, entity3.getPrimaryKeyClass());\n    }\n\n    protected EntityMetadata lookupMetadata(Class<?> entityClass)\n    {\n        EntityDescriptor entity = PersistenceUnitDescriptorProvider.getInstance().find(entityClass);\n        if (entity != null)\n        {\n            return new EntityMetadata(entityClass, EntityUtils.primaryKeyClass(entityClass));\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/property/ClassToIntrospect.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.net.URL;\n\npublic class ClassToIntrospect\n{\n    private String name;\n\n    private String p;\n\n    private URL URL;\n\n    public long primitiveProperty = 0;\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public String getP()\n    {\n        return p;\n    }\n\n    public void setP(String p)\n    {\n        this.p = p;\n    }\n\n    public String getTitle()\n    {\n        return \"Hero\";\n    }\n\n    public String get()\n    {\n        return null;\n    }\n\n    public boolean is()\n    {\n        return false;\n    }\n\n    public void getFooBar()\n    {\n    }\n\n    public void setSalary(Double base, Double bonus)\n    {\n    }\n\n    public URL getURL()\n    {\n        return URL;\n    }\n\n    public void setURL(URL URL)\n    {\n        this.URL = URL;\n    }\n\n    public Boolean isValid()\n    {\n        return false;\n    }\n\n    public boolean isValidPrimitiveBoolean()\n    {\n        return false;\n    }\n\n    public long getPrimitiveProperty()\n    {\n        return 0l;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/property/PropertyFromFieldTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport java.lang.reflect.Field;\n\nimport org.apache.deltaspike.data.impl.property.FieldProperty;\nimport org.apache.deltaspike.data.impl.property.Properties;\nimport org.junit.Test;\n\n/**\n * Verify that only valid properties are permitted, as per the JavaBean specification.\n */\npublic class PropertyFromFieldTest\n{\n\n    @Test\n    public void testAccessingPrimitiveTypedFieldProperty() throws Exception\n    {\n        final Field field = ClassToIntrospect.class.getField(\"primitiveProperty\");\n\n        FieldProperty<Object> propertyUT = Properties.createProperty(field);\n        propertyUT.getValue(new ClassToIntrospect());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/property/PropertyFromMethodTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\n\nimport java.lang.reflect.Method;\nimport java.net.URL;\n\nimport org.apache.deltaspike.data.impl.property.MethodProperty;\nimport org.apache.deltaspike.data.impl.property.Properties;\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.junit.Test;\n\n/**\n * Verify that only valid properties are permitted, as per the JavaBean specification.\n * @see http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html\n */\npublic class PropertyFromMethodTest\n{\n\n    @Test\n    public void testValidPropertyGetterMethod() throws Exception\n    {\n        Method getter = ClassToIntrospect.class.getMethod(\"getName\");\n        Property<String> p = Properties.createProperty(getter);\n        assertNotNull(p);\n        assertEquals(\"name\", p.getName());\n        assertEquals(getter, p.getMember());\n    }\n\n    @Test\n    public void testValidPropertySetterMethod() throws Exception\n    {\n        Property<String> p = Properties.createProperty(ClassToIntrospect.class.getMethod(\"setName\", String.class));\n        assertNotNull(p);\n        assertEquals(\"name\", p.getName());\n    }\n\n    @Test\n    public void testReadOnlyProperty() throws Exception\n    {\n        Property<String> p = Properties.createProperty(ClassToIntrospect.class.getMethod(\"getTitle\"));\n        assertNotNull(p);\n        assertEquals(\"title\", p.getName());\n        assertTrue(p.isReadOnly());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testEmptyPropertyGetterMethod() throws Exception\n    {\n        Properties.createProperty(ClassToIntrospect.class.getMethod(\"get\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testEmptyBooleanPropertyGetterMethod() throws Exception\n    {\n        Properties.createProperty(ClassToIntrospect.class.getMethod(\"is\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testNonPrimitiveBooleanPropertyIsMethod() throws Exception\n    {\n        Properties.createProperty(ClassToIntrospect.class.getMethod(\"isValid\"));\n    }\n\n    @Test\n    public void testSingleCharPropertyGetterMethod() throws Exception\n    {\n        Method getter = ClassToIntrospect.class.getMethod(\"getP\");\n        Property<String> p = Properties.createProperty(getter);\n        assertNotNull(p);\n        assertEquals(\"p\", p.getName());\n        assertEquals(getter, p.getMember());\n    }\n\n    @Test\n    public void testSingleCharPropertySetterMethod() throws Exception\n    {\n        Property<String> p = Properties.createProperty(ClassToIntrospect.class.getMethod(\"setP\", String.class));\n        assertNotNull(p);\n        assertEquals(\"p\", p.getName());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testGetterMethodWithVoidReturnType() throws Exception\n    {\n        Properties.createProperty(ClassToIntrospect.class.getMethod(\"getFooBar\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testSetterMethodWithMultipleParameters() throws Exception\n    {\n        Properties.createProperty(ClassToIntrospect.class.getMethod(\"setSalary\", Double.class, Double.class));\n    }\n\n    @Test\n    public void testAcronymProperty() throws Exception\n    {\n        Method getter = ClassToIntrospect.class.getMethod(\"getURL\");\n        Property<URL> p = Properties.createProperty(getter);\n        assertNotNull(p);\n        assertEquals(\"URL\", p.getName());\n        assertEquals(getter, p.getMember());\n    }\n\n    // SOLDER-298\n    @Test\n    public void testPrimitiveBooleanProperty() throws Exception\n    {\n        Property<Boolean> p = Properties.createProperty(ClassToIntrospect.class.getMethod(\"isValidPrimitiveBoolean\"));\n\n        assertNotNull(p);\n    }\n\n    @Test\n    public void testAccessingPrimitiveTypedMethodProperty() throws Exception\n    {\n        final Method method = ClassToIntrospect.class.getMethod(\"getPrimitiveProperty\");\n\n        MethodProperty<Object> propertyUT = Properties.createProperty(method);\n        propertyUT.getValue(new ClassToIntrospect());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/property/query/PropertyQueryTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.property.query;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\n\nimport org.apache.deltaspike.data.impl.property.Property;\nimport org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQueries;\nimport org.apache.deltaspike.data.impl.property.query.PropertyQuery;\nimport org.apache.deltaspike.data.impl.property.query.TypedPropertyCriteria;\nimport org.junit.Test;\n\n/**\n * Validate the property query mechanism.\n */\npublic class PropertyQueryTest\n{\n    /**\n     * Querying for a single result with a criteria that matches multiple properties should throw an exception.\n     *\n     * @see PropertyQuery#getSingleResult()\n     */\n    @Test(expected = RuntimeException.class)\n    public void testNonUniqueSingleResultThrowsException()\n    {\n        PropertyQuery<String> q = PropertyQueries.<String> createQuery(Person.class);\n        q.addCriteria(new TypedPropertyCriteria(String.class));\n        q.getSingleResult();\n    }\n\n    /**\n     * Querying for a single result with a criteria that does not match any properties should throw an exception.\n     *\n     * @see PropertyQuery#getSingleResult()\n     */\n    @Test(expected = RuntimeException.class)\n    public void testEmptySingleResultThrowsException()\n    {\n        PropertyQuery<String> q = PropertyQueries.<String> createQuery(Person.class);\n        q.addCriteria(new TypedPropertyCriteria(Integer.class));\n        q.getSingleResult();\n    }\n\n    /**\n     * Querying for a single result with a criterai that matches exactly one property should return the property.\n     *\n     * @see PropertyQuery#getSingleResult()\n     */\n    @Test\n    public void testSingleResult()\n    {\n        PropertyQuery<String> q = PropertyQueries.<String> createQuery(Person.class);\n        q.addCriteria(new NamedPropertyCriteria(\"name\"));\n        Property<String> p = q.getSingleResult();\n        assertNotNull(p);\n        Person o = new Person();\n        o.setName(\"Trap\");\n        assertEquals(\"Trap\", p.getValue(o));\n    }\n\n    public static class Person\n    {\n\n        private String name;\n        private String title;\n\n        public String getName()\n        {\n            return name;\n        }\n\n        public void setName(String name)\n        {\n            this.name = name;\n        }\n\n        public String getTitle()\n        {\n            return title;\n        }\n\n        public void setTitle(String title)\n        {\n            this.title = title;\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/spi/CdiQuerySpiTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.spi;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertNotNull;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.service.MyEntityRepository;\nimport org.apache.deltaspike.data.test.service.MyEntityRepositoryDelegate;\nimport org.apache.deltaspike.data.test.service.MySimpleRepository;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\n@Category(WebProfileCategory.class)\npublic class CdiQuerySpiTest extends TransactionalTestCase\n{\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(MySimpleRepository.class,\n                        MyEntityRepository.class,\n                        MyEntityRepositoryDelegate.class)\n                .addPackage(Simple.class.getPackage());\n    }\n\n    @Inject\n    private MySimpleRepository repo;\n\n    @Test\n    public void should_call_delegate()\n    {\n        // given\n        Simple simple = new Simple(\"test_call_delegate\");\n\n        // when\n        simple = repo.saveAndFlushAndRefresh(simple);\n\n        // then\n        assertNotNull(simple.getId());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/tx/TransactionalQueryRunnerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.tx;\n\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.service.ExtendedRepositoryInterface;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.junit.InSequence;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@Category(WebProfileCategory.class)\n@RunWith(Arquillian.class)\npublic class TransactionalQueryRunnerTest\n{\n\n    private static final String NAME = \"should_run_in_transaction\";\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment(true, false)\n                .addClasses(ExtendedRepositoryInterface.class)\n                .addClass(TransactionalQueryRunnerWrapper.class)\n                .addPackage(Simple.class.getPackage());\n    }\n\n    @Inject\n    private ExtendedRepositoryInterface repository;\n\n    @Inject\n    private TransactionalQueryRunnerWrapper wrapper;\n\n    @Test\n    @InSequence(1)\n    public void should_run_modifying_in_transaction() throws Exception\n    {\n        // when\n        repository.deleteAll();\n\n        // then\n        assertTrue(wrapper.isRunInTx());\n    }\n\n    @Test\n    @InSequence(2)\n    public void should_save_in_transaction() throws Exception\n    {\n        // given\n        Simple simple = new Simple(NAME);\n\n        // when\n        simple = repository.save(simple);\n\n        // then\n        assertNotNull(simple.getId());\n        assertTrue(wrapper.isRunInTx());\n    }\n\n    @Test\n    @InSequence(3)\n    public void should_find_with_lockmode_in_transaction() throws Exception\n    {\n        // when\n        Simple simple = repository.findByName(NAME);\n\n        // then\n        assertNotNull(simple);\n        assertTrue(wrapper.isRunInTx());\n    }\n\n    @Test\n    @InSequence(4)\n    public void should_find_no_lock_without_transaction() throws Exception\n    {\n        // when\n        Simple simple = repository.findByNameNoLock(NAME);\n\n        // then\n        assertNotNull(simple);\n        assertTrue(wrapper.isRunInNonTx());\n    }\n\n    @Test\n    @InSequence(10)\n    public void should_cleanup() throws Exception\n    {\n        repository.deleteAll();\n    }\n\n    @Before\n    public void init()\n    {\n        wrapper.reset();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/tx/TransactionalQueryRunnerWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.tx;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Specializes;\n\nimport org.apache.deltaspike.data.impl.builder.QueryBuilder;\nimport org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;\n\n@Specializes\n@ApplicationScoped\npublic class TransactionalQueryRunnerWrapper extends TransactionalQueryRunner\n{\n\n    private boolean runInTx = false;\n    private boolean runInNonTx = false;\n\n    public void reset()\n    {\n        runInTx = false;\n        runInNonTx = false;\n    }\n\n    @Override\n    protected Object executeNonTransactional(QueryBuilder builder, CdiQueryInvocationContext context)\n    {\n        runInNonTx = true;\n        return super.executeNonTransactional(builder, context);\n    }\n\n    @Override\n    protected Object executeTransactional(QueryBuilder builder, CdiQueryInvocationContext context) throws Exception\n    {\n        runInTx = true;\n        return super.executeTransactional(builder, context);\n    }\n\n    public boolean isRunInTx()\n    {\n        return runInTx;\n    }\n\n    public boolean isRunInNonTx()\n    {\n        return runInNonTx;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/EntityUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util;\n\nimport java.io.Serializable;\n\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.Tee;\nimport org.apache.deltaspike.data.test.domain.Tee2;\nimport org.apache.deltaspike.data.test.domain.TeeId;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class EntityUtilsTest\n{\n\n    @Test\n    public void should_find_id_property_class()\n    {\n        // given\n\n        // when\n        Class<? extends Serializable> pkClass = EntityUtils.primaryKeyClass(Tee.class);\n\n        // then\n        Assert.assertEquals(TeeId.class, pkClass);\n    }\n\n    @Test\n    public void should_find_id_class()\n    {\n        // given\n\n        // when\n        Class<? extends Serializable> pkClass = EntityUtils.primaryKeyClass(Tee2.class);\n\n        // then\n        Assert.assertEquals(TeeId.class, pkClass);\n    }\n    \n    @Test\n    public void should_accept_entity_class()\n    {\n        // given\n\n        // when\n        boolean isValid = EntityUtils.isEntityClass(Simple.class);\n\n        // then\n        Assert.assertTrue(isValid);\n    }\n\n    @Test\n    public void should_not_accept_class_without_entity_annotation()\n    {\n        // given\n\n        // when\n        boolean isValid = EntityUtils.isEntityClass(EntityWithoutId.class);\n\n        // then\n        Assert.assertFalse(isValid);\n    }\n\n    private static class EntityWithoutId\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/jpa/QueryStringExtractorFactoryTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.impl.util.jpa;\n\nimport static java.lang.Thread.currentThread;\nimport static java.lang.reflect.Proxy.newProxyInstance;\nimport static org.apache.deltaspike.data.test.util.TestDeployments.initDeployment;\nimport static org.junit.Assert.assertEquals;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Proxy;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.PersistenceException;\nimport jakarta.persistence.Query;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class QueryStringExtractorFactoryTest\n{\n\n    private static final String QUERY_STRING = \"it works\";\n\n    @Inject\n    private QueryStringExtractorFactory factory;\n\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment();\n    }\n\n    @Test\n    public void should_unwrap_query_even_proxied()\n    {\n        // when\n        String extracted = factory.extract((Query) newProxyInstance(currentThread().getContextClassLoader(),\n                        new Class[] { Query.class }, new InvocationHandler()\n            {\n                @Override\n                public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n                {\n                    if (method.getName().equals(\"toString\"))\n                    {\n                        return \"Unknown provider wrapper for tests.\";\n                    }\n                    if (method.getName().equals(\"unwrap\"))\n                    {\n                        Class<?> clazz = (Class<?>) args[0];\n                        if (clazz.getName().contains(\"hibernate\") ||\n                                clazz.getName().contains(\"openjpa\") ||\n                                clazz.getName().contains(\"eclipse\"))\n                        {\n                            return createProxy(clazz);\n                        }\n                        else\n                        {\n                            throw new PersistenceException(\"Unable to unwrap for \" + clazz);\n                        }\n                    }\n                    return null;\n                }\n            })\n        );\n\n        // then\n        assertEquals(QUERY_STRING, extracted);\n    }\n\n    private static Object createProxy(Class<?> forClass)\n    {\n        return Proxy.newProxyInstance(currentThread().getContextClassLoader(),\n                new Class[] { forClass },\n                new FakeQueryInvocationHandler());\n    }\n\n    private static Object createInstance(Method method) throws Exception\n    {\n        // EclipseLink specific\n        Class<?> returnType = Class.forName(\"org.eclipse.persistence.queries.DataReadQuery\");\n        Object instance = returnType.newInstance();\n        Method setter = returnType.getMethod(\"setJPQLString\", String.class);\n        setter.invoke(instance, QUERY_STRING);\n        return instance;\n    }\n\n    private static class FakeQueryInvocationHandler implements InvocationHandler\n    {\n\n        @Override\n        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n        {\n            if (!method.getReturnType().equals(String.class))\n            {\n                if (method.getReturnType().isInterface())\n                {\n                    return createProxy(method.getReturnType());\n                }\n                return createInstance(method);\n            }\n            return QUERY_STRING; // we don't care of the result actually\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/BMTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test;\n\nimport jakarta.annotation.Priority;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.interceptor.Interceptor;\nimport org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy;\nimport org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy;\n\n@Alternative\n@Priority(Interceptor.Priority.APPLICATION+1)\npublic class BMTransactionStrategy extends BeanManagedUserTransactionStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/JpaTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test;\n\nimport jakarta.annotation.Priority;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.interceptor.Interceptor;\nimport org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy;\n\n@Alternative\n@Priority(Interceptor.Priority.APPLICATION+1)\npublic class JpaTransactionStrategy extends ContainerManagedTransactionStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/TestTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test;\n\nimport jakarta.annotation.Priority;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.interceptor.Interceptor;\nimport org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy;\n\n@Dependent\n@Alternative\n@Priority(Interceptor.Priority.APPLICATION + 1)\npublic class TestTransactionStrategy extends ResourceLocalTransactionStrategy\n{\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/TransactionalTestCase.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test;\r\n\r\nimport jakarta.annotation.Resource;\r\nimport jakarta.inject.Inject;\r\nimport jakarta.persistence.EntityManager;\r\nimport jakarta.transaction.UserTransaction;\r\n\r\nimport org.apache.deltaspike.data.test.util.TestData;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.junit.After;\r\nimport org.junit.Before;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\npublic abstract class TransactionalTestCase\r\n{\r\n\r\n    @Resource\r\n    protected UserTransaction ut;\r\n    \r\n    protected TestData testData;\r\n\r\n    @Before\r\n    public void startTransaction() throws Exception\r\n    {\r\n        ut.begin();\r\n        // Required by OpenJPA\r\n        getEntityManager().getMetamodel();\r\n    }\r\n    \r\n    @Before\r\n    public void initTestData()\r\n    {\r\n        testData = new TestData(getEntityManager());\r\n    }\r\n\r\n    @After\r\n    public void rollbackTransaction() throws Exception\r\n    {\r\n        ut.rollback();\r\n    }\r\n\r\n    @Inject private EntityManager entityManager;\r\n    \r\n    protected EntityManager getEntityManager()\r\n    {\r\n        return entityManager;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/AuditedEntity.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport java.io.Serializable;\nimport java.sql.Timestamp;\nimport java.util.Calendar;\n\nimport jakarta.persistence.CascadeType;\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.FetchType;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.ManyToOne;\nimport jakarta.persistence.Temporal;\nimport jakarta.persistence.TemporalType;\n\nimport org.apache.deltaspike.data.api.audit.CreatedBy;\nimport org.apache.deltaspike.data.api.audit.CreatedOn;\nimport org.apache.deltaspike.data.api.audit.ModifiedBy;\nimport org.apache.deltaspike.data.api.audit.ModifiedOn;\n\n@Entity\n@SuppressWarnings(\"serial\")\npublic class AuditedEntity implements Serializable\n{\n\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    @Temporal(TemporalType.TIMESTAMP)\n    @CreatedOn\n    private Calendar created;\n\n    private String name;\n\n    @CreatedBy\n    private String creator;\n\n    @CreatedBy\n    @ManyToOne(targetEntity = Principal.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)\n    private Principal creatorPrincipal;\n\n    @ModifiedBy\n    private String changer;\n\n    @ModifiedBy\n    @ManyToOne(targetEntity = Principal.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)\n    private Principal principal;\n\n    @ModifiedBy(onCreate = false)\n    private String changerOnly;\n\n    @ModifiedBy(onCreate = false)\n    @ManyToOne(targetEntity = Principal.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)\n    private Principal changerOnlyPrincipal;\n\n    @Temporal(TemporalType.TIME)\n    @ModifiedOn(onCreate = true)\n    private java.util.Date modified;\n\n    @Temporal(TemporalType.DATE)\n    @ModifiedOn\n    private Calendar gregorianModified;\n\n    @ModifiedOn\n    private Timestamp timestamp;\n\n    public AuditedEntity()\n    {\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public Calendar getCreated()\n    {\n        return created;\n    }\n\n    public java.util.Date getModified()\n    {\n        return modified;\n    }\n\n    public Calendar getGregorianModified()\n    {\n        return gregorianModified;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public Timestamp getTimestamp()\n    {\n        return timestamp;\n    }\n\n    public String getChanger()\n    {\n        return changer;\n    }\n\n    public void setChanger(String changer)\n    {\n        this.changer = changer;\n    }\n\n    public Principal getPrincipal()\n    {\n        return principal;\n    }\n\n    public String getCreator() {\n        return creator;\n    }\n\n    public Principal getCreatorPrincipal() {\n        return creatorPrincipal;\n    }\n\n    public String getChangerOnly() {\n        return changerOnly;\n    }\n\n    public Principal getChangerOnlyPrincipal() {\n        return changerOnlyPrincipal;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/EmbeddedSimple.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Embeddable;\n\n@Embeddable\npublic class EmbeddedSimple\n{\n\n    private String embedd;\n\n    public String getEmbedd()\n    {\n        return embedd;\n    }\n\n    public void setEmbedd(String embedd)\n    {\n        this.embedd = embedd;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Home.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\n\n@Entity\npublic class Home\n{\n\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    private String name;\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/NamedEntity.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.domain;\r\n\r\nimport jakarta.persistence.GeneratedValue;\r\nimport jakarta.persistence.Id;\r\nimport jakarta.persistence.MappedSuperclass;\r\n\r\n@MappedSuperclass\r\npublic class NamedEntity\r\n{\r\n\r\n    @Id\r\n    @GeneratedValue\r\n    private Long id;\r\n\r\n    private String name;\r\n\r\n    public NamedEntity()\r\n    {\r\n    }\r\n\r\n    public NamedEntity(String name)\r\n    {\r\n        this.name = name;\r\n    }\r\n\r\n    public String getName()\r\n    {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name)\r\n    {\r\n        this.name = name;\r\n    }\r\n\r\n    public Long getId()\r\n    {\r\n        return id;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/OneToMany.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.domain;\r\n\r\nimport jakarta.persistence.Entity;\r\n\r\n@Entity\r\npublic class OneToMany extends NamedEntity\r\n{\r\n\r\n    public OneToMany()\r\n    {\r\n        super();\r\n    }\r\n\r\n    public OneToMany(String name)\r\n    {\r\n        super(name);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/OneToOne.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.domain;\r\n\r\nimport jakarta.persistence.Entity;\r\n\r\n@Entity\r\npublic class OneToOne extends NamedEntity\r\n{\r\n\r\n    public OneToOne()\r\n    {\r\n        super();\r\n    }\r\n\r\n    public OneToOne(String name)\r\n    {\r\n        super(name);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Parent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport jakarta.persistence.CascadeType;\nimport jakarta.persistence.Column;\nimport jakarta.persistence.Entity;\n\n@Entity\npublic class Parent extends NamedEntity\n{\n\n    @jakarta.persistence.OneToOne(cascade = CascadeType.ALL)\n    private OneToOne one;\n\n    @jakarta.persistence.OneToMany(cascade = CascadeType.ALL, targetEntity = OneToMany.class)\n    private List<OneToMany> many = new LinkedList<OneToMany>();\n\n    @Column(name = \"p_value\")\n    private Long value = Long.valueOf(0);\n\n    public Parent()\n    {\n        super();\n    }\n\n    public Parent(String name)\n    {\n        super(name);\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"Parent [value=\" + value + \", getName()=\" + getName() + \", getId()=\" + getId() + \"]\";\n    }\n\n    public void add(OneToMany otm)\n    {\n        many.add(otm);\n    }\n\n    public OneToOne getOne()\n    {\n        return one;\n    }\n\n    public void setOne(OneToOne one)\n    {\n        this.one = one;\n    }\n\n    public List<OneToMany> getMany()\n    {\n        return many;\n    }\n\n    public void setMany(List<OneToMany> many)\n    {\n        this.many = many;\n    }\n\n    public Long getValue()\n    {\n        return value;\n    }\n\n    public void setValue(Long value)\n    {\n        this.value = value;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Principal.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\n\n@Entity\npublic class Principal\n{\n\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    private String name;\n\n    public Principal()\n    {\n    }\n\n    @Override\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"Principal [id=\").append(id)\n                .append(\", name=\").append(name).append(\"]\");\n        return builder.toString();\n    }\n\n    public Principal(String name)\n    {\n        this.name = name;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.domain;\r\n\r\nimport java.util.Date;\r\n\r\nimport jakarta.persistence.Entity;\r\nimport jakarta.persistence.GeneratedValue;\r\nimport jakarta.persistence.Id;\r\nimport jakarta.persistence.NamedQueries;\r\nimport jakarta.persistence.NamedQuery;\r\nimport jakarta.persistence.Table;\r\nimport jakarta.persistence.Temporal;\r\nimport jakarta.persistence.TemporalType;\r\n\r\n@Entity\r\n@NamedQueries({\r\n        @NamedQuery(name = Simple.BY_NAME_LIKE,\r\n                   query = \"select e from Simple e where e.name like ?1\"),\r\n        @NamedQuery(name = Simple.BY_NAME_ENABLED,\r\n                   query = \"select s from Simple s where s.name = ?1 and s.enabled = ?2 order by s.id asc\"),\r\n        @NamedQuery(name = Simple.BY_ID,\r\n                   query = \"select s from Simple s where s.id = :id and s.enabled = :enabled\")\r\n})\r\n@Table(name = \"SIMPLE_TABLE\")\r\npublic class Simple extends SuperSimple\r\n{\r\n\r\n    public static final String BY_NAME_LIKE = \"simple.byNameLike\";\r\n    public static final String BY_NAME_ENABLED = \"simple.byNameAndEnabled\";\r\n    public static final String BY_ID = \"simple.byId\";\r\n\r\n    @Id\r\n    @GeneratedValue\r\n    private Long id;\r\n\r\n    private String name;\r\n    private String camelCase;\r\n    private Boolean enabled = Boolean.TRUE;\r\n    private Integer counter = Integer.valueOf(0);\r\n    @Temporal(TemporalType.TIMESTAMP)\r\n    private Date temporal;\r\n    private EmbeddedSimple embedded;\r\n\r\n    protected Simple()\r\n    {\r\n    }\r\n\r\n    public Simple(String name)\r\n    {\r\n        this.name = name;\r\n    }\r\n\r\n    public Long getId()\r\n    {\r\n        return id;\r\n    }\r\n\r\n    public void setId(Long id)\r\n    {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getName()\r\n    {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name)\r\n    {\r\n        this.name = name;\r\n    }\r\n\r\n    public Boolean getEnabled()\r\n    {\r\n        return enabled;\r\n    }\r\n\r\n    public void setEnabled(Boolean enabled)\r\n    {\r\n        this.enabled = enabled;\r\n    }\r\n\r\n    public Integer getCounter()\r\n    {\r\n        return counter;\r\n    }\r\n\r\n    public void setCounter(Integer counter)\r\n    {\r\n        this.counter = counter;\r\n    }\r\n\r\n    public String getCamelCase()\r\n    {\r\n        return camelCase;\r\n    }\r\n\r\n    public void setCamelCase(String camelCase)\r\n    {\r\n        this.camelCase = camelCase;\r\n    }\r\n\r\n    public Date getTemporal()\r\n    {\r\n        return temporal;\r\n    }\r\n\r\n    public void setTemporal(Date temporal)\r\n    {\r\n        this.temporal = temporal;\r\n    }\r\n\r\n    public EmbeddedSimple getEmbedded()\r\n    {\r\n        return embedded;\r\n    }\r\n\r\n    public void setEmbedded(EmbeddedSimple embedded)\r\n    {\r\n        this.embedded = embedded;\r\n    }\r\n\r\n    @Override\r\n    public String toString()\r\n    {\r\n        return \"Simple [id=\" + id + \", name=\" + name + \", camelCase=\" + camelCase + \", enabled=\" + enabled\r\n                + \", counter=\" + counter + \", temporal=\" + temporal + \", embedded=\" + embedded + \"]\";\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple2.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.domain;\r\n\r\nimport jakarta.persistence.Entity;\r\nimport jakarta.persistence.GeneratedValue;\r\nimport jakarta.persistence.Id;\r\n\r\n@Entity\r\npublic class Simple2\r\n{\r\n\r\n    @Id\r\n    @GeneratedValue\r\n    private Long id;\r\n\r\n    private String name;\r\n\r\n    public Simple2()\r\n    {\r\n    }\r\n\r\n    public Simple2(String name)\r\n    {\r\n        this.name = name;\r\n    }\r\n\r\n    public String getName()\r\n    {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name)\r\n    {\r\n        this.name = name;\r\n    }\r\n\r\n    public Long getId()\r\n    {\r\n        return id;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\n\n@Entity\npublic class Simple3\n{\n\n    @GeneratedValue\n    @Id\n    private long id;\n\n    private String name;\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public long getId()\n    {\n        return id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple4.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\n\n@Entity(name = \"EntitySimple4\")\npublic class Simple4\n{\n\n    @GeneratedValue\n    @Id\n    private long id;\n\n    private String name;\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public long getId()\n    {\n        return id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple5.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\n\n@Entity(name = \"EntitySimple5\")\npublic class Simple5 extends SimpleBase\n{\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SimpleBase.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.MappedSuperclass;\n\n@MappedSuperclass\npublic class SimpleBase\n{\n\n    @GeneratedValue\n    @Id\n    private long id;\n\n    private String name;\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public long getId()\n    {\n        return id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SimpleBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.EntityManager;\n\npublic class SimpleBuilder\n{\n\n    private final EntityManager entityManager;\n\n    public SimpleBuilder(EntityManager entityManager)\n    {\n        this.entityManager = entityManager;\n    }\n\n    public Simple createSimple(String name, Integer counter)\n    {\n        Simple result = new Simple(name);\n        result.setCounter(counter);\n        return persistSimple(result);\n    }\n\n    public Simple createSimple(String name)\n    {\n        Simple result = new Simple(name);\n        return persistSimple(result);\n    }\n\n    public Simple persistSimple(Simple result)\n    {\n        entityManager.persist(result);\n        entityManager.flush();\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SimpleStringId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.*;\n\n@Entity\n@NamedQueries({\n        @NamedQuery(name = SimpleStringId.FIND_ALL_ORDER_BY_ID, query = \"SELECT e FROM SimpleStringId e ORDER BY e.id\")\n})\n@Table(name = \"SIMPLE_TABLE_STRING\")\npublic class SimpleStringId extends SuperSimple\n{\n\n    public static final String FIND_ALL_ORDER_BY_ID = \"SimpleStringId.findAllOrderById\";\n\n    @Id\n    private String id;\n    private String name;\n\n    public SimpleStringId()\n    {\n\n    }\n\n    public SimpleStringId(String id, String name)\n    {\n        this.id = id;\n        this.name = name;\n    }\n\n    public String getId()\n    {\n        return id;\n    }\n\n    public void setId(String id)\n    {\n        this.id = id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"Simple [id=\" + id + \", name=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SimpleStringIdBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.EntityManager;\n\npublic class SimpleStringIdBuilder\n{\n\n    private final EntityManager entityManager;\n\n    public SimpleStringIdBuilder(EntityManager entityManager)\n    {\n        this.entityManager = entityManager;\n    }\n\n    public SimpleStringId createSimple(String id, String name)\n    {\n        SimpleStringId result = new SimpleStringId(id, name);\n        return persistSimple(result);\n    }\n\n    public SimpleStringId persistSimple(SimpleStringId result)\n    {\n        entityManager.persist(result);\n        entityManager.flush();\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SuperSimple.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.MappedSuperclass;\n\n@MappedSuperclass\npublic class SuperSimple\n{\n    private String superName;\n\n    public String getSuperName()\n    {\n        return superName;\n    }\n\n    public void setSuperName(String superName)\n    {\n        this.superName = superName;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Tee.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport java.io.Serializable;\n\nimport jakarta.persistence.EmbeddedId;\nimport jakarta.persistence.Entity;\n\n@Entity\n@SuppressWarnings(\"serial\")\npublic class Tee implements Serializable\n{\n\n    @EmbeddedId\n    private TeeId id;\n    private int distance;\n\n    public TeeId getId()\n    {\n        return id;\n    }\n\n    public void setId(TeeId id)\n    {\n        this.id = id;\n    }\n\n    public int getDistance()\n    {\n        return distance;\n    }\n\n    public void setDistance(int distance)\n    {\n        this.distance = distance;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Tee2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport jakarta.persistence.Column;\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.IdClass;\n\n@IdClass(TeeId.class)\n@Entity\npublic class Tee2\n{\n    @Column(nullable = false)\n    @Id\n    private Long teeSetId;\n\n    @Column(nullable = false)\n    @Id\n    private Long holeId;\n\n    public long getTeeSetId()\n    {\n        return teeSetId;\n    }\n\n    public void setTeeSetId(long teeSetId)\n    {\n        this.teeSetId = teeSetId;\n    }\n\n    public long getHoleId()\n    {\n        return holeId;\n    }\n\n    public void setHoleId(long holeId)\n    {\n        this.holeId = holeId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/TeeId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain;\n\nimport java.io.Serializable;\n\nimport jakarta.persistence.Column;\nimport jakarta.persistence.Embeddable;\n\n@Embeddable\n@SuppressWarnings(\"serial\")\npublic class TeeId implements Serializable\n{\n\n    @Column(nullable = false)\n    private Long teeSetId;\n\n    @Column(nullable = false)\n    private Long holeId;\n\n    public TeeId()\n    {\n    }\n\n    public TeeId(long teeSetId, long holeId)\n    {\n        this.teeSetId = teeSetId;\n        this.holeId = holeId;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + (int) (holeId ^ (holeId >>> 32));\n        result = prime * result + (int) (teeSetId ^ (teeSetId >>> 32));\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj)\n    {\n        if (this == obj)\n        {\n            return true;\n        }\n        if (obj == null)\n        {\n            return false;\n        }\n        if (getClass() != obj.getClass())\n        {\n            return false;\n        }\n        TeeId other = (TeeId) obj;\n        if (holeId != other.holeId)\n        {\n            return false;\n        }\n        if (teeSetId != other.teeSetId)\n        {\n            return false;\n        }\n        return true;\n    }\n\n    public long getTeeSetId()\n    {\n        return teeSetId;\n    }\n\n    public void setTeeSetId(long teeSetId)\n    {\n        this.teeSetId = teeSetId;\n    }\n\n    public long getHoleId()\n    {\n        return holeId;\n    }\n\n    public void setHoleId(long holeId)\n    {\n        this.holeId = holeId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/dto/BooleanWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.dto;\n\npublic class BooleanWrapper\n{\n    private Boolean wrapped;\n\n    public BooleanWrapper(Boolean wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    public Boolean getWrapped()\n    {\n        return wrapped;\n    }\n\n    public void setWrapped(Boolean wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/dto/SimpleDto.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.dto;\n\npublic class SimpleDto\n{\n    private SimpleId id;\n    private String name;\n    private Boolean enabled;\n\n    public SimpleId getId()\n    {\n        return id;\n    }\n\n    public void setId(SimpleId id)\n    {\n        this.id = id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public Boolean getEnabled()\n    {\n        return enabled;\n    }\n\n    public void setEnabled(Boolean enabled)\n    {\n        this.enabled = enabled;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/dto/SimpleId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.dto;\n\nimport java.io.Serializable;\n\npublic class SimpleId implements Serializable\n{\n\n    private static final long serialVersionUID = 1L;\n\n    private Long id;\n\n    public SimpleId(Long id)\n    {\n        this.id = id;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/mapped/MappedId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.mapped;\n\npublic class MappedId\n{\n\n    private Long id;\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/mapped/MappedOne.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.mapped;\n\npublic class MappedOne\n{\n\n    private Long id;\n    private String name;\n\n    public MappedOne()\n    {\n    }\n\n    public MappedOne(String name)\n    {\n        this.name = name;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/mapped/MappedSuperclass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.mapped;\n\npublic class MappedSuperclass extends MappedId\n{\n\n    private Long counter;\n\n    public Long getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(Long id)\n    {\n        this.counter = id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/mapped/MappedThree.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.mapped;\n\npublic class MappedThree extends MappedSuperclass\n{\n\n    private String name;\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/mapped/MappedTwo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.domain.mapped;\n\npublic class MappedTwo\n{\n\n    private Long teeSetId;\n    private Long holeId;\n\n    private String name;\n\n    public Long getTeeSetId()\n    {\n        return teeSetId;\n    }\n\n    public void setTeeSetId(Long teeSetId)\n    {\n        this.teeSetId = teeSetId;\n    }\n\n    public Long getHoleId()\n    {\n        return holeId;\n    }\n\n    public void setHoleId(Long holeId)\n    {\n        this.holeId = holeId;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/java8/entity/Simple.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.java8.entity;\n\nimport java.util.Date;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.Id;\nimport jakarta.persistence.NamedQueries;\nimport jakarta.persistence.NamedQuery;\nimport jakarta.persistence.Table;\nimport jakarta.persistence.Temporal;\nimport jakarta.persistence.TemporalType;\n\n@Entity\n@NamedQueries({\n        @NamedQuery(name = Simple.BY_NAME_LIKE,\n                query = \"select e from Simple e where e.name like ?1\"),\n        @NamedQuery(name = Simple.BY_NAME_ENABLED,\n                query = \"select s from Simple s where s.name = ?1 and s.enabled = ?2 order by s.id asc\"),\n        @NamedQuery(name = Simple.BY_ID,\n                query = \"select s from Simple s where s.id = :id and s.enabled = :enabled\")\n})\n@Table(name = \"SIMPLE_TABLE\")\npublic class Simple\n{\n    public static final String BY_NAME_LIKE = \"simple.byNameLike\";\n    public static final String BY_NAME_ENABLED = \"simple.byNameAndEnabled\";\n    public static final String BY_ID = \"simple.byId\";\n\n    private static final long serialVersionUID = 1L;\n\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    private String name;\n    private String camelCase;\n    private Boolean enabled = Boolean.TRUE;\n    private Integer counter = Integer.valueOf(0);\n    @Temporal(TemporalType.TIMESTAMP)\n    private Date temporal;\n\n    protected Simple()\n    {\n    }\n\n    public Simple(String name)\n    {\n        this.name = name;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public Boolean getEnabled()\n    {\n        return enabled;\n    }\n\n    public void setEnabled(Boolean enabled)\n    {\n        this.enabled = enabled;\n    }\n\n    public Integer getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(Integer counter)\n    {\n        this.counter = counter;\n    }\n\n    public String getCamelCase()\n    {\n        return camelCase;\n    }\n\n    public void setCamelCase(String camelCase)\n    {\n        this.camelCase = camelCase;\n    }\n\n    public Date getTemporal()\n    {\n        return temporal;\n    }\n\n    public void setTemporal(Date temporal)\n    {\n        this.temporal = temporal;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"Simple [id=\" + id + \", name=\" + name + \", camelCase=\" + camelCase + \", enabled=\" + enabled\n                + \", counter=\" + counter + \", temporal=\" + temporal + \"]\";\n    }\n\n}\n\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/java8/repo/SimpleRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.java8.repo;\n\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.java8.entity.Simple;\n\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\n@Repository(forEntity = Simple.class)\npublic interface SimpleRepository\n{\n    Stream<Simple> findByName(String name);\n\n    Optional<Simple> findOptionalBy(Long id);\n\n    Stream<Simple> findAll();\n\n    Optional<Simple> findBy(Long id);\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/java8/repo/SimpleRepository2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.java8.repo;\n\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.api.SingleResultType;\nimport org.apache.deltaspike.data.test.java8.entity.Simple;\n\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\n@Repository(forEntity = Simple.class)\npublic interface SimpleRepository2\n{\n    @Query(singleResult = SingleResultType.ANY)\n    Optional<Simple> findByName(String name);\n\n    @Query(value = \"select name from simple_table\", isNative = true)\n    Stream<String> findSimpleNames();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/java8/test/Java8Test.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.java8.test;\n\nimport org.apache.deltaspike.data.test.java8.entity.Simple;\nimport org.apache.deltaspike.data.test.java8.repo.SimpleRepository;\nimport org.apache.deltaspike.data.test.java8.repo.SimpleRepository2;\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.annotation.Resource;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.PersistenceContext;\nimport jakarta.transaction.UserTransaction;\n\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\nimport static java.util.Arrays.asList;\nimport java.util.Collections;\nimport java.util.List;\nimport static java.util.Collections.emptyList;\nimport static java.util.stream.Collectors.toList;\nimport static org.apache.deltaspike.data.test.java8.util.TestDeployments.initDeployment;\n\n@Category(WebProfileCategory.class)\n@RunWith(Arquillian.class)\npublic class Java8Test\n{\n    @Deployment\n    public static Archive<?> deployment()\n    {\n        return initDeployment()\n                .addClasses(Java8Test.class, Simple.class, SimpleRepository.class, SimpleRepository2.class);\n    }\n\n    @Inject\n    private SimpleRepository simpleRepository;\n\n    @Inject\n    private SimpleRepository2 simpleRepository2;\n\n    @PersistenceContext\n    private EntityManager entityManager;\n\n    @Resource\n    private UserTransaction ut;\n\n    @Before\n    public void setupTX() throws Exception\n    {\n        ut.begin();\n    }\n\n    @After\n    public void rollbackTX() throws Exception\n    {\n        ut.rollback();\n    }\n\n    @Test\n    public void shouldFindOptionalSimple() throws Exception\n    {\n        Simple s = new Simple(\"something\");\n        entityManager.persist(s);\n\n        Optional<Simple> found = simpleRepository.findOptionalBy(s.getId());\n\n        Assert.assertTrue(found.isPresent());\n    }\n\n    @Test\n    public void shouldNotFindOptionalSimpleForMissing() throws Exception\n    {\n        Optional<Simple> found = simpleRepository.findBy(-1L);\n\n        Assert.assertFalse(found.isPresent());\n    }\n\n    @Test\n    public void shouldFindStreamOfSimples()\n    {\n        String name = \"something\";\n        Simple s = new Simple(name);\n        entityManager.persist(s);\n\n        Stream<Simple> found = simpleRepository.findByName(name);\n\n        Assert.assertEquals(1, found.count());\n    }\n\n    @Test\n    public void shouldFindEmptyStream()\n    {\n        String name = \"something\";\n        Simple s = new Simple(name);\n        entityManager.persist(s);\n\n        Stream<Simple> found = simpleRepository.findByName(\"some other name\");\n\n        Assert.assertEquals(emptyList(), found.collect(toList()));\n    }\n\n    @Test\n    public void shouldFindAllAsStream()\n    {\n        String name = \"something\";\n        Simple s = new Simple(name);\n        entityManager.persist(s);\n\n        Stream<Simple> found = simpleRepository.findAll();\n\n        Assert.assertEquals(1, found.count());\n    }\n\n    @Test\n    public void shouldFindByNameOptional()\n    {\n        String name = \"jim\";\n        entityManager.persist(new Simple(name));\n        entityManager.persist(new Simple(name));\n\n        Optional<Simple> found = simpleRepository2.findByName(name);\n\n        Assert.assertTrue(found.isPresent());\n    }\n\n    @Test\n    public void shouldFindNamesAsStream()\n    {\n        entityManager.persist(new Simple(\"a\"));\n        entityManager.persist(new Simple(\"b\"));\n        entityManager.flush();\n\n        Stream<String> names = simpleRepository2.findSimpleNames();\n        final List<String> actualSorted = names.collect(toList());\n        Collections.sort(actualSorted);\n\n        Assert.assertEquals(asList(\"a\",\"b\"), actualSorted);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/java8/util/EntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.java8.util;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.PersistenceContext;\n\npublic class EntityManagerProducer {\n    @PersistenceContext\n    @Produces\n    private EntityManager entityManager;\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/java8/util/TestDeployments.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.java8.util;\n\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.jboss.shrinkwrap.resolver.api.maven.Maven;\n\nimport java.io.File;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\npublic class TestDeployments\n{\n    /**\n     * Create a basic deployment with dependencies, beans.xml and persistence descriptor.\n     *\n     * @return Basic web archive.\n     */\n    public static WebArchive initDeployment()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"test.war\")\n                .addAsLibraries(getDeltaSpikeDataWithDependencies())\n                .addClasses(EntityManagerProducer.class)\n                .addAsWebInfResource(\"test-persistence.xml\", \"classes/META-INF/persistence.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return archive;\n    }\n\n    private static File[] getDeltaSpikeDataWithDependencies()\n    {\n        return Maven.resolver().loadPomFromFile(\"pom.xml\").resolve(\n                \"org.apache.deltaspike.core:deltaspike-core-api\",\n                \"org.apache.deltaspike.core:deltaspike-core-impl\",\n                \"org.apache.deltaspike.modules:deltaspike-partial-bean-module-api\",\n                \"org.apache.deltaspike.modules:deltaspike-partial-bean-module-impl\",\n                \"org.apache.deltaspike.modules:deltaspike-jpa-module-api\",\n                \"org.apache.deltaspike.modules:deltaspike-jpa-module-impl\",\n                \"org.apache.deltaspike.modules:deltaspike-data-module-api\",\n                \"org.apache.deltaspike.modules:deltaspike-data-module-impl\")\n                .withTransitivity()\n                .asFile();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/BaseRepositoryInterface.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.EntityManagerDelegate;\r\nimport org.apache.deltaspike.data.api.EntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\n\r\n@Repository\r\npublic interface BaseRepositoryInterface extends EntityRepository<Simple, Long>, EntityManagerDelegate<Simple>\r\n{\r\n    Simple findByName( String name );\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/BasicEntityManagerResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.EntityManagerResolver;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\npublic class BasicEntityManagerResolver implements EntityManagerResolver\n{\n\n    @Inject\n    private EntityManager entityManager;\n\n    @Override\n    public EntityManager resolveEntityManager()\n    {\n        return entityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/DisabledRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.data.api.EntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.Simple;\n\n@Repository(forEntity = Simple.class)\npublic interface DisabledRepository extends EntityRepository<Simple, Long>, Deactivatable\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryAbstract.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\n\r\n@Repository\r\npublic abstract class ExtendedRepositoryAbstract\r\n        extends AbstractEntityRepository<Simple, Long>\r\n{\r\n    public String getTableName()\r\n    {\r\n        return tableName();\r\n    }\r\n\r\n    public String getEntityName()\r\n    {\r\n        return entityName();\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryAbstract2.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple2;\r\n\r\n@Repository\r\npublic abstract class ExtendedRepositoryAbstract2\r\n        extends AbstractEntityRepository<Simple2, Long>\r\n{\r\n    public String getTableName()\r\n    {\r\n        return tableName();\r\n    }\r\n\r\n    public String getEntityName()\r\n    {\r\n        return entityName();\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryAbstract4.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple4;\r\n\r\n@Repository\r\npublic abstract class ExtendedRepositoryAbstract4\r\n        extends AbstractEntityRepository<Simple4, Long>\r\n{\r\n    public String getEntityName()\r\n    {\r\n        return entityName();\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryAbstractInherited.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple5;\r\n\r\n@Repository\r\npublic abstract class ExtendedRepositoryAbstractInherited \r\n    extends ExtendedRepositoryAbstractIntermediate<Simple5, Long>\r\n{\r\n    \r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryAbstractIntermediate.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport java.io.Serializable;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Query;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.api.SingleResultType;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.domain.SimpleBase;\r\n\r\n@Repository\r\npublic abstract class ExtendedRepositoryAbstractIntermediate<E extends SimpleBase, PK extends Serializable>\r\n        extends AbstractEntityRepository<E, PK>\r\n{\r\n    public String getTableName()\r\n    {\r\n        return tableName();\r\n    }\r\n\r\n    public String getEntityName()\r\n    {\r\n        return entityName();\r\n    }\r\n    \r\n    @Query(singleResult = SingleResultType.OPTIONAL)\r\n    public abstract E findByIdAndName(Long id, String name);\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryInterface.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.*;\nimport org.apache.deltaspike.data.test.domain.Simple;\n\nimport static jakarta.persistence.LockModeType.PESSIMISTIC_READ;\n\n@Repository\npublic interface ExtendedRepositoryInterface extends EntityRepository<Simple, Long>, EntityManagerDelegate<Simple>\n{\n\n    @Query(lock = PESSIMISTIC_READ)\n    Simple findByName(String name);\n\n    @Query(named = Simple.BY_NAME_LIKE)\n    Simple findByNameNoLock(String name);\n\n    @Modifying @Query(\"delete from Simple\")\n    int deleteAll();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ExtendedRepositoryInterface2.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.Modifying;\r\nimport org.apache.deltaspike.data.api.Query;\r\nimport org.apache.deltaspike.data.api.Repository;\r\n\r\n@Repository\r\npublic interface ExtendedRepositoryInterface2 extends BaseRepositoryInterface\r\n{\r\n    @Modifying\r\n    @Query( \"delete from Simple\")\r\n    int deleteAll();\r\n}\r\n\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/FullRepositoryAbstract.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractFullEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.domain.Simple_;\r\n\r\n@Repository\r\npublic abstract class FullRepositoryAbstract\r\n        extends AbstractFullEntityRepository<Simple, Long>\r\n{\r\n    public String getTableName()\r\n    {\r\n        return tableName();\r\n    }\r\n\r\n    public String getEntityName()\r\n    {\r\n        return entityName();\r\n    }\r\n\r\n    public Simple fetchByName(String name)\r\n    {\r\n        return criteria().eq(Simple_.name, name).getOptionalResult();\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/FullRepositoryInterface.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport static jakarta.persistence.LockModeType.PESSIMISTIC_READ;\n\nimport org.apache.deltaspike.data.api.FullEntityRepository;\nimport org.apache.deltaspike.data.api.Modifying;\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.Simple;\n\n@Repository\npublic interface FullRepositoryInterface extends FullEntityRepository<Simple, Long>\n{\n\n    @Query(lock = PESSIMISTIC_READ)\n    Simple findByName(String name);\n\n    @Query(named = Simple.BY_NAME_LIKE)\n    Simple findByNameNoLock(String name);\n\n    @Modifying @Query(\"delete from Simple\")\n    int deleteAll();\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/HomeRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.test.domain.Home;\n\npublic abstract class HomeRepository extends AbstractEntityRepository<Home, Long>\n{\n\n    public abstract QueryResult<Home> findByName(String name);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/LegacyRepositoryWithEntityManagerResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\nimport org.apache.deltaspike.data.api.EntityManagerConfig;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.Simple;\n\nimport java.util.List;\n\n@Repository\n@EntityManagerConfig(entityManagerResolver = BasicEntityManagerResolver.class)\npublic abstract class LegacyRepositoryWithEntityManagerResolver extends AbstractEntityRepository<Simple, Long>\n{\n\n    public abstract List<Simple> findByName(String name);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/MappedOneRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.mapped.MappedOne;\n\n@Repository\npublic abstract class MappedOneRepository extends AbstractEntityRepository<MappedOne, Long>\n{\n\n    public abstract MappedOne findByName(String name);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/MyEntityRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\npublic interface MyEntityRepository<E>\n{\n\n    E saveAndFlushAndRefresh(E entity);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/MyEntityRepositoryDelegate.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.data.spi.DelegateQueryHandler;\nimport org.apache.deltaspike.data.spi.QueryInvocationContext;\n\n@Dependent\npublic class MyEntityRepositoryDelegate<E> implements DelegateQueryHandler, MyEntityRepository<E>\n{\n\n    @Inject\n    private QueryInvocationContext context;\n\n    @Override\n    public E saveAndFlushAndRefresh(E entity)\n    {\n        entityManager().persist(entity);\n        entityManager().flush();\n        entityManager().refresh(entity);\n        return entity;\n    }\n\n    private EntityManager entityManager()\n    {\n        return context.getEntityManager();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/MySimpleRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.EntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.Simple;\n\n@Repository\npublic interface MySimpleRepository extends MyEntityRepository<Simple>, EntityRepository<Simple, Long>\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/ParentRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport java.util.List;\r\n\r\nimport jakarta.persistence.criteria.JoinType;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.api.criteria.CriteriaSupport;\r\nimport org.apache.deltaspike.data.test.domain.OneToMany;\r\nimport org.apache.deltaspike.data.test.domain.OneToMany_;\r\nimport org.apache.deltaspike.data.test.domain.OneToOne;\r\nimport org.apache.deltaspike.data.test.domain.OneToOne_;\r\nimport org.apache.deltaspike.data.test.domain.Parent;\r\nimport org.apache.deltaspike.data.test.domain.Parent_;\r\n\r\n@Repository\r\npublic abstract class ParentRepository extends AbstractEntityRepository<Parent, Long>\r\n        implements CriteriaSupport<Parent>\r\n{\r\n\r\n    public List<Parent> joinQuery(String name, String oneName, String manyName)\r\n    {\r\n        return criteria()\r\n                .eq(Parent_.name, name)\r\n                .join(Parent_.one,\r\n                        where(OneToOne.class, JoinType.LEFT)\r\n                                .eq(OneToOne_.name, oneName)\r\n                )\r\n                .join(Parent_.many,\r\n                        where(OneToMany.class)\r\n                                .eq(OneToMany_.name, manyName)\r\n                )\r\n                .createQuery()\r\n                .getResultList();\r\n    }\r\n\r\n    public List<Parent> nullAwareQuery(String name1, String name2, Long counter)\r\n    {\r\n        return criteria()\r\n                .eq(Parent_.name, name1)\r\n                .eq(Parent_.name, name2)\r\n                .eq(Parent_.value, counter)\r\n                .createQuery()\r\n                .getResultList();\r\n    }\r\n\r\n    public Parent fetchQuery(String name)\r\n    {\r\n        return criteria()\r\n                .eq(Parent_.name, name)\r\n                .fetch(Parent_.many)\r\n                .distinct()\r\n                .createQuery()\r\n                .getSingleResult();\r\n    }\r\n\r\n    public List<Parent> fetchByName(String name1, String name2, String name3)\r\n    {\r\n        return criteria()\r\n                .in(Parent_.name, name1, name2, name3)\r\n                .createQuery()\r\n                .getResultList();\r\n    }\r\n\r\n    @SuppressWarnings(\"unchecked\")\r\n    public List<Parent> orQuery(String name1, String name2)\r\n    {\r\n        return criteria()\r\n                .or(\r\n                        criteria()\r\n                                .eq(Parent_.name, name2)\r\n                                .between(Parent_.value, 50L, 100L),\r\n                        criteria()\r\n                                .eq(Parent_.name, name1)\r\n                                .between(Parent_.value, 0L, 50L),\r\n                        criteria()\r\n                                .eq(Parent_.name, \"does not exist!\")\r\n                )\r\n                .createQuery()\r\n                .getResultList();\r\n    }\r\n\r\n    public List<Parent> orderedQuery()\r\n    {\r\n        return criteria()\r\n                .orderAsc(Parent_.name)\r\n                .createQuery()\r\n                .getResultList();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/RepositoryInterface.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\n\r\n@Repository(forEntity = Simple.class)\r\npublic interface RepositoryInterface\r\n{\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Simple2Repository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.EntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple2;\r\n\r\n@Repository\r\npublic interface Simple2Repository extends EntityRepository<Simple2, Long>\r\n{\r\n\r\n    Simple2 findByName(String name);\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleCriteriaRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport java.util.Date;\nimport java.util.List;\n\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.api.criteria.CriteriaSupport;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.Simple_;\nimport org.apache.deltaspike.data.test.domain.SuperSimple_;\n\nimport jakarta.persistence.criteria.CriteriaBuilder;\n\n@Repository\n@SuppressWarnings(\"unchecked\")\npublic abstract class SimpleCriteriaRepository extends AbstractEntityRepository<Simple, Long>\n        implements CriteriaSupport<Simple>\n{\n\n    public List<Simple> queryByCriteria(String name, Boolean enabled, Integer from, Integer to)\n    {\n        return criteria()\n                .eq(Simple_.name, name)\n                .eq(Simple_.enabled, enabled)\n                .between(Simple_.counter, from, to)\n                .getResultList();\n    }\n\n    public List<Simple> queryByIgnoreCase(String name, String nameLike)\n    {\n        return criteria()\n                .or(\n                        criteria()\n                                .eqIgnoreCase(Simple_.name, name)\n                                .notEqIgnoreCase(Simple_.name, nameLike),\n                        criteria()\n                                .likeIgnoreCase(Simple_.name, nameLike)\n                                .notLikeIgnoreCase(Simple_.name, name)\n                )\n                .getResultList();\n    }\n\n    public Simple queryOptional(String name)\n    {\n        return criteria()\n                .eq(Simple_.name, name)\n                .getOptionalResult();\n    }\n\n    public Simple queryAny(String name)\n    {\n        return criteria()\n                .eq(Simple_.name, name)\n                .getAnyResult();\n    }\n\n    public List<Simple> findByTimeBetween(Date from, Date to)\n    {\n        return criteria()\n                .gt(Simple_.temporal, from)\n                .lt(Simple_.temporal, to)\n                .getResultList();\n    }\n\n    public Simple findBySuperName(String superName)\n    {\n        return criteria()\n                .eq(SuperSimple_.superName, superName)\n                .getSingleResult();\n    }\n\n    public Long criteriaCount(String name)\n    {\n        return criteria()\n                .select(Long.class, countDistinct(Simple_.name))\n                .eq(Simple_.name, name)\n                .getSingleResult();\n    }\n\n    public Statistics queryWithSelect(String name)\n    {\n        return criteria()\n                .select(Statistics.class, avg(Simple_.counter), count(Simple_.counter))\n                .eq(Simple_.name, name)\n                .getSingleResult();\n    }\n\n    public Object[] queryWithSelectAggregateReturnArray(String name)\n    {\n        return criteria()\n                .select(min(Simple_.counter), max(Simple_.counter),\n                        currDate(), currTime(), currTStamp())\n                .eq(Simple_.name, name)\n                .createQuery()\n                .getSingleResult();\n    }\n\n    public List<Object[]> queryWithSelectAttributes(String name)\n    {\n        return criteria()\n                .select(attribute(Simple_.name),\n                        upper(Simple_.name), lower(Simple_.name),\n                        substring(Simple_.name, 2), substring(Simple_.name, 2, 2))\n                .eq(Simple_.name, name)\n                .createQuery()\n                .getResultList();\n    }\n\n    public List<Simple> findOrderByNameAndCounter()\n    {\n        return criteria()\n                .orderDesc(Simple_.counter)\n                .orderAsc(Simple_.name)\n                .getResultList();\n    }\n\n    public Object[] queryWithSelectAttributesAndTrim(String name)\n    {\n        return criteria()\n                .select(attribute(Simple_.name), trim(Simple_.name),\n                        trim(CriteriaBuilder.Trimspec.LEADING, Simple_.name))\n                .eq(Simple_.name, name)\n                .createQuery()\n                .getSingleResult();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleFetchRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\n\r\n@Repository(methodPrefix = \"fetchBy\")\r\npublic abstract class SimpleFetchRepository extends AbstractEntityRepository<Simple, Long>\r\n{\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleIntermediateRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.EntityRepository;\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.Simple;\n\nimport jakarta.persistence.QueryHint;\nimport java.util.List;\n\n@Repository\npublic interface SimpleIntermediateRepository extends EntityRepository<Simple, Long>\n{\n    @Query(hints = {\n            @QueryHint(name = \"openjpa.hint.OptimizeResultCount\", value = \"some.invalid.value\"),\n            @QueryHint(name = \"org.hibernate.comment\", value = \"I'm a little comment short and stout\")\n    })\n    Simple findBy(Long id);\n\n    @Query(value = \"select name from simple_table\", isNative = true)\n    List<String> findAllNames();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleMappedDtoRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.EntityRepository;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.api.mapping.MappingConfig;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleDto;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleId;\n\n@Repository(forEntity = Simple.class)\n@MappingConfig(SimpleQueryInOutMapper.class)\npublic interface SimpleMappedDtoRepository extends EntityRepository<SimpleDto, SimpleId>\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleMappedRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport java.util.List;\n\nimport org.apache.deltaspike.data.api.EntityRepository;\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.api.mapping.MappingConfig;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.dto.BooleanWrapper;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleDto;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleId;\n\n@Repository(forEntity = Simple.class)\n@MappingConfig(SimpleMapper.class)\npublic interface SimpleMappedRepository extends EntityRepository<SimpleDto, SimpleId>\n{\n\n    SimpleDto findByName(String name);\n\n    List<SimpleDto> findByEnabled(Boolean enabled);\n\n    @MappingConfig(WrappedMapper.class)\n    List<SimpleDto> findByEnabled(BooleanWrapper enabled);\n\n    @Query(\"select e from Simple e where e.name = ?1\")\n    QueryResult<SimpleDto> findByNameToo(String name);\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleMapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleDto;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleId;\n\npublic class SimpleMapper implements QueryInOutMapper<Simple>\n{\n\n    @Override\n    public Object mapResult(Simple result)\n    {\n        SimpleDto dto = new SimpleDto();\n        dto.setId(new SimpleId(result.getId()));\n        dto.setName(result.getName());\n        dto.setEnabled(result.getEnabled());\n        return dto;\n    }\n\n    @Override\n    public Object mapResultList(List<Simple> result)\n    {\n        List<SimpleDto> dtos = new ArrayList<SimpleDto>(result.size());\n        for (Simple simple : result)\n        {\n            dtos.add((SimpleDto) mapResult(simple));\n        }\n        return dtos;\n    }\n\n    @Override\n    public boolean mapsParameter(Object parameter)\n    {\n        return parameter != null && (\n                parameter instanceof SimpleDto || parameter instanceof SimpleId);\n    }\n\n    @Override\n    public Object mapParameter(Object parameter)\n    {\n        if (parameter instanceof SimpleDto)\n        {\n            SimpleDto dto = (SimpleDto) parameter;\n            Simple simple = new Simple(dto.getName());\n            simple.setId(dto.getId() != null ? dto.getId().getId() : null);\n            simple.setEnabled(dto.getEnabled());\n            return simple;\n        }\n        return ((SimpleId) parameter).getId();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleQueryInOutMapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.mapping.SimpleQueryInOutMapperBase;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleDto;\nimport org.apache.deltaspike.data.test.domain.dto.SimpleId;\n\npublic class SimpleQueryInOutMapper extends SimpleQueryInOutMapperBase<Simple, SimpleDto>\n{\n\n    @Override\n    protected Object getPrimaryKey(SimpleDto dto)\n    {\n        return dto.getId() != null ? dto.getId().getId() : null;\n    }\n\n    @Override\n    protected SimpleDto toDto(Simple entity)\n    {\n        SimpleDto dto = new SimpleDto();\n        dto.setId(new SimpleId(entity.getId()));\n        dto.setEnabled(entity.getEnabled());\n        dto.setName(entity.getName());\n        return dto;\n    }\n\n    @Override\n    protected Simple toEntity(Simple entity, SimpleDto dto)\n    {\n        entity.setName(dto.getName());\n        entity.setEnabled(dto.getEnabled());\n        return entity;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport static jakarta.persistence.LockModeType.PESSIMISTIC_WRITE;\nimport static org.apache.deltaspike.data.api.SingleResultType.ANY;\nimport static org.apache.deltaspike.data.api.SingleResultType.OPTIONAL;\n\nimport java.util.List;\n\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\nimport org.apache.deltaspike.data.api.FirstResult;\nimport org.apache.deltaspike.data.api.MaxResults;\nimport org.apache.deltaspike.data.api.Modifying;\nimport org.apache.deltaspike.data.api.Query;\nimport org.apache.deltaspike.data.api.QueryParam;\nimport org.apache.deltaspike.data.api.QueryResult;\nimport org.apache.deltaspike.data.api.Repository;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.SimpleStringId;\n\n@Repository\npublic abstract class SimpleRepository extends AbstractEntityRepository<Simple, Long>\n{\n\n    public List<Simple> implementedQueryByName(String name)\n    {\n        String query = \"select s from Simple s where s.name = :name\";\n        return typedQuery(query)\n                .setParameter(\"name\", name)\n                .getResultList();\n    }\n\n    @Query(named = Simple.BY_NAME_ENABLED, max = 1)\n    public abstract List<Simple> findByNamedQueryIndexed(String name, Boolean enabled);\n\n    @Query(named = Simple.BY_NAME_LIKE, singleResult = OPTIONAL)\n    public abstract Simple findByNameOptional(String name);\n\n    @Query(named = Simple.BY_NAME_LIKE, singleResult = ANY)\n    public abstract Simple findByNameAny(String name);\n\n    @Query(named = Simple.BY_NAME_ENABLED)\n    public abstract List<Simple> findByNamedQueryRestricted(String name, Boolean enabled,\n            @MaxResults int max, @FirstResult Integer first);\n\n    @Query(named = Simple.BY_ID, lock = PESSIMISTIC_WRITE)\n    public abstract Simple findByNamedQueryNamed(\n            @QueryParam(\"id\") Long id, @QueryParam(\"enabled\") Boolean enabled);\n\n    @Query(\"select s from Simple s where s.name = ?1\")\n    public abstract Simple findByQuery(String name);\n\n    @Query(\"select count(s) from Simple s where s.name = ?1\")\n    public abstract Long findCountByQuery(String name);\n\n    @Query(\"select s from Simple s where s.name = ?1 order by s.counter desc\")\n    public abstract QueryResult<Simple> findByQueryWithOrderBy(String name);\n\n    public abstract Simple findByNameAndEnabled(String name, Boolean enabled);\n\n    public abstract Simple findByNameLikeIgnoreCase(String name);\n\n    public abstract Simple findByNameIgnoreCase(String name);\n\n    public abstract Simple findOptionalByName(String name);\n\n    public abstract Simple findAnyByName(String name);\n\n    public abstract List<Simple> findFirst2ByName(String name);\n\n    public abstract List<Simple> findTop2ByName(String name);\n\n    public abstract List<Simple> findFirst3OrderByName();\n\n    public abstract List<Simple> findAllOrderByName();\n    \n    public abstract long countByName(String name);\n    \n    public abstract List<Simple> findByOrderByCounterAscIdDesc();\n\n    @Query(value = \"SELECT * from SIMPLE_TABLE s WHERE s.name = ?1\", isNative = true)\n    public abstract List<Simple> findWithNative(String name);\n\n    @Modifying\n    @Query(\"update Simple as s set s.name = ?1 where s.id = ?2\")\n    public abstract int updateNameForId(String name, Long id);\n\n    @Query(named = Simple.BY_NAME_LIKE)\n    public abstract QueryResult<Simple> queryResultWithNamed(String name);\n\n    @Query(\"select s from Simple s\")\n    public abstract QueryResult<Simple> queryAll();\n\n    public abstract QueryResult<Simple> findByName(String name);\n\n    @Query(named = SimpleStringId.FIND_ALL_ORDER_BY_ID)\n    public abstract QueryResult<SimpleStringId> findAllOrderByIdPaginate(@FirstResult int start, @MaxResults int pageSize);\n\n    public abstract void deleteByName(String name);\n\n    public abstract void removeByName(String name);\n\n    public abstract void deleteByNameAndEnabled(String name, boolean enable);\n\n    public abstract void removeByNameAndEnabled(String name, Boolean aTrue);\n\n    @Override\n    protected abstract EntityManager entityManager();\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManager.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport java.util.List;\r\n\r\nimport org.apache.deltaspike.data.api.EntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\n\r\n@Repository\r\npublic interface SimpleRepositoryWithEntityManager extends EntityRepository<Simple, Long>\r\n{\r\n\r\n    List<Simple> findByName(String name);\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManagerResolver.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport java.util.List;\r\n\r\nimport org.apache.deltaspike.data.api.AbstractEntityRepository;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerConfig;\r\n\r\n@Repository\r\n@EntityManagerConfig(entityManagerResolver = SimplisticEntityManagerResolver.class)\r\npublic abstract class SimpleRepositoryWithEntityManagerResolver extends AbstractEntityRepository<Simple, Long>\r\n{\r\n\r\n    public abstract List<Simple> findByName(String name);\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleStringIdRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport java.util.List;\r\n\r\nimport org.apache.deltaspike.data.api.EntityRepository;\r\nimport org.apache.deltaspike.data.api.Query;\r\nimport org.apache.deltaspike.data.api.Repository;\r\nimport org.apache.deltaspike.data.test.domain.Simple;\r\nimport org.apache.deltaspike.data.test.domain.SimpleStringId;\r\n\r\n@Repository\r\npublic interface SimpleStringIdRepository extends EntityRepository<SimpleStringId, String>\r\n{\r\n    @Query(\"SELECT s FROM Simple s WHERE s.name = ?1\")\r\n    Simple findByName(String name);\r\n\r\n    @Query(\"SELECT s FROM Simple s WHERE s.name = ?1\")\r\n    List<Simple> findByName2(String name);\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Simplistic.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.service;\r\n\r\nimport static java.lang.annotation.ElementType.FIELD;\r\nimport static java.lang.annotation.ElementType.METHOD;\r\nimport static java.lang.annotation.ElementType.PARAMETER;\r\nimport static java.lang.annotation.ElementType.TYPE;\r\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\r\n\r\nimport java.lang.annotation.Documented;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.Target;\r\n\r\nimport jakarta.inject.Qualifier;\r\n\r\n@Qualifier\r\n@Target({ TYPE, METHOD, PARAMETER, FIELD })\r\n@Retention(RUNTIME)\r\n@Documented\r\npublic @interface Simplistic\r\n{\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimplisticEntityManagerResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport org.apache.deltaspike.data.api.EntityManagerResolver;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\npublic class SimplisticEntityManagerResolver implements EntityManagerResolver\n{\n\n    @Inject @Simplistic\n    private EntityManager entityManager;\n\n    @Override\n    public EntityManager resolveEntityManager()\n    {\n        return entityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Statistics.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\npublic class Statistics\n{\n\n    private final Double average;\n    private final Long count;\n\n    public Statistics(Double average, Long count)\n    {\n        this.average = average;\n        this.count = count;\n    }\n\n    @Override\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"Statistics [\")\n                .append(\"average=\").append(average)\n                .append(\", count=\").append(count)\n                .append(\"]\");\n        return builder.toString();\n    }\n\n    public Double getAverage()\n    {\n        return average;\n    }\n\n    public Long getCount()\n    {\n        return count;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/WrappedMapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.service;\n\nimport java.util.List;\n\nimport org.apache.deltaspike.data.api.mapping.QueryInOutMapper;\nimport org.apache.deltaspike.data.test.domain.Simple;\nimport org.apache.deltaspike.data.test.domain.dto.BooleanWrapper;\n\npublic class WrappedMapper implements QueryInOutMapper<Simple>\n{\n    private final SimpleMapper delegate = new SimpleMapper();\n\n    @Override\n    public boolean mapsParameter(Object parameter)\n    {\n        if (parameter != null && parameter instanceof BooleanWrapper)\n        {\n            return true;\n        }\n        return delegate.mapsParameter(parameter);\n    }\n\n    @Override\n    public Object mapParameter(Object parameter)\n    {\n        if (parameter instanceof BooleanWrapper)\n        {\n            return ((BooleanWrapper) parameter).getWrapped();\n        }\n        return delegate.mapParameter(parameter);\n    }\n\n    @Override\n    public Object mapResult(Simple result)\n    {\n        return delegate.mapResult(result);\n    }\n\n    @Override\n    public Object mapResultList(List<Simple> result)\n    {\n        return delegate.mapResultList(result);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/EntityManagerProducer.java",
    "content": "/*\n * Copyright 2016 The Apache Software Foundation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.apache.deltaspike.data.test.util;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.PersistenceContext;\n\npublic class EntityManagerProducer\n{\n    @Produces\n    @PersistenceContext\n    private EntityManager entityManager;\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/Logging.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.util;\r\n\r\nimport java.io.InputStream;\r\nimport java.util.logging.LogManager;\r\n\r\npublic class Logging\r\n{\r\n\r\n    private Logging()\r\n    {\r\n    }\r\n\r\n    public static void reconfigure()\r\n    {\r\n        try\r\n        {\r\n            InputStream loggingProperties = Logging.class.getClassLoader().getResourceAsStream(\"logging.properties\");\r\n            LogManager.getLogManager().readConfiguration(loggingProperties);\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            throw new RuntimeException(\"Failed to reconfigure Java Logging.\", e);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestData.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.data.test.util;\n\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.data.test.domain.Simple;\n\npublic class TestData\n{\n\n    private EntityManager entityManager;\n\n    public TestData(EntityManager entityManager)\n    {\n        this.entityManager = entityManager;\n    }\n\n    public Simple createSimple(String name)\n    {\n        return createSimple(name, null);\n    }\n\n    public Simple createSimple(String name, Integer counter)\n    {\n        Simple result = new Simple(name);\n        result.setCounter(counter);\n        entityManager.persist(result);\n        entityManager.flush();\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.data.test.util;\r\n\r\nimport org.apache.deltaspike.data.test.BMTransactionStrategy;\r\nimport org.apache.deltaspike.data.test.JpaTransactionStrategy;\r\nimport org.apache.deltaspike.data.test.TransactionalTestCase;\r\nimport org.apache.deltaspike.data.test.domain.AuditedEntity;\r\nimport org.jboss.arquillian.container.test.spi.TestDeployment;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.Asset;\r\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.jboss.shrinkwrap.resolver.api.maven.Maven;\r\n\r\nimport java.io.File;\r\nimport java.net.URL;\r\n\r\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\r\n\r\npublic abstract class TestDeployments {\r\n\r\n    /**\r\n     * Create a basic deployment with dependencies, beans.xml and persistence descriptor.\r\n     *\r\n     * @return Basic web archive.\r\n     */\r\n    public static WebArchive initDeployment()\r\n    {\r\n        return initDeployment(true, true);\r\n    }\r\n\r\n    public static WebArchive initDeployment(boolean addDefaultEntityManagerProducer)\r\n    {\r\n        return initDeployment(addDefaultEntityManagerProducer, BEANS_XML_ALL, true);\r\n    }\r\n\r\n    public static WebArchive initDeployment(boolean addDefaultEntityManagerProducer, boolean jpa)\r\n    {\r\n        return initDeployment(addDefaultEntityManagerProducer, BEANS_XML_ALL, jpa);\r\n    }\r\n\r\n    public static WebArchive initDeployment(boolean addDefaultEntityManagerProducer, Asset beansXmlAsset, boolean jpa)\r\n    {\r\n        Logging.reconfigure();\r\n\r\n        WebArchive archive = ShrinkWrap\r\n                .create(WebArchive.class, \"test.war\")\r\n                // used by many tests, shouldn't interfere with others\r\n                .addClasses(TransactionalTestCase.class, TestData.class)\r\n                .addPackages(true, AuditedEntity.class.getPackage())\r\n                .addAsLibraries(getDeltaSpikeDataWithDependencies())\r\n                .addAsWebInfResource(\"test-persistence.xml\", \"classes/META-INF/persistence.xml\")\r\n                .addAsWebInfResource(beansXmlAsset, \"beans.xml\");\r\n\r\n        if (addDefaultEntityManagerProducer)\r\n        {\r\n            archive.addClass(EntityManagerProducer.class);\r\n        }\r\n        if (jpa)\r\n        {\r\n            archive.addClass(JpaTransactionStrategy.class);\r\n        }\r\n        else\r\n        {\r\n            archive.addClass(BMTransactionStrategy.class);\r\n        }\r\n        \r\n        return archive;\r\n    }\r\n\r\n    public static File[] getDeltaSpikeDataWithDependencies()\r\n    {\r\n        return Maven.resolver().loadPomFromFile(\"pom.xml\").resolve(\r\n                \"org.apache.deltaspike.core:deltaspike-core-api\",\r\n                \"org.apache.deltaspike.core:deltaspike-core-impl\",\r\n                \"org.apache.deltaspike.modules:deltaspike-partial-bean-module-api\",\r\n                \"org.apache.deltaspike.modules:deltaspike-partial-bean-module-impl\",\r\n                \"org.apache.deltaspike.modules:deltaspike-jpa-module-api\",\r\n                \"org.apache.deltaspike.modules:deltaspike-jpa-module-impl\",\r\n                \"org.apache.deltaspike.modules:deltaspike-data-module-api\",\r\n                \"org.apache.deltaspike.modules:deltaspike-data-module-impl\")\r\n                .withTransitivity()\r\n                .asFile();\r\n    }\r\n\r\n    public static void addToEarManifestIfExists(EnterpriseArchive archive, String resource)\r\n    {\r\n        URL url = TestDeployment.class.getClassLoader().getResource(resource);\r\n        if (url != null) {\r\n            archive.addAsManifestResource(resource);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources/disabled/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.data.impl.RepositoryDeactivator\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources/log4j.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--\r\n  ~ Licensed to the Apache Software Foundation (ASF) under one\r\n  ~ or more contributor license agreements. See the NOTICE file\r\n  ~ distributed with this work for additional information\r\n  ~ regarding copyright ownership. The ASF licenses this file\r\n  ~ to you under the Apache License, Version 2.0 (the\r\n  ~ \"License\"); you may not use this file except in compliance\r\n  ~ with the License. You may obtain a copy of the License at\r\n  ~\r\n  ~ http://www.apache.org/licenses/LICENSE-2.0\r\n  ~\r\n  ~ Unless required by applicable law or agreed to in writing,\r\n  ~ software distributed under the License is distributed on an\r\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n  ~ KIND, either express or implied. See the License for the\r\n  ~ specific language governing permissions and limitations\r\n  ~ under the License.\r\n  -->\r\n<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">\r\n\r\n<log4j:configuration xmlns:log4j=\"http://jakarta.apache.org/log4j/\"\r\n    debug=\"false\">\r\n\r\n    <!-- ============================== -->\r\n    <!-- Append messages to the console -->\r\n    <!-- ============================== -->\r\n\r\n    <appender name=\"CONSOLE\" class=\"org.apache.log4j.ConsoleAppender\">\r\n        <param name=\"Target\" value=\"System.out\" />\r\n        <param name=\"Threshold\" value=\"DEBUG\" />\r\n\r\n        <layout class=\"org.apache.log4j.PatternLayout\">\r\n            <!-- The default pattern: Date Priority [Category] Message\\n -->\r\n            <param name=\"ConversionPattern\" value=\"%d{ABSOLUTE} %-5p [%c{1}] %m%n\" />\r\n        </layout>\r\n    </appender>\r\n\r\n    <!-- ================ -->\r\n    <!-- Limit categories -->\r\n    <!-- ================ -->\r\n\r\n    <category name=\"org.apache.deltaspike.data\">\r\n        <priority value=\"DEBUG\" />\r\n    </category>\r\n\r\n    <category name=\"org.glassfish\">\r\n        <priority value=\"ERROR\" />\r\n    </category>\r\n\r\n    <!-- ======================= -->\r\n    <!-- Setup the Root category -->\r\n    <!-- ======================= -->\r\n\r\n    <root>\r\n        <appender-ref ref=\"CONSOLE\" />\r\n    </root>\r\n\r\n</log4j:configuration>\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources/logging.properties",
    "content": "#\r\n# Licensed to the Apache Software Foundation (ASF) under one\r\n# or more contributor license agreements. See the NOTICE file\r\n# distributed with this work for additional information\r\n# regarding copyright ownership. The ASF licenses this file\r\n# to you under the Apache License, Version 2.0 (the\r\n# \"License\"); you may not use this file except in compliance\r\n# with the License. You may obtain a copy of the License at\r\n#\r\n# http://www.apache.org/licenses/LICENSE-2.0\r\n#\r\n# Unless required by applicable law or agreed to in writing,\r\n# software distributed under the License is distributed on an\r\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n# KIND, either express or implied. See the License for the\r\n# specific language governing permissions and limitations\r\n# under the License.\r\n#\r\n\r\nhandlers=java.util.logging.ConsoleHandler\r\n.level=SEVERE\r\n\r\njava.util.logging.FileHandler.pattern=%h/java%u.log\r\njava.util.logging.FileHandler.limit=50000\r\njava.util.logging.FileHandler.count=1\r\njava.util.logging.FileHandler.formatter=java.util.logging.XMLFormatter\r\n\r\njava.util.logging.ConsoleHandler.level=ALL\r\njava.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter\r\n\r\n#org.glassfish.level=SEVERE\r\n#com.sun.enterprise.level=INFO\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources/test-custom-orm.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n        xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\" version=\"2.0\">\n\n    <package>org.apache.deltaspike.data.test.domain.mapped</package>\n    <mapped-superclass class=\"MappedSuperclass\"/>\n    <mapped-superclass class=\"MappedId\">\n        <attributes>\n            <id name=\"id\">\n                <generated-value />\n            </id>\n        </attributes>\n    </mapped-superclass>\n    <entity class=\"org.apache.deltaspike.data.test.domain.mapped.MappedTwo\">\n        <id-class class=\"org.apache.deltaspike.data.test.domain.TeeId\"/>\n        <attributes>\n            <id name=\"teeSetId\"/>\n            <id name=\"holeId\"/>\n        </attributes>\n    </entity>\n    <entity class=\"MappedThree\">\n        <table name=\"mapped_three_table\" />\n    </entity>\n\n</entity-mappings>"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources/test-default-orm.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n        xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\" version=\"2.0\">\n\n    <package>org.apache.deltaspike.data.test.domain.mapped</package>\n    <entity class=\"MappedOne\" name=\"Mapped_One\">\n        <attributes>\n            <id name=\"id\">\n                <generated-value />\n            </id>\n        </attributes>\n    </entity>\n\n</entity-mappings>"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources/test-orm.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n        xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\" version=\"2.0\">\n\n    <persistence-unit-metadata>\n        <persistence-unit-defaults>\n            <entity-listeners>\n                <entity-listener class=\"org.apache.deltaspike.data.impl.audit.AuditEntityListener\" />\n            </entity-listeners>\n        </persistence-unit-defaults>\n    </persistence-unit-metadata>\n\n</entity-mappings>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-openejb/test-mapped-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"test\">\n        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>\n        <jta-data-source>testDatabase</jta-data-source>\n        <mapping-file>META-INF/orm.xml</mapping-file>\n        <mapping-file>META-INF/custom-orm.xml</mapping-file>\n        <properties>\n            <property name=\"openjpa.jdbc.SynchronizeMappings\" value=\"buildSchema(ForeignKeys=true)\"/>\n            <property name=\"openjpa.Log\" value=\"DefaultLevel=WARN, SQL=TRACE\"/>\n            <property name=\"openjpa.jdbc.DBDictionary\" value=\"hsql(SimulateLocking=true)\"/>\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-openejb/test-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--\r\n  ~ Licensed to the Apache Software Foundation (ASF) under one\r\n  ~ or more contributor license agreements. See the NOTICE file\r\n  ~ distributed with this work for additional information\r\n  ~ regarding copyright ownership. The ASF licenses this file\r\n  ~ to you under the Apache License, Version 2.0 (the\r\n  ~ \"License\"); you may not use this file except in compliance\r\n  ~ with the License. You may obtain a copy of the License at\r\n  ~\r\n  ~ http://www.apache.org/licenses/LICENSE-2.0\r\n  ~\r\n  ~ Unless required by applicable law or agreed to in writing,\r\n  ~ software distributed under the License is distributed on an\r\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n  ~ KIND, either express or implied. See the License for the\r\n  ~ specific language governing permissions and limitations\r\n  ~ under the License.\r\n  -->\r\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\r\n    <persistence-unit name=\"test\">\r\n        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>\r\n        <jta-data-source>testDatabase</jta-data-source>\r\n        <properties>\r\n            <property name=\"openjpa.jdbc.SynchronizeMappings\" value=\"buildSchema(ForeignKeys=true)\"/>\r\n            <property name=\"openjpa.Log\" value=\"DefaultLevel=WARN, SQL=TRACE\"/>\r\n            <property name=\"openjpa.jdbc.DBDictionary\" value=\"hsql(SimulateLocking=true)\"/>\r\n            <property name=\"openejb.jpa.init-entitymanager\" value=\"true\" /> \r\n        </properties>\r\n    </persistence-unit>\r\n</persistence>\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-payara/test-mapped-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"test\"> \n        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>\n        <jta-data-source>jdbc/__default</jta-data-source>\n        <mapping-file>META-INF/orm.xml</mapping-file>\n        <mapping-file>META-INF/custom-orm.xml</mapping-file>\n        <properties>\n            <property name=\"eclipselink.ddl-generation\" value=\"drop-and-create-tables\"/>\n            <property name=\"eclipselink.logging.level\" value=\"FINE\"/>\n            <property name=\"eclipselink.logging.parameters\" value=\"true\" />\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-payara/test-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"test\"> \n        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>\n        <jta-data-source>jdbc/__default</jta-data-source>\n        <properties>\n            <property name=\"eclipselink.ddl-generation\" value=\"drop-and-create-tables\"/>\n            <property name=\"eclipselink.logging.level\" value=\"FINE\"/>\n            <property name=\"eclipselink.logging.parameters\" value=\"true\" />\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-weblogic/test-mapped-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\">\n    <persistence-unit name=\"test\"> \n        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>\n        <jta-data-source>TestDS</jta-data-source>\n        <mapping-file>META-INF/orm.xml</mapping-file>\n        <mapping-file>META-INF/custom-orm.xml</mapping-file>\n        <properties>\n            <property name=\"eclipselink.ddl-generation\" value=\"drop-and-create-tables\"/>\n            <property name=\"eclipselink.logging.level\" value=\"FINE\"/>\n            <property name=\"eclipselink.logging.parameters\" value=\"true\" /> \n            <property name=\"eclipselink.deploy-on-startup\" value=\"true\" />\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-weblogic/test-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--\r\n  ~ Licensed to the Apache Software Foundation (ASF) under one\r\n  ~ or more contributor license agreements. See the NOTICE file\r\n  ~ distributed with this work for additional information\r\n  ~ regarding copyright ownership. The ASF licenses this file\r\n  ~ to you under the Apache License, Version 2.0 (the\r\n  ~ \"License\"); you may not use this file except in compliance\r\n  ~ with the License. You may obtain a copy of the License at\r\n  ~\r\n  ~ http://www.apache.org/licenses/LICENSE-2.0\r\n  ~\r\n  ~ Unless required by applicable law or agreed to in writing,\r\n  ~ software distributed under the License is distributed on an\r\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n  ~ KIND, either express or implied. See the License for the\r\n  ~ specific language governing permissions and limitations\r\n  ~ under the License.\r\n  -->\r\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\">\r\n    <persistence-unit name=\"test\"> \r\n        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>\r\n        <jta-data-source>TestDS</jta-data-source>\r\n        <properties>\r\n            <property name=\"eclipselink.ddl-generation\" value=\"drop-and-create-tables\"/>\r\n            <property name=\"eclipselink.logging.level\" value=\"FINE\"/>\r\n            <property name=\"eclipselink.logging.parameters\" value=\"true\" />\r\n            <property name=\"eclipselink.deploy-on-startup\" value=\"true\" />\r\n        </properties>\r\n    </persistence-unit>\r\n</persistence>\r\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-wildfly/test-mapped-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"test\"> \n        <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>\n        <mapping-file>META-INF/orm.xml</mapping-file>\n        <mapping-file>META-INF/custom-orm.xml</mapping-file>\n        <properties>\n            <property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\"/>\n        </properties>\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/modules/data/impl/src/test/resources-wildfly/test-persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--\r\n  ~ Licensed to the Apache Software Foundation (ASF) under one\r\n  ~ or more contributor license agreements. See the NOTICE file\r\n  ~ distributed with this work for additional information\r\n  ~ regarding copyright ownership. The ASF licenses this file\r\n  ~ to you under the Apache License, Version 2.0 (the\r\n  ~ \"License\"); you may not use this file except in compliance\r\n  ~ with the License. You may obtain a copy of the License at\r\n  ~\r\n  ~ http://www.apache.org/licenses/LICENSE-2.0\r\n  ~\r\n  ~ Unless required by applicable law or agreed to in writing,\r\n  ~ software distributed under the License is distributed on an\r\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n  ~ KIND, either express or implied. See the License for the\r\n  ~ specific language governing permissions and limitations\r\n  ~ under the License.\r\n  -->\r\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\r\n    <persistence-unit name=\"test\"> \r\n        <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>\r\n        <properties>\r\n            <property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\"/>\r\n            <property name=\"hibernate.show_sql\" value=\"true\"/>\r\n        </properties>\r\n    </persistence-unit>\r\n</persistence>\r\n"
  },
  {
    "path": "deltaspike/modules/data/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    \n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>data-module-project</artifactId>\n    <packaging>pom</packaging>\n    <name>Apache DeltaSpike Data-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n\n    <properties>\n        <shrinkwrap.version>3.2.1</shrinkwrap.version>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n\n            <dependency>\n                <groupId>org.jboss.shrinkwrap.resolver</groupId>\n                <artifactId>shrinkwrap-resolver-bom</artifactId>\n                <version>${shrinkwrap.version}</version>\n                <type>pom</type>\n                <scope>import</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.jboss.shrinkwrap.resolver</groupId>\n                <artifactId>shrinkwrap-resolver-impl-maven</artifactId>\n                <version>${shrinkwrap.version}</version>\n                <scope>test</scope>\n            </dependency>\n\n        </dependencies>\n    </dependencyManagement>\n</project>\n\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>jpa-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jpa-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike JPA-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.jpa.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.persistence.*,\n            jakarta.enterprise.inject,\n            !org.apache.deltaspike.jpa.*,\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/config/base/JpaBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.api.config.base;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig;\n\npublic interface JpaBaseConfig extends DeltaSpikeBaseConfig\n{\n    interface UserTransaction\n    {\n        String JNDI_NAME = ConfigResolver.resolve(\"deltaspike.jpa.user-transaction.jndi-name\")\n                .withCurrentProjectStage(true)\n                .withDefault(\"java:comp/UserTransaction\")\n                .getValue();\n\n        Integer TIMEOUT_IN_SECONDS = ConfigResolver.resolve(\"deltaspike.jpa.user-transaction.timeout_in_seconds\")\n                .as(Integer.class)\n                .withCurrentProjectStage(true)\n                .getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/entitymanager/EntityManagerConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jpa.api.entitymanager;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.persistence.FlushModeType;\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Configure the EntityManager for a specific repository.\n */\n@Target( { ElementType.TYPE, ElementType.METHOD } )\n@Retention(RetentionPolicy.RUNTIME)\n@Documented\n@Inherited\npublic @interface EntityManagerConfig\n{\n    /**\n     * References the type which provides the EntityManager for a specific repository.\n     * Must be resolvable over the BeanManager.\n     */\n    Class<? extends EntityManagerResolver> entityManagerResolver() default EntityManagerResolver.class;\n\n    /**\n     * If no entityManagerResolver is specified, then these qualifiers will be used to look up an entity manager\n     * @return\n     */\n    Class<? extends Annotation>[] qualifier() default Any.class;\n\n    /**\n     * Set the flush mode for the repository EntityManager.\n     */\n    FlushModeType flushMode() default FlushModeType.AUTO;\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/entitymanager/EntityManagerResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jpa.api.entitymanager;\n\nimport jakarta.persistence.EntityManager;\n\n/**\n * Resolve the EntityManager used for a specific repository.\n * Only necessary if there is more than one persistence unit.\n *\n * The container will look in the following order:\n * - A configured {@link EntityManagerConfig}\n * - A bean of type <code>EntityManagerResolver</code>\n * - Otherwise we'll assume there's a single {@link EntityManager}.\n */\npublic interface EntityManagerResolver\n{\n    EntityManager resolveEntityManager();\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/entitymanager/PersistenceUnitName.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.api.entitymanager;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\n\n/**\n * The name of the PersistenceUnit to get picked up by the\n * EntityManagerFactoryProducer.\n *\n * The EntityManagerFactoryProducer will in turn use the\n * {@link org.apache.deltaspike.jpa.spi.entitymanager.PersistenceConfigurationProvider}\n * to pick up the properties to be used for creating the {@code }EntityManagerFactory}.\n */\n@Target( { TYPE, METHOD, PARAMETER, FIELD })\n@Retention(value = RetentionPolicy.RUNTIME)\n@Documented\n@Qualifier\npublic @interface PersistenceUnitName\n{\n    /**\n     * @return the name of the persistence unit.\n     */\n    @Nonbinding\n    String value();\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/transaction/TransactionConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.api.transaction;\n\nimport org.apache.deltaspike.core.api.config.DeltaSpikeConfig;\n\n/**\n * Optional config for transactions\n */\npublic interface TransactionConfig extends DeltaSpikeConfig\n{\n    /**\n     * @return timeout in seconds or null\n     */\n    Integer getUserTransactionTimeoutInSeconds();\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/transaction/TransactionHelper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.api.transaction;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.util.concurrent.Callable;\n\n/**\n * <p></p>This class allows to execute CDI-unmanaged code blocks in a\n * &#064;Transactional manner. This is handy if you like e.g. to execute\n * database code in a unit test tearDown method.</p>\n *\n * <p><b>Attention:</b> please be aware that this helper only works for\n * &#064;Transactional with auto-detecting the EntityManager!\n * If you need to manually specify the EntityManager Qualifier\n * for another EntityManager, then you need to copy this code and adopt it.</p>\n * <p> Usage:\n * <pre>\n *  SomeEntity retVal = TransactionHelper.getInstance().executeTransactional( new Callable<Integer>() {\n *    private @Inject EntityManager em;\n *    public SomeEntity call() throws Exception {\n *      return em.find(entityId, SomeEntity.class);\n *    }\n *  } );\n * </pre>\n * </p>\n */\n@ApplicationScoped\npublic class TransactionHelper\n{\n    public static TransactionHelper getInstance()\n    {\n        return BeanProvider.getContextualReference(TransactionHelper.class);\n    }\n\n    /**\n     * Execute the given {@link Callable} in a Transitional manner.\n     *\n     * @param callable which will get executed in a &#064;Transactional block\n     * @param <T> the return type of the executed {@link Callable}\n     * @return the return value of the executed {@link Callable}\n     * @throws Exception\n     */\n    @Transactional\n    public <T> T executeTransactional(Callable<T> callable) throws Exception\n    {\n        return callable.call();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/transaction/TransactionScoped.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.api.transaction;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport jakarta.enterprise.context.NormalScope;\n\n/**\n * <p>A &#064;TransactionScoped contextual instance will be unique for a given\n * transaction controlled by {@link Transactional}. The context will get started when the outermost\n * {@link Transactional} method gets invoked and will get closed when\n * the call chain leaves the outermost {@link Transactional} method.</p>\n *\n * <p>The classic use-case is for producing JPA EntityManagers.\n * <pre>\n *  &#064;Dependent\n *  public class EntityManagerProducer\n *  {\n *      private &#064;PersistenceContext(unitName = \"test\") EntityManager entityManager;\n *\n *      public &#064;Produces &#064;TransactionScoped EntityManager createEntityManager()\n *      {\n *          return entityManager;\n *      }\n *\n *      public void closeEntityManager(&#064;Disposes EntityManager em)\n *      {\n *          if (em.isOpen()) //this check is optional -not needed if #close doesn't get called by the transactional bean\n *          {\n *              em.close();\n *          }\n *      }\n *  }\n * </pre>\n * </p>\n * or\n * <p>\n * <pre>\n *  &#064;Dependent\n *  public class EntityManagerProducer\n *  {\n *      private &#064;PersistenceUnit(unitName = \"test\") EntityManagerFactory entityManagerFactory;\n *\n *      public &#064;Produces &#064;TransactionScoped EntityManager createEntityManager()\n *      {\n *          return entityManagerFactory.createEntityManager();\n *      }\n *\n *      public void closeEntityManager(&#064;Disposes EntityManager em)\n *      {\n *          if (em.isOpen()) //this check is optional -not needed if #close doesn't get called by the transactional bean\n *          {\n *              em.close();\n *          }\n *      }\n *  }\n * </pre>\n * </p>\n *\n * <p>\n * Furthermore, it's possible to use different persistence-units with (simple) qualifiers\n * (for the producer- and dispose-methods and therefore also at the injection-points).\n * </p>\n *\n * <p>\n * It's also possible to use &#064;Transactional and &#064;TransactionScoped in an application-server.\n * Therefore it's only needed to configure one of the\n * {@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy}s which support JTA.\n * </p>\n *\n * @see Transactional\n */\n@Documented\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })\n@NormalScope(passivating = false)\npublic @interface TransactionScoped\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/transaction/Transactional.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.api.transaction;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * If it isn't possible to use EJBs, this interceptor adds transaction support to methods or a class.\n * The optional qualifier can be used to specify different entity managers.\n * <p/>\n * Further details can be found at {@link TransactionScoped} which is an optional scope which can be used together with\n * &#064;Transactional.\n */\n\n@InterceptorBinding\n@Documented\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.TYPE, ElementType.METHOD })\npublic @interface Transactional\n{\n    /**\n     * Optional qualifier/s which allow/s to start only specific transactions instead of one\n     * for the injected {@link jakarta.persistence.EntityManager}s.\n     * Default-value is {@link Any} which means any injected {@link jakarta.persistence.EntityManager}s\n     * should be detected automatically and transactions for all injected {@link jakarta.persistence.EntityManager}s\n     * will be started. Or the {@link jakarta.enterprise.inject.Default} {@link jakarta.persistence.EntityManager}\n     * will be used, if no qualifier and no {@link jakarta.persistence.EntityManager} was found (in the annotated class)\n     * (see DELTASPIKE-320).\n     *\n     * This qualifier can also be used for integrating other frameworks,\n     * which follow a different style (see DELTASPIKE-319) as well as the usage of\n     * {@link jakarta.persistence.EntityManager}s with qualifiers in a called method (of a different bean)\n     * which isn't {@link Transactional} itself.\n     *\n     * @return target persistence-unit identifier\n     */\n    @Nonbinding Class<? extends Annotation>[] qualifier() default Any.class;\n\n    /**\n     * Only evaluated on the first/outermost transactional bean/method in the chain\n     * @return true to trigger #rollback for the current transaction(s), false otherwise\n     */\n    @Nonbinding boolean readOnly() default false;\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/AbstractEntityDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.io.Serializable;\n\npublic abstract class AbstractEntityDescriptor\n{\n    private String id[];\n    private String version;\n    private String name;\n    private Class<?> entityClass;\n    private Class<? extends Serializable> idClass;\n\n    private AbstractEntityDescriptor parent;\n\n    public AbstractEntityDescriptor()\n    {\n        \n    }\n    \n    public AbstractEntityDescriptor(String[] id, String version, String name, Class<?> entityClass,\n            Class<? extends Serializable> idClass, AbstractEntityDescriptor parent)\n    {\n        this.id = id;\n        this.version = version;\n        this.name = name;\n        this.entityClass = entityClass;\n        this.idClass = idClass;\n        this.parent = parent;\n    }\n\n    public String[] getId()\n    {\n        return id;\n    }\n\n    public void setId(String[] id)\n    {\n        this.id = id;\n    }\n\n    public String getVersion()\n    {\n        return version;\n    }\n\n    public void setVersion(String version)\n    {\n        this.version = version;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public Class<?> getEntityClass()\n    {\n        return entityClass;\n    }\n\n    public void setEntityClass(Class<?> entityClass)\n    {\n        this.entityClass = entityClass;\n    }\n\n    public Class<? extends Serializable> getIdClass()\n    {\n        return idClass;\n    }\n\n    public void setIdClass(Class<? extends Serializable> idClass)\n    {\n        this.idClass = idClass;\n    }\n\n    public AbstractEntityDescriptor getParent()\n    {\n        return parent;\n    }\n\n    public void setParent(AbstractEntityDescriptor parent)\n    {\n        this.parent = parent;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/AbstractEntityHierarchyBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.util.List;\n\npublic final class AbstractEntityHierarchyBuilder\n{\n    private AbstractEntityHierarchyBuilder()\n    {\n    }\n\n    public static void buildHierarchy(List<EntityDescriptor> entities, List<MappedSuperclassDescriptor> superClasses)\n    {\n        for (EntityDescriptor descriptor : entities)\n        {\n            buildHierarchy(descriptor, entities, superClasses);\n        }\n    }\n\n    protected static void buildHierarchy(AbstractEntityDescriptor descriptor,\n            List<EntityDescriptor> entities, List<MappedSuperclassDescriptor> superClasses)\n    {\n        Class<?> superClass = descriptor.getEntityClass().getSuperclass();\n        while (superClass != null)\n        {\n            AbstractEntityDescriptor superDescriptor =\n                    findPersistentClassDescriptor(superClass, entities, superClasses);\n            if (superDescriptor != null)\n            {\n                if (descriptor.getParent() == null)\n                {\n                    buildHierarchy(superDescriptor, entities, superClasses);\n                }\n\n                descriptor.setParent(superDescriptor);\n                return;\n            }\n\n            superClass = superClass.getSuperclass();\n        }\n    }\n\n    protected static AbstractEntityDescriptor findPersistentClassDescriptor(Class<?> superClass,\n            List<EntityDescriptor> entities, List<MappedSuperclassDescriptor> superClasses)\n    {\n        for (MappedSuperclassDescriptor descriptor : superClasses)\n        {\n            if (descriptor.getEntityClass().equals(superClass))\n            {\n                return descriptor;\n            }\n        }\n\n        for (EntityDescriptor descriptor : entities)\n        {\n            if (descriptor.getEntityClass().equals(superClass))\n            {\n                return descriptor;\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/Descriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.net.URL;\n\nimport org.w3c.dom.Document;\n\npublic class Descriptor\n{\n    private final Document document;\n    private final URL url;\n\n    public Descriptor(Document document, URL url)\n    {\n        this.document = document;\n        this.url = url;\n    }\n\n    public Document getDocument()\n    {\n        return document;\n    }\n\n    public URL getUrl()\n    {\n        return url;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/DescriptorReader.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URL;\nimport java.util.Collections;\nimport java.util.Enumeration;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport javax.xml.parsers.DocumentBuilder;\nimport javax.xml.parsers.DocumentBuilderFactory;\nimport javax.xml.parsers.ParserConfigurationException;\nimport org.apache.deltaspike.core.util.AggregatedClassLoader;\n\nimport org.xml.sax.InputSource;\nimport org.xml.sax.SAXException;\n\nabstract class DescriptorReader\n{\n    private static final Logger LOG = Logger.getLogger(DescriptorReader.class.getName());\n\n    private final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n\n    protected List<Descriptor> readAllFromClassPath(String resource) throws IOException\n    {\n        List<Descriptor> result = new LinkedList<Descriptor>();\n        Enumeration<URL> urls = classLoader().getResources(resource);\n        while (urls.hasMoreElements())\n        {\n            URL u = urls.nextElement();\n            try\n            {\n                result.add(readFromUrl(u));\n            }\n            catch (Exception e)\n            {\n                LOG.log(Level.WARNING, \"Could not load \" + resource + \" from \" + u, e);\n            }\n        }\n        return Collections.unmodifiableList(result);\n    }\n\n    protected Descriptor readFromClassPath(String resource) throws IOException\n    {\n        return readFromUrl(classLoader().getResource(resource));\n    }\n\n    protected Descriptor readFromUrl(URL url) throws IOException\n    {\n        InputStream stream = url.openStream();\n        try\n        {\n            DocumentBuilder builder = factory.newDocumentBuilder();\n            return new Descriptor(builder.parse(new InputSource(stream)), url);\n        }\n        catch (SAXException e)\n        {\n            throw new RuntimeException(\"Failed reading XML document\", e);\n        }\n        catch (ParserConfigurationException e)\n        {\n            throw new RuntimeException(\"Failed reading XML document\", e);\n        }\n        finally\n        {\n            stream.close();\n        }\n    }\n\n    protected Descriptor read(String baseUrl, String resource) throws IOException\n    {\n        try\n        {\n            URL url = new URL(baseUrl + resource);\n            return readFromUrl(url);\n        }\n        catch (Exception e)\n        {\n            return readFromClassPath(resource);\n        }\n    }\n\n    protected String extractBaseUrl(URL fileUrl, String resource)\n    {\n        String file = fileUrl.toString();\n        return file.substring(0, file.length() - resource.length());\n    }\n\n    protected ClassLoader classLoader()\n    {\n        return AggregatedClassLoader.newInstance();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/EntityDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.io.Serializable;\n\npublic class EntityDescriptor extends AbstractEntityDescriptor\n{\n    private String tableName;\n\n    public EntityDescriptor()\n    {\n    }\n\n    public EntityDescriptor(String[] id, String version, String name, Class<?> entityClass,\n            Class<? extends Serializable> idClass, AbstractEntityDescriptor parent,\n            String tableName)\n    {\n        super(id, version, name, entityClass, idClass, parent);\n        this.tableName = tableName;\n    }\n    \n    public String getTableName()\n    {\n        return tableName;\n    }\n\n    public void setTableName(String tableName)\n    {\n        this.tableName = tableName;\n    }\n    \n    @Override\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"EntityDescriptor \")\n                .append(\"[entityClass=\").append(getEntityClass().getName())\n                .append(\", name=\").append(getName())\n                .append(\", idClass=\").append(getIdClass().getName())\n                .append(\", id=\").append(getId())\n                .append(\", superClass=\").append(getParent())\n                .append(\", tableName=\").append(tableName)\n                .append(\"]\");\n        return builder.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/EntityMappingsDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.util.List;\n\npublic class EntityMappingsDescriptor\n{\n    private List<MappedSuperclassDescriptor> mappedSuperclassDescriptors;\n    private List<EntityDescriptor> entityDescriptors;\n    private String packageName;\n\n    public EntityMappingsDescriptor(List<MappedSuperclassDescriptor> mappedSuperclassDescriptors,\n            List<EntityDescriptor> entityDescriptors, String packageName)\n    {\n        this.mappedSuperclassDescriptors = mappedSuperclassDescriptors;\n        this.entityDescriptors = entityDescriptors;\n        this.packageName = packageName;\n    }\n    \n    public List<MappedSuperclassDescriptor> getMappedSuperclassDescriptors()\n    {\n        return mappedSuperclassDescriptors;\n    }\n\n    public void setMappedSuperclassDescriptors(List<MappedSuperclassDescriptor> mappedSuperclassDescriptors)\n    {\n        this.mappedSuperclassDescriptors = mappedSuperclassDescriptors;\n    }\n\n    public List<EntityDescriptor> getEntityDescriptors()\n    {\n        return entityDescriptors;\n    }\n\n    public void setEntityDescriptors(List<EntityDescriptor> entityDescriptors)\n    {\n        this.entityDescriptors = entityDescriptors;\n    }\n\n    public String getPackageName()\n    {\n        return packageName;\n    }\n\n    public void setPackageName(String packageName)\n    {\n        this.packageName = packageName;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/EntityMappingsDescriptorParser.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.io.IOException;\nimport java.io.Serializable;\nimport java.util.Collections;\nimport java.util.LinkedList;\nimport java.util.List;\nimport jakarta.enterprise.inject.Vetoed;\n\nimport org.w3c.dom.Document;\nimport org.w3c.dom.Element;\nimport org.w3c.dom.Node;\nimport org.w3c.dom.NodeList;\n\n@Vetoed\npublic class EntityMappingsDescriptorParser extends DescriptorReader\n{\n    public static final String DEFAULT_ORM_PATH = \"META-INF/orm.xml\";\n\n    public EntityMappingsDescriptor readAll(String baseUrl, String resource) throws IOException\n    {\n        Document document = read(baseUrl, resource).getDocument();\n        return readFromDocument(document);\n    }\n\n    public EntityMappingsDescriptor readDefaultOrm(String baseUrl) throws IOException\n    {\n        try\n        {\n            Descriptor desc = read(baseUrl, DEFAULT_ORM_PATH);\n            return readFromDocument(desc.getDocument());\n        }\n        catch (Exception e)\n        {\n            return new EntityMappingsDescriptor(Collections.<MappedSuperclassDescriptor>emptyList(),\n                    Collections.<EntityDescriptor>emptyList(), null);\n        }\n    }\n\n    protected EntityMappingsDescriptor readFromDocument(Document doc)\n    {\n        String packageName =\n            parsePackageName(doc);\n        List<MappedSuperclassDescriptor> mappedSuperclassDescriptors =\n            parseMappedSuperclassDescriptors(doc, packageName);\n        List<EntityDescriptor> entityDescriptors =\n            parseEntityDescriptors(doc, packageName);\n        \n        return new EntityMappingsDescriptor(mappedSuperclassDescriptors, entityDescriptors, packageName);\n    }\n\n    protected String extractNodeAttribute(Element element, String childName, String attribute)\n    {\n        NodeList list = element.getElementsByTagName(childName);\n        if (list.getLength() == 0)\n        {\n            return null;\n        }\n        return extractAttribute(list.item(0), attribute);\n    }\n\n    protected String extractAttribute(Node item, String name)\n    {\n        Node node = item.getAttributes().getNamedItem(name);\n        if (node != null)\n        {\n            return node.getTextContent();\n        }\n        return null;\n    }\n    \n    protected String[] extractNodeAttributes(Element element, String childName, String attribute)\n    {\n        NodeList list = element.getElementsByTagName(childName);\n        if (list.getLength() == 0)\n        {\n            return null;\n        }\n        return extractAttributes(list, attribute);\n    }\n    \n    protected String[] extractAttributes(NodeList list, String name)\n    {\n        String[] values = null;\n        \n        for (int i = 0; i < list.getLength(); i++)\n        {\n            Node node = list.item(i).getAttributes().getNamedItem(name);\n            if (node != null)\n            {\n                if (values == null)\n                {\n                    values = new String[list.getLength()];\n                }\n                \n                values[i] = node.getTextContent();\n            }\n        }\n\n        return values;\n    }\n\n    protected String extractNodeContent(Element element, String name)\n    {\n        NodeList list = element.getElementsByTagName(name);\n        if (list.getLength() == 0)\n        {\n            return null;\n        }\n        return list.item(0).getTextContent();\n    }\n\n    protected String parsePackageName(Document doc)\n    {\n        return extractNodeContent(doc.getDocumentElement(), \"package\");\n    }\n    \n    protected List<MappedSuperclassDescriptor> parseMappedSuperclassDescriptors(Document doc, String packageName)\n    {\n        List<MappedSuperclassDescriptor> result = new LinkedList<MappedSuperclassDescriptor>();\n\n        NodeList mappings = doc.getElementsByTagName(\"mapped-superclass\");\n        for (int i = 0; i < mappings.getLength(); i++)\n        {\n            Node node = mappings.item(i);\n            \n            MappedSuperclassDescriptor entityDescriptor = new MappedSuperclassDescriptor();\n            parseCommonEntityDescriptorAttributes(packageName, entityDescriptor, node);\n            \n            result.add(entityDescriptor);\n        }\n        \n        return result;\n    }\n    \n    protected List<EntityDescriptor> parseEntityDescriptors(Document doc, String packageName)\n    {\n        List<EntityDescriptor> result = new LinkedList<EntityDescriptor>();\n\n        NodeList mappings = doc.getElementsByTagName(\"entity\");\n        for (int i = 0; i < mappings.getLength(); i++)\n        {\n            Node node = mappings.item(i);\n            \n            EntityDescriptor entityDescriptor = new EntityDescriptor();\n            parseCommonEntityDescriptorAttributes(packageName, entityDescriptor, node);\n            entityDescriptor.setTableName(extractNodeAttribute((Element) node, \"table\", \"name\"));\n\n            result.add(entityDescriptor);\n        }\n        \n        return result;\n    } \n    \n    protected void parseCommonEntityDescriptorAttributes(String packageName,\n            AbstractEntityDescriptor entityDescriptor, Node node)\n    {\n        entityDescriptor.setName(extractAttribute(node, \"name\"));\n        entityDescriptor.setVersion(extractNodeAttribute((Element) node, \"version\", \"name\"));\n\n        String[] id = extractNodeAttributes((Element) node, \"id\", \"name\");\n        if (id != null)\n        {\n            entityDescriptor.setId(id);\n        }\n        else\n        {\n            String embeddedId = extractNodeAttribute((Element) node, \"embedded-id\", \"name\");\n            if (embeddedId != null)\n            {\n                entityDescriptor.setId(new String[] { embeddedId });\n            }\n        }\n\n        String className = extractAttribute(node, \"class\");\n        if (className != null)\n        {\n            try\n            {\n                entityDescriptor.setEntityClass(Class.forName(buildClassName(className, packageName)));\n            }\n            catch (ClassNotFoundException e)\n            {\n                throw new IllegalArgumentException(\"Can't get class \" + buildClassName(className, packageName), e);\n            }\n        }\n\n        String idClass = extractNodeAttribute((Element) node, \"id-class\", \"class\");\n        if (idClass != null)\n        {\n            try\n            {\n                entityDescriptor.setIdClass(\n                        (Class<? extends Serializable>) Class.forName(buildClassName(idClass, packageName)));\n            }\n            catch (ClassNotFoundException e)\n            {\n                throw new IllegalArgumentException(\"Can't get class \" + buildClassName(className, packageName), e);\n            }\n        }\n    }\n    \n    protected String buildClassName(String clazzName, String packageName)\n    {\n        if (clazzName == null && packageName == null)\n        {\n            return null;\n        }\n        return (packageName != null && !isClassNameQualified(clazzName)) ? packageName + \".\" + clazzName : clazzName;\n    }\n\n    protected boolean isClassNameQualified(String name)\n    {\n        return name.contains(\".\");\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/MappedSuperclassDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.io.Serializable;\n\npublic class MappedSuperclassDescriptor extends AbstractEntityDescriptor\n{\n    public MappedSuperclassDescriptor()\n    {\n    }\n\n    public MappedSuperclassDescriptor(String[] id, String version, String name, Class<?> entityClass,\n            Class<? extends Serializable> idClass, AbstractEntityDescriptor parent)\n    {\n        super(id, version, name, entityClass, idClass, parent);\n    }\n\n    @Override\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"EntityDescriptor \")\n                .append(\"[entityClass=\").append(getEntityClass().getName())\n                .append(\", name=\").append(getName())\n                .append(\", idClass=\").append(getIdClass().getName())\n                .append(\", id=\").append(getId())\n                .append(\", superClass=\").append(getParent())\n                .append(\"]\");\n        return builder.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/PersistenceUnitDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.util.List;\nimport java.util.Map;\n\npublic class PersistenceUnitDescriptor\n{\n    private String name;\n    /*\n    private String transactionType;\n    private boolean excludeUnlistedClasses;\n    */\n    private List<EntityDescriptor> entityDescriptors;\n    private Map<String, String> properties;\n\n    public PersistenceUnitDescriptor(String name, List<EntityDescriptor> entityDescriptors,\n            Map<String, String> properties)\n    {\n        this.name = name;\n        this.entityDescriptors = entityDescriptors;\n        this.properties = properties;\n    }\n    \n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n    public List<EntityDescriptor> getEntityDescriptors()\n    {\n        return entityDescriptors;\n    }\n\n    public void setEntityDescriptors(List<EntityDescriptor> entityDescriptors)\n    {\n        this.entityDescriptors = entityDescriptors;\n    }\n\n    public Map<String, String> getProperties()\n    {\n        return properties;\n    }\n\n    public void setProperties(Map<String, String> properties)\n    {\n        this.properties = properties;\n    }\n    \n    @Override\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"PersistenceUnit [name=\").append(name)\n                .append(\", entityDescriptors=\").append(entityDescriptors).append(\"]\");\n        return builder.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/PersistenceUnitDescriptorParser.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport org.w3c.dom.Element;\nimport org.w3c.dom.Node;\nimport org.w3c.dom.NodeList;\n\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport jakarta.enterprise.inject.Vetoed;\n\n@Vetoed\npublic class PersistenceUnitDescriptorParser extends DescriptorReader\n{\n    public static final String RESOURCE_PATH = \"META-INF/persistence.xml\";\n\n    private final EntityMappingsDescriptorParser entityMappingsDescriptorParser\n        = new EntityMappingsDescriptorParser();\n    \n    public List<PersistenceUnitDescriptor> readAll() throws IOException\n    {\n        List<PersistenceUnitDescriptor> result = new LinkedList<PersistenceUnitDescriptor>();\n        List<Descriptor> persistenceXmls = readAllFromClassPath(RESOURCE_PATH);\n        for (Descriptor desc : persistenceXmls)\n        {\n            result.addAll(lookupUnits(desc));\n        }\n        return Collections.unmodifiableList(result);\n    }\n\n    protected List<PersistenceUnitDescriptor> lookupUnits(Descriptor descriptor)\n    {\n        List<PersistenceUnitDescriptor> result = new LinkedList<PersistenceUnitDescriptor>();\n        NodeList list = descriptor.getDocument().getDocumentElement().getElementsByTagName(\"persistence-unit\");\n        for (int i = 0; i < list.getLength(); i++)\n        {\n            Node node = list.item(i);\n\n            String unitName = extractUnitName(node);\n            String baseUrl = extractBaseUrl(descriptor.getUrl(), RESOURCE_PATH);\n            List<EntityDescriptor> entities = extractMappings((Element) node, baseUrl, unitName);\n            Map<String, String> properties = extractProperties((Element) node);\n\n            result.add(new PersistenceUnitDescriptor(unitName, entities, properties));\n        }\n        return result;\n    }\n\n    protected List<EntityDescriptor> extractMappings(Element element, String baseUrl, String unitName)\n    {\n        try\n        {\n            List<EntityDescriptor> entities = new LinkedList<EntityDescriptor>();\n            List<MappedSuperclassDescriptor> superClasses = new LinkedList<MappedSuperclassDescriptor>();\n            NodeList list = element.getElementsByTagName(\"mapping-file\");\n            readMappingFiles(baseUrl, unitName, entities, superClasses, list);\n            EntityMappingsDescriptor mappings = entityMappingsDescriptorParser.readDefaultOrm(baseUrl);\n            entities.addAll(mappings.getEntityDescriptors());\n            superClasses.addAll(mappings.getMappedSuperclassDescriptors());\n            AbstractEntityHierarchyBuilder.buildHierarchy(entities, superClasses);\n            return entities;\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Failed initializing mapping files\", e);\n        }\n    }\n\n    protected void readMappingFiles(String baseUrl, String unitName,\n                                  List<EntityDescriptor> entities, List<MappedSuperclassDescriptor> superClasses,\n                                  NodeList list)\n    {\n        for (int i = 0; i < list.getLength(); i++)\n        {\n            String resource = list.item(i).getTextContent();\n            try\n            {\n                EntityMappingsDescriptor mappings = entityMappingsDescriptorParser.readAll(baseUrl, resource);\n                entities.addAll(mappings.getEntityDescriptors());\n                superClasses.addAll(mappings.getMappedSuperclassDescriptors());\n            }\n            catch (Exception e)\n            {\n                throw new RuntimeException(\"[PersistenceUnit: \" + unitName + \"] \" +\n                        \"Unable to resolve named mapping-file [\" + resource + \"]\");\n            }\n        }\n    }\n\n    protected String extractUnitName(Node node)\n    {\n        return node.getAttributes().getNamedItem(\"name\").getTextContent();\n    }\n\n    protected Map<String, String> extractProperties(Element element)\n    {\n        Map<String, String> propertiesMap = new HashMap<String, String>();\n\n        Node propertiesNode = element.getElementsByTagName(\"properties\").item(0);\n        if (propertiesNode != null)\n        {\n            NodeList propertyNodes = propertiesNode.getChildNodes();\n            for (int i = 0; i < propertyNodes.getLength(); i++)\n            {\n                if (\"property\".equals(propertyNodes.item(i).getNodeName()))\n                {\n                    Element propertyNode = (Element) propertyNodes.item(i);\n                    propertiesMap.put(propertyNode.getAttribute(\"name\"), propertyNode.getAttribute(\"value\"));\n                }\n            }\n        }\n\n        return Collections.unmodifiableMap(propertiesMap);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/descriptor/xml/PersistenceUnitDescriptorProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.descriptor.xml;\n\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.util.List;\nimport jakarta.enterprise.inject.Vetoed;\nimport org.apache.deltaspike.core.util.StringUtils;\n\n@Vetoed\npublic final class PersistenceUnitDescriptorProvider\n{\n    private static final PersistenceUnitDescriptorProvider INSTANCE = new PersistenceUnitDescriptorProvider();\n\n    private final PersistenceUnitDescriptorParser persistenceUnitDescriptorParser\n        = new PersistenceUnitDescriptorParser();\n    \n    private List<PersistenceUnitDescriptor> persistenceUnitDescriptors = Collections.emptyList();\n\n    private PersistenceUnitDescriptorProvider()\n    {\n    }\n\n    public static PersistenceUnitDescriptorProvider getInstance()\n    {\n        return INSTANCE;\n    }\n\n    public void init()\n    {\n        try\n        {\n            persistenceUnitDescriptors = persistenceUnitDescriptorParser.readAll();\n        }\n        catch (IOException e)\n        {\n            throw new RuntimeException(\"Failed to parse persitence.xml's\", e);\n        }\n    }\n\n    public PersistenceUnitDescriptor get(String name)\n    {        \n        for (PersistenceUnitDescriptor unit : persistenceUnitDescriptors)\n        {\n            if (name.equalsIgnoreCase(unit.getName()))\n            {\n                return unit;\n            }\n        }\n        return null;\n    }\n\n    public boolean isEntity(Class<?> entityClass)\n    {        \n        return find(entityClass) != null;\n    }\n\n    public String[] primaryKeyFields(Class<?> entityClass)\n    {        \n        EntityDescriptor entity = find(entityClass);\n        if (entity != null)\n        {\n            if (entity.getId() != null)\n            {\n                return entity.getId();\n            }\n            \n            AbstractEntityDescriptor parent = entity.getParent();\n            while (parent != null)\n            {\n                if (parent.getId() != null)\n                {\n                    return parent.getId();\n                }\n                \n                parent = parent.getParent();\n            }\n        }\n        return null;\n    }\n\n    public String versionField(Class<?> entityClass)\n    {        \n        EntityDescriptor entity = find(entityClass);\n        if (entity != null)\n        {            \n            if (!StringUtils.isEmpty(entity.getVersion()))\n            {\n                return entity.getVersion();\n            }\n            \n            AbstractEntityDescriptor parent = entity.getParent();\n            while (parent != null)\n            {\n                if (!StringUtils.isEmpty(parent.getVersion()))\n                {\n                    return parent.getVersion();\n                }\n                \n                parent = parent.getParent();\n            }\n        }\n        return null;\n    }\n\n    public Class<?> primaryKeyIdClass(Class<?> entityClass)\n    {        \n        EntityDescriptor entity = find(entityClass);\n        if (entity != null)\n        {\n            if (entity.getIdClass() != null)\n            {\n                return entity.getIdClass();\n            }\n            \n            AbstractEntityDescriptor parent = entity.getParent();\n            while (parent != null)\n            {\n                if (parent.getIdClass() != null)\n                {\n                    return parent.getIdClass();\n                }\n                \n                parent = parent.getParent();\n            }\n        }\n        return null;\n    }\n\n    public String entityName(Class<?> entityClass)\n    {        \n        EntityDescriptor entity = find(entityClass);\n        if (entity != null)\n        {\n            return entity.getName();\n        }\n        return null;\n    }\n    \n    public String entityTableName(Class<?> entityClass)\n    {        \n        EntityDescriptor entity = find(entityClass);\n        if (entity != null)\n        {\n            return entity.getTableName();\n        }\n        return null;\n    }\n\n    public EntityDescriptor find(Class<?> entityClass)\n    {\n        for (PersistenceUnitDescriptor unit : persistenceUnitDescriptors)\n        {\n            EntityDescriptor entity = find(entityClass, unit);\n            if (entity != null)\n            {\n                return entity;\n            }\n        }\n        return null;\n    }\n    \n    protected EntityDescriptor find(Class<?> entityClass, PersistenceUnitDescriptor descriptor)\n    {\n        for (EntityDescriptor entity : descriptor.getEntityDescriptors())\n        {\n            if (entity.getEntityClass().equals(entityClass))\n            {\n                return entity;\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/entitymanager/ActiveEntityManagerHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.entitymanager;\n\nimport jakarta.persistence.EntityManager;\nimport java.io.Serializable;\n\n/**\n * Optional holder which allows to customize the handling of the {@link EntityManager}.\n * Multiple Entity-Managers with different qualifiers aren't supported.\n * See the data-module for further details.\n */\npublic interface ActiveEntityManagerHolder extends Serializable\n{\n    void set(EntityManager entityManager);\n\n    boolean isSet();\n\n    EntityManager get();\n\n    void dispose();\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/entitymanager/PersistenceConfigurationProvider.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.entitymanager;\n\nimport java.util.Properties;\n\n/**\n * Provide the configuration for the EntityManagerFactory\n * which gets produced with a given {@link org.apache.deltaspike.jpa.api.entitymanager.PersistenceUnitName}.\n *\n * By default we provide a configuration which con be configured\n * differently depending on the <i>-DdatabaseVendor</i> and the\n * {@link org.apache.deltaspike.core.api.projectstage.ProjectStage}\n */\npublic interface PersistenceConfigurationProvider\n{\n\n    /**\n     * @param persistenceUnitName the name of the persistence unit in persistence.xml\n     * @return the additional Properties from the configuration.\n     */\n    Properties getEntityManagerFactoryConfiguration(String persistenceUnitName);\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/entitymanager/QualifierBackedEntityManagerResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jpa.spi.entitymanager;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver;\n\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.persistence.EntityManager;\n\npublic class QualifierBackedEntityManagerResolver implements EntityManagerResolver\n{\n    private static final Logger logger = Logger.getLogger(QualifierBackedEntityManagerResolver.class.getName());\n    \n    private final Class<? extends Annotation>[] qualifiers;\n    private final BeanManager beanManager;\n\n    public QualifierBackedEntityManagerResolver(BeanManager beanManager, Class<? extends Annotation>... qualifiers)\n    {\n        this.beanManager = beanManager;\n        this.qualifiers = qualifiers;\n    }\n\n    @Override\n    public EntityManager resolveEntityManager()\n    {\n        Bean<EntityManager> entityManagerBean = resolveEntityManagerBeans();\n\n        if (entityManagerBean == null)\n        {\n            StringBuilder qualifierNames = new StringBuilder();\n            for (Class<?> c : qualifiers)\n            {\n                qualifierNames.append(c.getName()).append(\" \");\n            }\n            throw new IllegalStateException(\"Cannot find an EntityManager qualified with [\" + qualifierNames\n                    + \"]. Did you add a corresponding producer?\");\n        }\n\n        return (EntityManager) beanManager.getReference(entityManagerBean, EntityManager.class,\n                beanManager.createCreationalContext(entityManagerBean));\n    }\n    private Bean<EntityManager> resolveEntityManagerBeans()\n    {\n        Set<Bean<?>> entityManagerBeans = beanManager.getBeans(EntityManager.class, Any.Literal.INSTANCE);\n        if (entityManagerBeans == null)\n        {\n            entityManagerBeans = new HashSet<>();\n        }\n        Set<Bean<?>> detectedEntityManagerBeans = new HashSet<>();\n        for (Class<? extends Annotation> qualifierClass : qualifiers)\n        {\n            for (Bean<?> currentEntityManagerBean : entityManagerBeans)\n            {\n                Set<Annotation> foundQualifierAnnotations = currentEntityManagerBean.getQualifiers();\n\n                for (Annotation currentQualifierAnnotation : foundQualifierAnnotations)\n                {\n                    if (currentQualifierAnnotation.annotationType().equals(qualifierClass))\n                    {\n                        detectedEntityManagerBeans.add(currentEntityManagerBean);\n                    }\n                }\n            }\n        }\n        if (detectedEntityManagerBeans.size() > 1) \n        {\n            logger.warning(\"detected multiple entityManager provider: \" + detectedEntityManagerBeans);\n        }\n        if (!detectedEntityManagerBeans.isEmpty()) \n        {\n            Bean<?> entityManagerBean = detectedEntityManagerBeans.iterator().next();\n            logger.fine(\"detected entityManager provider: \" + entityManagerBean);\n            return (Bean<EntityManager>) entityManagerBean;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/spi/transaction/TransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.spi.transaction;\n\nimport org.apache.deltaspike.core.spi.InterceptorStrategy;\n\n/**\n * Marker interface for a plugable strategy for {@link org.apache.deltaspike.jpa.api.transaction.Transactional}.\n */\npublic interface TransactionStrategy extends InterceptorStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>jpa-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jpa-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike JPA-Module Impl</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.jpa.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.persistence.*,\n            !org.apache.deltaspike.jpa.impl.*,\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n        <deltaspike.osgi.provide.capability>\n            org.ops4j.pax.cdi.extension; extension=deltaspike-jpa-module-impl\n        </deltaspike.osgi.provide.capability>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jpa-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.transaction</groupId>\n            <artifactId>jakarta.transaction-api</artifactId>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/descriptor/xml/PersistenceUnitDescriptorInitExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.descriptor.xml;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptorProvider;\n\npublic class PersistenceUnitDescriptorInitExtension implements Extension, Deactivatable\n{\n    private Boolean isActivated = true;\n    \n    void beforeBeanDiscovery(@Observes BeforeBeanDiscovery before)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n\n        if (!isActivated)\n        {\n            return;\n        }\n\n        PersistenceUnitDescriptorProvider.getInstance().init();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/entitymanager/DefaultEntityManagerHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.entitymanager;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.jpa.spi.entitymanager.ActiveEntityManagerHolder;\n\n/**\n * Empty holder. Override and specialize in using module.\n * Currently only used by the data module.\n */\n@Dependent\npublic class DefaultEntityManagerHolder implements ActiveEntityManagerHolder\n{\n\n    @Override\n    public void set(EntityManager entityManager)\n    {\n        throw new UnsupportedOperationException(\n                \"Default implementation does not store an EntityManager\");\n    }\n\n    @Override\n    public boolean isSet()\n    {\n        return false;\n    }\n\n    @Override\n    public EntityManager get()\n    {\n        return null;\n    }\n\n    @Override\n    public void dispose()\n    {\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/entitymanager/EntityManagerFactoryProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.entitymanager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.Persistence;\nimport java.util.Properties;\nimport java.util.logging.Logger;\n\nimport org.apache.deltaspike.jpa.spi.entitymanager.PersistenceConfigurationProvider;\nimport org.apache.deltaspike.jpa.api.entitymanager.PersistenceUnitName;\n\n\n/**\n * <p>Built in support for injecting EntityManagerFactories into own beans.\n * The injection point must use the Qualifier {@link PersistenceUnitName}\n * to express the desired persistence unit name.</p>\n *\n * <p>The EntityManagerFactory for the given persistence unit will be produced\n * as &#064;Dependent scoped. It can be used to easily implement own\n * EntityManagerProviders as shown in the following example which provides\n * a producer according to the entitymanager-per-request design pattern:</p>\n * <pre>\n * &#064;ApplicationScoped\n * public class SampleEntityManagerProducer {\n *   &#064;Inject\n *   &#064;PersistenceUnitName(\"testPersistenceUnit\")\n *   private EntityManagerFactory emf;\n *\n *   &#064;Produces\n *   &#064;RequestScoped\n *   public EntityManager createEntityManager() {\n *     return emf.createEntityManager();\n *   }\n *\n *   public void closeEm(&#064;Disposes EntityManager em) {\n *     em.close();\n *   }\n * }\n *  </pre>\n */\n@ApplicationScoped\npublic class EntityManagerFactoryProducer\n{\n    private static final Logger LOG = Logger.getLogger(EntityManagerFactoryProducer.class.getName());\n\n\n    @Inject\n    private PersistenceConfigurationProvider persistenceConfigurationProvider;\n\n\n    @Produces\n    @Dependent\n    @PersistenceUnitName(\"any\") // the value is nonbinding, thus 'any' is just a dummy parameter here\n    public EntityManagerFactory createEntityManagerFactoryForUnit(InjectionPoint injectionPoint)\n    {\n        PersistenceUnitName unitNameAnnotation = injectionPoint.getAnnotated().getAnnotation(PersistenceUnitName.class);\n\n        if (unitNameAnnotation == null)\n        {\n            LOG.warning(\"@PersistenceUnitName annotation could not be found at EntityManagerFactory injection point!\");\n\n            return null;\n        }\n\n        String unitName = unitNameAnnotation.value();\n\n        Properties properties = persistenceConfigurationProvider.getEntityManagerFactoryConfiguration(unitName);\n\n        EntityManagerFactory emf = Persistence.createEntityManagerFactory(unitName, properties);\n\n        return emf;\n    }\n\n\n    public void disposeEntityManagerFactory(@Disposes @PersistenceUnitName(\"any\") EntityManagerFactory emf)\n    {\n        if (emf.isOpen())\n        {\n            emf.close();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/entitymanager/EntityManagerMetadata.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jpa.impl.entitymanager;\n\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerConfig;\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.persistence.FlushModeType;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.AnnotatedElement;\nimport java.util.Set;\n\npublic class EntityManagerMetadata\n{\n    private Class<? extends EntityManagerResolver> entityManagerResolverClass;\n    private EntityManagerResolver unmanagedResolver;\n    private Class<? extends Annotation>[] qualifiers;\n    private boolean entityManagerResolverIsNormalScope;\n    private FlushModeType entityManagerFlushMode;\n    private boolean readOnly = false;\n\n    public Class<? extends EntityManagerResolver> getEntityManagerResolverClass()\n    {\n        return entityManagerResolverClass;\n    }\n\n    public void setEntityManagerResolverClass(Class<? extends EntityManagerResolver> entityManagerResolverClass)\n    {\n        this.entityManagerResolverClass = entityManagerResolverClass;\n    }\n\n    public FlushModeType getEntityManagerFlushMode()\n    {\n        return entityManagerFlushMode;\n    }\n\n    public void setEntityManagerFlushMode(FlushModeType entityManagerFlushMode)\n    {\n        this.entityManagerFlushMode = entityManagerFlushMode;\n    }\n\n    public boolean isEntityManagerResolverIsNormalScope()\n    {\n        return entityManagerResolverIsNormalScope;\n    }\n\n    public void setEntityManagerResolverIsNormalScope(boolean entityManagerResolverIsNormalScope)\n    {\n        this.entityManagerResolverIsNormalScope = entityManagerResolverIsNormalScope;\n    }\n\n    public Class<? extends Annotation>[] getQualifiers()\n    {\n        return qualifiers;\n    }\n\n    public void setQualifiers(Class<? extends Annotation>[] qualifiers)\n    {\n        this.qualifiers = qualifiers;\n    }\n\n    public EntityManagerResolver getUnmanagedResolver()\n    {\n        return unmanagedResolver;\n    }\n\n    public void setUnmanagedResolver(EntityManagerResolver unmanagedResolver)\n    {\n        this.unmanagedResolver = unmanagedResolver;\n    }\n\n    public boolean readFrom(AnnotatedElement method, BeanManager beanManager)\n    {\n        EntityManagerConfig entityManagerConfig = method.getAnnotation(EntityManagerConfig.class);\n        boolean processed = processEntityManagerConfig(beanManager, entityManagerConfig);\n\n        Transactional transactional = method.getAnnotation(Transactional.class);\n\n        processed = processTransactional(processed, transactional);\n\n        return processed;\n    }\n\n    private boolean processTransactional(boolean processed, Transactional transactional)\n    {\n        if (transactional != null && this.qualifiers == null)\n        {\n            processed = true;\n            this.setQualifiers(transactional.qualifier());\n        }\n\n        if (transactional != null)\n        {\n            this.readOnly = transactional.readOnly();\n        }\n        return processed;\n    }\n\n    private boolean processEntityManagerConfig(BeanManager beanManager, EntityManagerConfig entityManagerConfig)\n    {\n        boolean processed = false;\n        if (entityManagerConfig != null)\n        {\n            processed = true;\n            this.setEntityManagerFlushMode(entityManagerConfig.flushMode());\n            this.setQualifiers(entityManagerConfig.qualifier());\n            Class<? extends EntityManagerResolver> resolverClass = entityManagerConfig.entityManagerResolver();\n            if (!resolverClass.equals(EntityManagerResolver.class))\n            {\n                this.setEntityManagerResolverClass(resolverClass);\n                Set<Bean<?>> beans = beanManager.getBeans(resolverClass);\n                Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();\n                this.setEntityManagerResolverIsNormalScope(beanManager.isNormalScope(scope));\n            }\n            else\n            {\n                this.setEntityManagerResolverIsNormalScope(false);\n            }\n        }\n        return processed;\n    }\n\n    public boolean isReadOnly()\n    {\n        return readOnly;\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/entitymanager/EntityManagerRef.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jpa.impl.entitymanager;\n\nimport jakarta.persistence.EntityManager;\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver;\n\npublic class EntityManagerRef\n{\n    private EntityManager entityManager;\n    private DependentProvider<? extends EntityManager> entityManagerDependentProvider;\n    \n    private Class<? extends EntityManagerResolver> entityManagerResolverClass;\n    private EntityManagerResolver entityManagerResolver;\n    private DependentProvider<? extends EntityManagerResolver> entityManagerResolverDependentProvider;\n        \n    public void release()\n    {\n        if (entityManagerDependentProvider != null)\n        {\n            entityManagerDependentProvider.destroy();\n        }\n        \n        if (entityManagerResolverDependentProvider != null)\n        {\n            entityManagerResolverDependentProvider.destroy();\n        }\n    }\n\n    public Class<? extends EntityManagerResolver> getEntityManagerResolverClass()\n    {\n        return entityManagerResolverClass;\n    }\n\n    public void setEntityManagerResolverClass(Class<? extends EntityManagerResolver> entityManagerResolverClass)\n    {\n        this.entityManagerResolverClass = entityManagerResolverClass;\n    }\n\n    public DependentProvider<? extends EntityManagerResolver> getEntityManagerResolverDependentProvider()\n    {\n        return entityManagerResolverDependentProvider;\n    }\n\n    public void setEntityManagerResolverDependentProvider(\n            DependentProvider<? extends EntityManagerResolver> entityManagerResolverDependentProvider)\n    {\n        this.entityManagerResolverDependentProvider = entityManagerResolverDependentProvider;\n    }\n\n    public EntityManager getEntityManager()\n    {\n        return entityManager;\n    }\n\n    public void setEntityManager(EntityManager entityManager)\n    {\n        this.entityManager = entityManager;\n    }\n\n    public EntityManagerResolver getEntityManagerResolver()\n    {\n        return entityManagerResolver;\n    }\n\n    public void setEntityManagerResolver(EntityManagerResolver entityManagerResolver)\n    {\n        this.entityManagerResolver = entityManagerResolver;\n    }\n\n    public DependentProvider<? extends EntityManager> getEntityManagerDependentProvider()\n    {\n        return entityManagerDependentProvider;\n    }\n\n    public void setEntityManagerDependentProvider(\n            DependentProvider<? extends EntityManager> entityManagerDependentProvider)\n    {\n        this.entityManagerDependentProvider = entityManagerDependentProvider;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/entitymanager/EntityManagerRefLookup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jpa.impl.entitymanager;\n\nimport java.util.Set;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver;\nimport org.apache.deltaspike.jpa.spi.entitymanager.ActiveEntityManagerHolder;\n\n@ApplicationScoped\npublic class EntityManagerRefLookup\n{\n    @Inject\n    private ActiveEntityManagerHolder activeEntityManagerHolder;\n\n    private volatile Boolean globalEntityManagerInitialized;\n    private boolean globalEntityManagerIsNormalScope;\n    private EntityManager globalEntityManager;\n    \n    private void lazyInitGlobalEntityManager()\n    {\n        if (this.globalEntityManagerInitialized == null)\n        {\n            initGlobalEntityManager();\n        }\n    }\n\n    private synchronized void initGlobalEntityManager()\n    {\n        // switch into paranoia mode\n        if (this.globalEntityManagerInitialized == null)\n        {\n            BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n            Set<Bean<?>> beans = beanManager.getBeans(EntityManager.class);\n            Bean<?> bean = beanManager.resolve(beans);\n\n            if (bean == null)\n            {\n                throw new IllegalStateException(\"Could not find EntityManager with default qualifier.\");\n            }\n            \n            globalEntityManagerIsNormalScope = beanManager.isNormalScope(bean.getScope());\n            if (globalEntityManagerIsNormalScope)\n            {\n                globalEntityManager = (EntityManager) beanManager.getReference(bean,\n                        EntityManager.class,\n                        beanManager.createCreationalContext(bean));       \n            }\n\n            this.globalEntityManagerInitialized = true;\n        }\n    }\n    \n    public EntityManagerRef lookupReference(final EntityManagerMetadata entityManagerMetadata)\n    {\n        EntityManagerRef ref = new EntityManagerRef();\n        EntityManagerResolver unmanagedResolver = entityManagerMetadata.getUnmanagedResolver();\n        if (unmanagedResolver != null)\n        {\n            ref.setEntityManagerResolver(unmanagedResolver);\n            ref.setEntityManager(unmanagedResolver.resolveEntityManager());\n        }\n        else if (entityManagerMetadata.getEntityManagerResolverClass() != null)\n        {\n            ref.setEntityManagerResolverClass(entityManagerMetadata.getEntityManagerResolverClass());\n\n            if (entityManagerMetadata.isEntityManagerResolverIsNormalScope())\n            {\n                ref.setEntityManagerResolver(\n                        BeanProvider.getContextualReference(ref.getEntityManagerResolverClass()));\n            }\n            else\n            {\n                ref.setEntityManagerResolverDependentProvider(\n                        BeanProvider.getDependent(ref.getEntityManagerResolverClass()));\n\n                ref.setEntityManagerResolver(\n                        ref.getEntityManagerResolverDependentProvider().get());\n            }\n            \n            ref.setEntityManager(\n                    ref.getEntityManagerResolver().resolveEntityManager());\n        }\n        else\n        {\n            if (activeEntityManagerHolder.isSet())\n            {\n                ref.setEntityManager(\n                        activeEntityManagerHolder.get());\n                \n                // TODO should we really not apply the FlushMode on the active EntityManager?\n                return ref;\n            }\n            else\n            {\n                lazyInitGlobalEntityManager();\n                if (globalEntityManagerIsNormalScope)\n                {\n                    ref.setEntityManager(globalEntityManager);\n                }\n                else\n                {\n                    ref.setEntityManagerDependentProvider(\n                            BeanProvider.getDependent(EntityManager.class));\n                    ref.setEntityManager(\n                            ref.getEntityManagerDependentProvider().get());\n                }\n            }\n        }\n\n        if (entityManagerMetadata.getEntityManagerFlushMode() != null)\n        {\n            ref.getEntityManager().setFlushMode(entityManagerMetadata.getEntityManagerFlushMode());\n        }\n\n        return ref;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/entitymanager/PersistenceConfigurationProviderImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.entitymanager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.Set;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.PropertyLoader;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.jpa.spi.entitymanager.PersistenceConfigurationProvider;\n\n/**\n * Default implementation of the PersistenceConfigurationProvider.\n *\n */\n@ApplicationScoped\npublic class PersistenceConfigurationProviderImpl implements PersistenceConfigurationProvider\n{\n    /**\n     * A prefix which will be used for looking up more specific\n     * information for a persistenceUnit.\n     *\n     * @see #addConfigProperties(Properties, String)\n     */\n    private static final String CONFIG_PREFIX = \"deltaspike.persistence.config.\";\n\n    @Override\n    public Properties getEntityManagerFactoryConfiguration(String persistenceUnitName)\n    {\n        Properties unitProperties = PropertyLoader.getProperties(\"persistence-\" + persistenceUnitName);\n\n        if (unitProperties == null)\n        {\n            unitProperties = new Properties();\n        }\n\n        // apply ConfigFilters to the configured values.\n        for (Map.Entry entry : unitProperties.entrySet())\n        {\n            String key = (String) entry.getKey();\n            String value = (String) entry.getValue();\n\n            entry.setValue(ConfigResolver.filterConfigValue(key, value));\n        }\n\n        unitProperties = addConfigProperties(unitProperties, persistenceUnitName);\n\n        // add spec expected attributes\n        unitProperties.put(\"jakarta.persistence.bean.manager\", BeanManagerProvider.getInstance().getBeanManager());\n\n        return unitProperties;\n    }\n\n\n    /**\n     * Load additional configuration from the Configuration system\n     * and overload the basic settings with that info.\n     *\n     * The key is deltaspike.persistence.config.${persistenceUnitName}.${originalKey}\n     *\n     * @see #CONFIG_PREFIX\n     * @since 1.8.0\n     */\n    protected Properties addConfigProperties(Properties unitProperties, String persistenceUnitName)\n    {\n        // we start with a copy of the original properties\n        Properties mergedConfig = new Properties();\n        mergedConfig.putAll(unitProperties);\n\n        Set<String> allConfigKeys = ConfigResolver.getAllProperties().keySet();\n        String unitPrefix = CONFIG_PREFIX + persistenceUnitName + \".\";\n        for (String configKey : allConfigKeys)\n        {\n            if (configKey.startsWith(unitPrefix))\n            {\n                mergedConfig.put(configKey.substring(unitPrefix.length()),\n                        ConfigResolver.getProjectStageAwarePropertyValue(configKey));\n            }\n        }\n\n        return mergedConfig;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/BeanManagedUserTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\nimport org.apache.deltaspike.core.impl.util.JndiUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.jpa.api.config.base.JpaBaseConfig;\nimport org.apache.deltaspike.jpa.api.transaction.TransactionConfig;\nimport org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityTransaction;\nimport jakarta.transaction.Status;\nimport jakarta.transaction.SystemException;\nimport jakarta.transaction.TransactionSynchronizationRegistry;\nimport jakarta.transaction.UserTransaction;\nimport java.lang.annotation.Annotation;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * <p>{@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy} for using JTA (bean-managed-)transactions\n * (including XA transactions with a XA DataSource).\n * The basic features are identical to the {@link ResourceLocalTransactionStrategy} (for\n * persistent-unit-transaction-type 'RESOURCE_LOCAL' only).</p>\n */\n@Dependent\n@Alternative\n@SuppressWarnings(\"UnusedDeclaration\")\n//TODO move to a separated ds-jta module and use @Specializes -> no additional config is needed\npublic class BeanManagedUserTransactionStrategy extends ResourceLocalTransactionStrategy\n{\n    protected static final String TRANSACTION_SYNC_REGISTRY_JNDI_NAME = \"java:comp/TransactionSynchronizationRegistry\";\n\n    private static final long serialVersionUID = -2432802805095533499L;\n\n    private static final Logger LOGGER = Logger.getLogger(BeanManagedUserTransactionStrategy.class.getName());\n\n    @Inject\n    private BeanManager beanManager;\n\n    private transient TransactionConfig transactionConfig;\n\n    @Override\n    protected EntityManagerEntry createEntityManagerEntry(\n        EntityManager entityManager, Class<? extends Annotation> qualifier)\n    {\n        applyTransactionTimeout(); //needs to be done before UserTransaction#begin - TODO move this call\n        return super.createEntityManagerEntry(entityManager, qualifier);\n    }\n\n    protected void applyTransactionTimeout()\n    {\n        Integer transactionTimeout = getDefaultTransactionTimeoutInSeconds();\n\n        if (transactionTimeout == null)\n        {\n            //the default configured for the container will be used\n            return;\n        }\n\n        try\n        {\n            UserTransaction userTransaction = resolveUserTransaction();\n\n            if (userTransaction != null && userTransaction.getStatus() != Status.STATUS_ACTIVE)\n            {\n                userTransaction.setTransactionTimeout(transactionTimeout);\n            }\n        }\n        catch (SystemException e)\n        {\n            LOGGER.log(Level.WARNING, \"UserTransaction#setTransactionTimeout failed\", e);\n        }\n    }\n\n    protected Integer getDefaultTransactionTimeoutInSeconds()\n    {\n        if (this.transactionConfig == null)\n        {\n            lazyInit();\n        }\n\n        return transactionConfig.getUserTransactionTimeoutInSeconds();\n    }\n\n    protected synchronized void lazyInit()\n    {\n        if (this.transactionConfig != null)\n        {\n            return;\n        }\n\n        this.transactionConfig = BeanProvider.getContextualReference(TransactionConfig.class, true);\n\n        if (this.transactionConfig == null)\n        {\n            this.transactionConfig = createDefaultTransactionConfig();\n        }\n    }\n\n    protected TransactionConfig createDefaultTransactionConfig()\n    {\n        return new TransactionConfig()\n        {\n            private static final long serialVersionUID = -3915439087580270117L;\n\n            @Override\n            public Integer getUserTransactionTimeoutInSeconds()\n            {\n                return JpaBaseConfig.UserTransaction.TIMEOUT_IN_SECONDS;\n            }\n        };\n    }\n\n    @Override\n    protected EntityTransaction getTransaction(EntityManagerEntry entityManagerEntry)\n    {\n        return new UserTransactionAdapter();\n    }\n\n    /**\n     * Needed because the {@link EntityManager} might get created outside of the {@link UserTransaction}\n     * (e.g. depending on the implementation of the producer).\n     * Can't be in {@link BeanManagedUserTransactionStrategy.UserTransactionAdapter#begin()}\n     * because {@link ResourceLocalTransactionStrategy} needs to do\n     * <pre>\n     * if (!transaction.isActive())\n     * {\n     *     transaction.begin();\n     * }\n     * </pre>\n     * for the {@link EntityTransaction} of every {@link EntityManager}\n     * and {@link BeanManagedUserTransactionStrategy.UserTransactionAdapter#isActive()}\n     * can only use the status information of the {@link UserTransaction} and therefore\n     * {@link BeanManagedUserTransactionStrategy.UserTransactionAdapter#begin()}\n     * will only executed once, but {@link jakarta.persistence.EntityManager#joinTransaction()}\n     * needs to be called for every {@link EntityManager}.\n     * @param invocationContext current invocation-context\n     * @param entityManagerEntry entry of the current entity-manager\n     * @param transaction current JTA transaction wrapped in an EntityTransaction adapter\n     */\n    @Override\n    protected void beforeProceed(InvocationContext invocationContext,\n                                 EntityManagerEntry entityManagerEntry,\n                                 EntityTransaction transaction)\n    {\n        entityManagerEntry.getEntityManager().joinTransaction();\n    }\n\n    protected UserTransaction resolveUserTransaction()\n    {\n        //manual lookup needed because injecting UserTransactionResolver can fail (see the comment there)\n        try\n        {\n            DependentProvider<UserTransactionResolver> provider =\n                BeanProvider.getDependent(this.beanManager, UserTransactionResolver.class);\n\n            UserTransaction userTransaction = provider.get().resolveUserTransaction();\n\n            provider.destroy();\n            return userTransaction;\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n    protected TransactionSynchronizationRegistry resolveTransactionRegistry()\n    {\n        return JndiUtils.lookup(TRANSACTION_SYNC_REGISTRY_JNDI_NAME, TransactionSynchronizationRegistry.class);\n    }\n\n    private class UserTransactionAdapter implements EntityTransaction\n    {\n        private final UserTransaction userTransaction;\n        //needed for calls through an EJB with CMT\n        private final TransactionSynchronizationRegistry transactionSynchronizationRegistry;\n\n        public UserTransactionAdapter()\n        {\n            this.userTransaction = resolveUserTransaction();\n\n            if (this.userTransaction == null)\n            {\n                this.transactionSynchronizationRegistry = resolveTransactionRegistry();\n\n                if (this.transactionSynchronizationRegistry.getTransactionStatus() != Status.STATUS_ACTIVE)\n                {\n                    throw new IllegalStateException(\n                        \"The CMT is not active. Please check the config of the Data-Source.\");\n                }\n            }\n            else\n            {\n                this.transactionSynchronizationRegistry = null;\n            }\n        }\n\n        /**\n         * Only delegate to the {@link UserTransaction} if the state of the\n         * {@link UserTransaction} is {@link Status#STATUS_NO_TRANSACTION}\n         * (= the status before and after a started transaction).\n         */\n        @Override\n        public void begin()\n        {\n            if (this.userTransaction == null)\n            {\n                throw new UnsupportedOperationException(\"A CMT is active. This operation is only supported with BMT.\");\n            }\n\n            try\n            {\n                //2nd check (already done by #isActive triggered by ResourceLocalTransactionStrategy directly before)\n                //currently to filter STATUS_UNKNOWN - see to-do -> TODO re-visit it\n                if (this.userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION)\n                {\n                    this.userTransaction.begin();\n                }\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        /**\n         * Only delegate to the {@link UserTransaction} if the state of the\n         * {@link UserTransaction} is one of\n         * <ul>\n         *     <li>{@link Status#STATUS_ACTIVE}</li>\n         *     <li>{@link Status#STATUS_PREPARING}</li>\n         *     <li>{@link Status#STATUS_PREPARED}</li>\n         * </ul>\n         */\n        @Override\n        public void commit()\n        {\n            if (this.userTransaction == null)\n            {\n                throw new UnsupportedOperationException(\"A CMT is active. This operation is only supported with BMT.\");\n            }\n\n            try\n            {\n                if (isTransactionReadyToCommit())\n                {\n                    this.userTransaction.commit();\n                }\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        /**\n         * Only delegate to the {@link UserTransaction} if the state of the\n         * {@link UserTransaction} is one of\n         * <ul>\n         *     <li>{@link Status#STATUS_ACTIVE}</li>\n         *     <li>{@link Status#STATUS_PREPARING}</li>\n         *     <li>{@link Status#STATUS_PREPARED}</li>\n         *     <li>{@link Status#STATUS_MARKED_ROLLBACK}</li>\n         *     <li>{@link Status#STATUS_COMMITTING}</li>\n         * </ul>\n         */\n        @Override\n        public void rollback()\n        {\n            if (this.userTransaction == null)\n            {\n                throw new UnsupportedOperationException(\"A CMT is active. This operation is only supported with BMT.\");\n            }\n\n            try\n            {\n                if (isTransactionAllowedToRollback())\n                {\n                    this.userTransaction.rollback();\n                }\n            }\n            catch (SystemException e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        @Override\n        public void setRollbackOnly()\n        {\n            try\n            {\n                if (this.userTransaction != null)\n                {\n                    this.userTransaction.setRollbackOnly();\n                }\n                else\n                {\n                    this.transactionSynchronizationRegistry.setRollbackOnly();\n                }\n\n            }\n            catch (SystemException e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        @Override\n        public boolean getRollbackOnly()\n        {\n            try\n            {\n                return getTransactionStatus() == Status.STATUS_MARKED_ROLLBACK;\n            }\n            catch (SystemException e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        /**\n         * @return true if the transaction has been started and not ended\n         */\n        @Override\n        public boolean isActive()\n        {\n            //we can't use the status of the overall\n            try\n            {\n                return this.getTransactionStatus() != Status.STATUS_NO_TRANSACTION &&\n                        this.getTransactionStatus() != Status.STATUS_UNKNOWN; //TODO re-visit it\n            }\n            catch (SystemException e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        protected boolean isTransactionAllowedToRollback() throws SystemException\n        {\n            //if the following gets changed, it needs to be tested with different constellations\n            //(normal exception, timeout,...) as well as servers\n            return this.getTransactionStatus() != Status.STATUS_COMMITTED &&\n                    this.getTransactionStatus() != Status.STATUS_NO_TRANSACTION &&\n                    this.getTransactionStatus() != Status.STATUS_UNKNOWN;\n        }\n\n        protected boolean isTransactionReadyToCommit() throws SystemException\n        {\n            return getTransactionStatus() == Status.STATUS_ACTIVE ||\n                    getTransactionStatus() == Status.STATUS_PREPARING ||\n                    getTransactionStatus() == Status.STATUS_PREPARED;\n        }\n\n        protected int getTransactionStatus() throws SystemException\n        {\n            if (this.userTransaction != null)\n            {\n                return this.userTransaction.getStatus();\n            }\n            else\n            {\n                return this.transactionSynchronizationRegistry.getTransactionStatus();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/ContainerManagedTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.interceptor.InvocationContext;\n\n/**\n * <p>{@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy} for CMT for the data-module.</p>\n */\n@Dependent\n@Alternative\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class ContainerManagedTransactionStrategy implements TransactionStrategy\n{\n    private static final long serialVersionUID = 70354806762739497L;\n\n    @Override\n    public Object execute(InvocationContext invocationContext) throws Exception\n    {\n        return invocationContext.proceed();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/EnvironmentAwareTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.interceptor.InvocationContext;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityTransaction;\nimport java.lang.annotation.Annotation;\n\n/**\n * <p>This alternative {@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy} uses auto-detection and\n * can be used for different (parallel) persistence-units which use different transaction-types or\n * if different environments (dev., prod.,...) should use different transaction-types.</p>\n *\n * <p>This implementation can be used for environments which allow a mixed usage of JTA and RESOURCE_LOCAL.\n * (Within a transactional call it isn't possible to mix different transaction-types.)<b/>\n *\n * E.g.: in an application-server this class allows to use a persistence-unit with\n * transaction-type=\"RESOURCE_LOCAL\" + non-jta-data-source\n * in parallel to a persistence-unit with\n * transaction-type=\"JTA\" + jta-data-source</p>\n *\n * <p>Optional:<br/>\n * E.g. in case of a project-stage based logic\n * {@link org.apache.deltaspike.core.api.exclude.Exclude} can be used to switch between different\n * producer-beans.</p>\n *\n * <p>It's a better alternative than extending\n * {@link BeanManagedUserTransactionStrategy}\n * (which would lead to an impl. dependency) only for using\n * {@link org.apache.deltaspike.core.api.exclude.Exclude} at the custom\n * {@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy}\n * (or doing a custom veto-extension).</p>\n */\n@Dependent\n@Alternative\n@SuppressWarnings(\"UnusedDeclaration\")\n//TODO depending on further discussions about an own JTA module, BeanManagedUserTransactionStrategy\n//could be the default (via @Specializes) in the ds-jta module.\n//Depending on further discussions this class can be merged with BeanManagedUserTransactionStrategy or\n//we keep BeanManagedUserTransactionStrategy separated as a small tweak for applications which only use JTA transactions\n//or as a base implementation for a custom EnvironmentAwareTransactionStrategy.\npublic class EnvironmentAwareTransactionStrategy extends BeanManagedUserTransactionStrategy\n{\n    private static final long serialVersionUID = -4432802805095533499L;\n\n    private static ThreadLocal<Boolean> isJtaModeDetected = new ThreadLocal<Boolean>();\n\n    @Override\n    protected EntityManagerEntry createEntityManagerEntry(\n            EntityManager entityManager, Class<? extends Annotation> qualifier)\n    {\n        boolean isTransactionTypeJta = false;\n\n        //Ensures that nested transactional beans with different entity-managers don't lead to a rollback\n        //(in case of transaction-type JTA).\n        if (isJtaModeDetected.get() == null)\n        {\n            try\n            {\n                //This check is only valid here, because the transaction isn't started.\n                entityManager.getTransaction();\n            }\n            catch (IllegalStateException e)\n            {\n                isTransactionTypeJta = true;\n            }\n            isJtaModeDetected.set(isTransactionTypeJta);\n        }\n        else\n        {\n            isTransactionTypeJta = isInJtaTransaction();\n        }\n\n        if (isTransactionTypeJta)\n        {\n            applyTransactionTimeout(); //needs to be done before UserTransaction#begin - TODO move this call\n        }\n        return new EntityManagerEntry(entityManager, qualifier);\n    }\n\n    @Override\n    protected void beforeProceed(InvocationContext invocationContext,\n                                 EntityManagerEntry entityManagerEntry,\n                                 EntityTransaction transaction)\n    {\n        if (isInJtaTransaction())\n        {\n            super.beforeProceed(invocationContext, entityManagerEntry, transaction);\n        }\n    }\n\n    @Override\n    protected EntityTransaction getTransaction(EntityManagerEntry entityManagerEntry)\n    {\n        if (isInJtaTransaction())\n        {\n            return super.getTransaction(entityManagerEntry);\n        }\n\n        return entityManagerEntry.getEntityManager().getTransaction();\n    }\n\n    @Override\n    protected void onCloseTransactionScope()\n    {\n        super.onCloseTransactionScope();\n        isJtaModeDetected.set(null);\n        isJtaModeDetected.remove();\n    }\n\n    private static boolean isInJtaTransaction()\n    {\n        return Boolean.TRUE.equals(isJtaModeDetected.get());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/ManagedUserTransactionResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport jakarta.annotation.Resource;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.transaction.UserTransaction;\n\n//we need to keep it separated,\n//because the injection of UserTransaction might fail with an exception (see DELTASPIKE-986)\n@Dependent\npublic class ManagedUserTransactionResolver\n{\n    @Resource\n    private UserTransaction userTransaction;\n\n    public UserTransaction resolveUserTransaction()\n    {\n        return userTransaction;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/ResourceLocalTransactionStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityTransaction;\n\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerMetadata;\nimport org.apache.deltaspike.jpa.impl.transaction.context.EntityManagerEntry;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.spi.entitymanager.ActiveEntityManagerHolder;\nimport org.apache.deltaspike.jpa.spi.entitymanager.QualifierBackedEntityManagerResolver;\nimport org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy;\n\n/**\n * <p>Default implementation of our plugable TransactionStrategy.\n * It supports nested Transactions with the MANDATORY behaviour.</p>\n *\n * <p>The outermost &#064;Transactional interceptor for the given\n * {@link jakarta.inject.Qualifier} will open an {@link jakarta.persistence.EntityTransaction}\n * and the outermost &#064;Transactional interceptor for <b>all</b>\n * EntityManagers will flush and subsequently close all open transactions.</p>\n *\n * <p>If an Exception occurs in flushing the EntityManagers or any other Exception\n * gets thrown inside the intercepted method chain and <i>not</i> gets catched\n * until the outermost &#064;Transactional interceptor gets reached, then all\n * open transactions will get rollbacked.</p>\n *\n * <p>If you like to implement your own TransactionStrategy, then use the\n * standard CDI &#064;Alternative mechanism.</p>\n */\n@Dependent\npublic class ResourceLocalTransactionStrategy implements TransactionStrategy\n{\n    private static final long serialVersionUID = -1432802805095533499L;\n\n    private static final Logger LOGGER = Logger.getLogger(ResourceLocalTransactionStrategy.class.getName());\n\n    @Inject\n    private BeanManager beanManager;\n\n    @Inject\n    private TransactionStrategyHelper transactionHelper;\n\n    @Inject\n    private ActiveEntityManagerHolder emHolder;\n\n    @Override\n    public Object execute(InvocationContext invocationContext) throws Exception\n    {\n        EntityManagerMetadata metadata = transactionHelper.createEntityManagerMetadata(invocationContext);\n        Transactional transactionalAnnotation = transactionHelper.extractTransactionalAnnotation(invocationContext);\n\n        Class targetClass = ProxyUtils.getUnproxiedClass(invocationContext.getTarget().getClass()); //see DELTASPIKE-517\n\n        // all the configured qualifier keys\n        Set<Class<? extends Annotation>> emQualifiers = emHolder.isSet() ?\n                new HashSet<Class<? extends Annotation>>(Arrays.asList(Default.class)) :\n                transactionHelper.resolveEntityManagerQualifiers(metadata, targetClass);\n\n        TransactionBeanStorage transactionBeanStorage = TransactionBeanStorage.getInstance();\n\n        boolean isOutermostInterceptor = transactionBeanStorage.isEmpty();\n        boolean startedTransaction = false;\n\n        if (isOutermostInterceptor)\n        {\n            // a new Context needs to get started\n            transactionBeanStorage.startTransactionScope();\n        }\n\n        // the 'layer' of the transactional invocation, aka the refCounter\n        @SuppressWarnings(\"UnusedDeclaration\")\n        int transactionLayer = transactionBeanStorage.incrementRefCounter();\n\n        Exception firstException = null;\n\n        try\n        {\n            for (Class<? extends Annotation> emQualifier : emQualifiers)\n            {\n                EntityManager entityManager = resolveEntityManagerForQualifier(emQualifier);\n                EntityManagerEntry entityManagerEntry = createEntityManagerEntry(entityManager, emQualifier);\n                transactionBeanStorage.storeUsedEntityManager(entityManagerEntry);\n\n                EntityTransaction transaction = getTransaction(entityManagerEntry);\n\n                if (!transaction.isActive())\n                {\n                    beforeBegin(invocationContext, entityManagerEntry, transaction);\n                    transaction.begin();\n                    startedTransaction = true;\n                }\n\n                //don't move it before EntityTransaction#begin() and invoke it in any case\n                beforeProceed(invocationContext, entityManagerEntry, transaction);\n            }\n\n            return invocationContext.proceed();\n        }\n        catch (Exception e)\n        {\n            firstException = e;\n\n            // we only cleanup and rollback all open transactions in the outermost interceptor!\n            // this way, we allow inner functions to catch and handle exceptions properly.\n            if (isOutermostInterceptor)\n            {\n                Set<EntityManagerEntry> entityManagerEntryList =\n                    transactionBeanStorage.getUsedEntityManagerEntries();\n\n                if (startedTransaction)\n                {\n                    // We only commit transactions we opened ourselfs.\n                    // If the transaction got opened outside of our interceptor chain\n                    // we must not handle it.\n                    // This e.g. happens if a Stateless EJB invokes a Transactional CDI bean\n                    // which uses the BeanManagedUserTransactionStrategy.\n\n                    rollbackAllTransactions(entityManagerEntryList);\n                }\n\n                // drop all EntityManagers from the request-context cache\n                transactionBeanStorage.cleanUsedEntityManagers();\n            }\n\n            // give any extensions a chance to supply a better error message\n            e = prepareException(e);\n\n            // rethrow the exception\n            throw e;\n        }\n        finally\n        {\n            // will get set if we got an Exception while committing\n            // in this case, we rollback all later transactions too.\n            boolean commitFailed = false;\n\n            // commit all open transactions in the outermost interceptor!\n            // For Resource-local this is a 'JTA for poor men' only, and will not guaranty\n            // commit stability over various databases!\n            // In case of JTA we will just commit the UserTransaction.\n            if (isOutermostInterceptor)\n            {\n                if (startedTransaction)\n                {\n                    // We only commit transactions we opened ourselfs.\n                    // If the transaction got opened outside of our interceptor chain\n                    // we must not handle it.\n                    // This e.g. happens if a Stateless EJB invokes a Transactional CDI bean\n                    // which uses the BeanManagedUserTransactionStrategy.\n\n                    if (firstException == null)\n                    {\n                        // only commit all transactions if we didn't rollback\n                        // them already\n                        Set<EntityManagerEntry> entityManagerEntryList =\n                            transactionBeanStorage.getUsedEntityManagerEntries();\n\n                        boolean rollbackOnly = metadata.isReadOnly() || isRollbackOnly(transactionalAnnotation);\n\n                        if (!rollbackOnly && entityManagerEntryList.size() > 1)\n                        {\n                            // but first try to flush all the transactions and write the updates to the database\n                            for (EntityManagerEntry currentEntityManagerEntry : entityManagerEntryList)\n                            {\n                                EntityTransaction transaction = getTransaction(currentEntityManagerEntry);\n                                if (transaction != null && transaction.isActive())\n                                {\n                                    try\n                                    {\n                                        if (!commitFailed)\n                                        {\n                                            currentEntityManagerEntry.getEntityManager().flush();\n\n                                            if (!rollbackOnly && transaction.getRollbackOnly())\n                                            {\n                                                // don't set commitFailed to true directly\n                                                // (the order of the entity-managers isn't deterministic\n                                                //  -> tests would break)\n                                                rollbackOnly = true;\n                                            }\n                                        }\n                                    }\n                                    catch (Exception e)\n                                    {\n                                        firstException = e;\n                                        commitFailed = true;\n                                        break;\n                                    }\n                                }\n                            }\n                        }\n                        if (rollbackOnly)\n                        {\n                            commitFailed = true;\n                        }\n\n                        // and now either commit or rollback all transactions\n                        for (EntityManagerEntry currentEntityManagerEntry : entityManagerEntryList)\n                        {\n                            EntityTransaction transaction = getTransaction(currentEntityManagerEntry);\n                            if (transaction != null && transaction.isActive())\n                            {\n                                try\n                                {\n                                    // last chance to check it (again)\n                                    if (commitFailed || transaction.getRollbackOnly())\n                                    {\n                                        beforeRollback(invocationContext, currentEntityManagerEntry, transaction);\n                                        transaction.rollback();\n                                    }\n                                    else\n                                    {\n                                        beforeCommit(invocationContext, currentEntityManagerEntry, transaction);\n                                        transaction.commit();\n                                    }\n                                }\n                                catch (Exception e)\n                                {\n                                    firstException = e;\n                                    commitFailed = true;\n                                }\n                                finally\n                                {\n                                    afterProceed(invocationContext,currentEntityManagerEntry, firstException);\n                                }\n                            }\n                        }\n                    }\n                }\n                // and now we close the open transaction scope\n                transactionBeanStorage.endTransactionScope();\n                onCloseTransactionScope();\n            }\n\n            transactionBeanStorage.decrementRefCounter();\n\n            if (commitFailed && firstException != null /*null if just #getRollbackOnly is true*/)\n            {\n                throwException(firstException);\n            }\n        }\n    }\n\n    protected void beforeBegin(InvocationContext invocationContext,\n                               EntityManagerEntry entityManagerEntry,\n                               EntityTransaction transaction)\n    {\n        //override if needed\n    }\n\n    protected void beforeProceed(InvocationContext invocationContext,\n                                 EntityManagerEntry entityManagerEntry,\n                                 EntityTransaction transaction)\n    {\n        //override if needed\n    }\n\n    protected void beforeCommit(InvocationContext invocationContext,\n                                EntityManagerEntry entityManagerEntry,\n                                EntityTransaction transaction)\n    {\n        //override if needed\n    }\n\n    protected void beforeRollback(InvocationContext invocationContext,\n                                  EntityManagerEntry entityManagerEntry,\n                                  EntityTransaction transaction)\n    {\n        //override if needed\n    }\n\n    /**\n     * @param invocationContext current invocation-context\n     * @param entityManagerEntry current entity-manager entry\n     * @param exception the exception which occurred or null if everything went fine\n     */\n    protected void afterProceed(InvocationContext invocationContext,\n                                EntityManagerEntry entityManagerEntry,\n                                Exception exception)\n    {\n        //override if needed\n    }\n\n    protected void throwException(Exception exception) throws Exception\n    {\n        //override if needed\n        throw exception;\n    }\n\n    //allows to use a custom tx-controller in a custom strategy\n    @Deprecated // instead, configure read only on the method/class\n    protected boolean isRollbackOnly(Transactional transactionalAnnotation)\n    {\n        return transactionalAnnotation != null && transactionalAnnotation.readOnly();\n    }\n\n    private void rollbackAllTransactions(Set<EntityManagerEntry> entityManagerEntryList)\n    {\n        for (EntityManagerEntry currentEntityManagerEntry : entityManagerEntryList)\n        {\n            EntityTransaction transaction = getTransaction(currentEntityManagerEntry);\n            if (transaction != null && transaction.isActive())\n            {\n                try\n                {\n                    transaction.rollback();\n                }\n                catch (Exception eRollback)\n                {\n                    if (LOGGER.isLoggable(Level.SEVERE))\n                    {\n                        LOGGER.log(Level.SEVERE,\n                                \"Got additional Exception while subsequently \" +\n                                \"rolling back other SQL transactions\", eRollback);\n                    }\n                }\n            }\n        }\n    }\n\n    protected EntityManagerEntry createEntityManagerEntry(\n        EntityManager entityManager, Class<? extends Annotation> qualifier)\n    {\n        return new EntityManagerEntry(entityManager, qualifier);\n    }\n\n    /**\n     *\n     * @param entityManagerEntry entry of the current entity-manager\n     * @return per default the {@link EntityTransaction} of the given {@link EntityManager}.\n     * A subclass can also return an adapter e.g. for an UserTransaction\n     */\n    protected EntityTransaction getTransaction(EntityManagerEntry entityManagerEntry)\n    {\n        return entityManagerEntry.getEntityManager().getTransaction();\n    }\n\n    private EntityManager resolveEntityManagerForQualifier(Class<? extends Annotation> emQualifier)\n    {\n        if (emHolder.isSet())\n        {\n            return emHolder.get();\n        }\n        return new QualifierBackedEntityManagerResolver(beanManager, emQualifier).resolveEntityManager();\n    }\n\n    /**\n     * This method might get overridden in subclasses to supply better error messages.\n     * This is useful if e.g. a JPA provider only provides a stubborn Exception for\n     * their ConstraintValidationExceptions.\n     * @return the wrapped or unwrapped Exception\n     */\n    protected Exception prepareException(Exception e)\n    {\n        return e;\n    }\n\n    protected void onCloseTransactionScope()\n    {\n        TransactionBeanStorage.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/TransactionStrategyHelper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport org.apache.deltaspike.core.util.AnnotationUtils;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerMetadata;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Any;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport jakarta.persistence.EntityManager;\nimport java.io.Serializable;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Helper which provides utility methods for any\n * {@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy}.\n */\n@Dependent\npublic class TransactionStrategyHelper implements Serializable\n{\n    private static final long serialVersionUID = -6272327391611428125L;\n\n    @Inject\n    private BeanManager beanManager;\n\n    /**\n     * <p>This method uses the InvocationContext to scan the &#064;Transactional\n     * interceptor for a manually specified Qualifier.</p>\n     *\n     * <p>If none is given (defaults to &#04;Any.class) then we scan the intercepted\n     * instance and resolve the Qualifiers of all it's injected EntityManagers.</p>\n     *\n     * <p>Please note that we will only pickup the first Qualifier on the\n     * injected EntityManager. We also do <b>not</b> parse for binding or\n     * &h#064;NonBinding values. A &#064;Qualifier should not have any parameter at all.</p>\n     * @param entityManagerMetadata the metadata to locate the entity manager\n     * @param interceptedTargetClass the Class of the intercepted target\n     */\n    public Set<Class<? extends Annotation>> resolveEntityManagerQualifiers(EntityManagerMetadata entityManagerMetadata,\n                                                                           Class interceptedTargetClass)\n    {\n        Set<Class<? extends Annotation>> emQualifiers = new HashSet<>();\n        Class<? extends Annotation>[] qualifierClasses = entityManagerMetadata.getQualifiers();\n\n        if (qualifierClasses == null || qualifierClasses.length == 1 && Any.class.equals(qualifierClasses[0]) )\n        {\n            // this means we have no special EntityManager configured in the interceptor\n            // thus we should scan all the EntityManagers ourselfs from the intercepted class\n            collectEntityManagerQualifiersOnClass(emQualifiers, interceptedTargetClass);\n        }\n        else\n        {\n            // take the qualifierKeys from the qualifierClasses\n            Collections.addAll(emQualifiers, qualifierClasses);\n        }\n\n        //see DELTASPIKE-320\n        if (emQualifiers.isEmpty())\n        {\n            emQualifiers.add(Default.class);\n        }\n        return emQualifiers;\n    }\n\n    /**\n     * Scan the given class and return all the injected EntityManager fields.\n     * <p>Attention: we do only pick up EntityManagers which use &#064;Inject!</p>\n     */\n    private void collectEntityManagerQualifiersOnClass(Set<Class<? extends Annotation>> emQualifiers,Class target)\n    {\n        // first scan all declared fields\n        Field[] fields = target.getDeclaredFields();\n\n        for (Field field : fields)\n        {\n            if (EntityManager.class.equals(field.getType()))\n            {\n                // also check if this is an injected EM\n                if (field.getAnnotation(Inject.class) != null)\n                {\n                    boolean qualifierFound = false;\n                    Class<? extends Annotation> qualifier = getFirstQualifierAnnotation(field.getAnnotations());\n                    if (qualifier != null)\n                    {\n                        emQualifiers.add(qualifier);\n                        qualifierFound = true;\n                    }\n\n                    if (!qualifierFound)\n                    {\n                        // according to the CDI injection rules @Default is assumed\n                        emQualifiers.add(Default.class);\n                    }\n                }\n            }\n        }\n\n        // finally recurse into the superclasses\n        Class superClass = target.getSuperclass();\n        if (!Object.class.equals(superClass))\n        {\n            collectEntityManagerQualifiersOnClass(emQualifiers, superClass);\n        }\n    }\n\n    /**\n     * Extract the first CDI-Qualifier Annotation from the given annotations array\n     */\n    private Class<? extends Annotation> getFirstQualifierAnnotation(Annotation[] annotations)\n    {\n        for (Annotation ann : annotations)\n        {\n            if (beanManager.isQualifier(ann.annotationType()))\n            {\n                return ann.annotationType();\n            }\n        }\n\n        return null;\n    }\n\n    EntityManagerMetadata createEntityManagerMetadata(InvocationContext context)\n    {\n        EntityManagerMetadata metadata = new EntityManagerMetadata();\n        metadata.readFrom(context.getMethod().getDeclaringClass(), beanManager);\n        metadata.readFrom(context.getMethod(), beanManager);\n        return metadata;\n    }\n\n    /**\n     * @return the &#064;Transactional annotation from either the method or class\n     *         or <code>null</code> if none present.\n     */\n    protected Transactional extractTransactionalAnnotation(InvocationContext context)\n    {\n        Class targetClass = context.getTarget() != null ? context.getTarget().getClass() :\n            context.getMethod().getDeclaringClass();\n        return AnnotationUtils\n            .extractAnnotationFromMethodOrClass(beanManager, context.getMethod(), targetClass, Transactional.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/TransactionalInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n/**\n * Interceptor for wrapping transactional database requests.\n * This interceptor itself doesn't contain any functionality.\n * Instead the 'real' work is done inside a pluggable\n * {@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy}.\n */\n@Interceptor\n@Transactional\n@Priority(1000)\npublic class TransactionalInterceptor implements Serializable\n{\n    private static final long serialVersionUID = 8787285444722371172L;\n\n    @Inject\n    private TransactionStrategy transactionStrategy;\n\n    /**\n     * Creates a transaction before the intercepted method gets called and commits or reverts it after the invocation.\n     * A {@link org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy}\n     * is allowed to begin the transaction lazily but it has to support nested interceptor calls.\n     *\n     * @param invocationContext current invocation-context\n     * @return result of the intercepted method\n     * @throws Exception exception which might be thrown by the intercepted method\n     */\n    @AroundInvoke\n    public Object executeInTransaction(InvocationContext invocationContext) throws Exception\n    {\n        return transactionStrategy.execute(invocationContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/UserTransactionResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\nimport org.apache.deltaspike.core.impl.util.JndiUtils;\nimport org.apache.deltaspike.jpa.api.config.base.JpaBaseConfig;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.transaction.UserTransaction;\nimport java.io.Serializable;\n\n//the separated logic allows a lazy lookup of this bean and\n//avoids that the injection of UserTransaction fails in an unmanaged thread (see DELTASPIKE-917).\n@Dependent\npublic class UserTransactionResolver implements Serializable\n{\n    private static final long serialVersionUID = -1432802805095533499L;\n\n    @Inject\n    private BeanManager beanManager;\n\n    public UserTransaction resolveUserTransaction()\n    {\n        UserTransaction userTransaction;\n\n        try\n        {\n            DependentProvider<ManagedUserTransactionResolver> provider =\n                BeanProvider.getDependent(this.beanManager, ManagedUserTransactionResolver.class);\n\n            userTransaction = provider.get().resolveUserTransaction();\n\n            provider.destroy();\n        }\n        catch (Throwable t)\n        {\n            //it was just a try\n            userTransaction = null;\n        }\n\n        if (userTransaction != null)\n        {\n            return userTransaction;\n        }\n\n        String jndiName = JpaBaseConfig.UserTransaction.JNDI_NAME;\n\n        String[] jndiNames = jndiName.split(\",\");\n\n        for (String currentJndiName : jndiNames)\n        {\n            try\n            {\n                userTransaction = JndiUtils.lookup(currentJndiName, UserTransaction.class);\n\n                if (userTransaction != null)\n                {\n                    break;\n                }\n            }\n            catch (Exception e)\n            {\n                userTransaction = null;\n            }\n        }\n\n        return userTransaction;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/context/EntityManagerEntry.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction.context;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.persistence.EntityManager;\nimport java.lang.annotation.Annotation;\n\n/**\n * Stores a {@link EntityManager} and the qualifier\n */\n@Vetoed\npublic class EntityManagerEntry\n{\n    private final EntityManager entityManager;\n    //TODO DELTASPIKE-259 - use the annotation itself + calculate a key for #hashCode and #equals\n    private Class<? extends Annotation> qualifier;\n\n    public EntityManagerEntry(EntityManager entityManager, Class<? extends Annotation> qualifier)\n    {\n        this.entityManager = entityManager;\n        this.qualifier = qualifier;\n    }\n\n    public EntityManager getEntityManager()\n    {\n        return entityManager;\n    }\n\n    //can be used e.g. by a custom strategy for logging,...\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public Class<? extends Annotation> getQualifier()\n    {\n        return qualifier;\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n\n        EntityManagerEntry that = (EntityManagerEntry) o;\n\n        if (!qualifier.equals(that.qualifier))\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return qualifier.hashCode();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/context/TransactionBeanEntry.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction.context;\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.Vetoed;\n\n/**\n * Holds the information we need store to manage\n * the beans in the {@link TransactionContext}.\n */\n@Vetoed\npublic class TransactionBeanEntry<T>\n{\n    private Contextual<T> bean;\n    private T contextualInstance;\n    private CreationalContext<T> creationalContext;\n\n    public TransactionBeanEntry(Contextual<T> bean, T contextualInstance, CreationalContext<T> creationalContext)\n    {\n        this.bean = bean;\n\n        this.contextualInstance = contextualInstance;\n        this.creationalContext = creationalContext;\n    }\n\n    public Contextual<T> getBean()\n    {\n        return bean;\n    }\n\n    public T getContextualInstance()\n    {\n        return contextualInstance;\n    }\n\n    public CreationalContext<T> getCreationalContext()\n    {\n        return creationalContext;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/context/TransactionBeanStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction.context;\n\nimport jakarta.enterprise.context.spi.Contextual;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.Stack;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * <p>This class stores information about\n * &#064;{@link org.apache.deltaspike.jpa.api.transaction.TransactionScoped}\n * contextual instances, their {@link jakarta.enterprise.context.spi.CreationalContext} etc.</p>\n *\n * <p>We use a RequestScoped bean because this way we don't need to take\n * care about cleaning up any ThreadLocals ourselves. This also makes sure that\n * we subsequently destroy any left over TransactionScoped beans (which should not happen,\n * but who knows). We also don't need to do any fancy synchronization stuff since\n * we are sure that we are always in the same Thread.</p>\n */\npublic class TransactionBeanStorage\n{\n    private static final Logger LOGGER = Logger.getLogger(TransactionBeanStorage.class.getName());\n\n    private static ThreadLocal<TransactionBeanStorage> transactionBeanStorage =\n        new ThreadLocal<TransactionBeanStorage>();\n\n    private static class TransactionContextInfo\n    {\n        /**\n         * This is the actual bean storage.\n         * The structure is:\n         * <ol>\n         *     <li>transactionKey identifies the 'database qualifier'</li>\n         *     <li>transactionKey -> Stack: we need the Stack because of REQUIRES_NEW, etc</li>\n         *     <li>top Element in the Stack -> Context beans for the transactionKey</li>\n         * </ol>\n         *\n         */\n        private Map<Contextual, TransactionBeanEntry> contextualInstances =\n                new HashMap<Contextual, TransactionBeanEntry>();\n\n        private Set<EntityManagerEntry> ems = new HashSet<EntityManagerEntry>();\n\n        /**\n         * counts the 'depth' of the interceptor invocation.\n         */\n        private AtomicInteger refCounter = new AtomicInteger(0);\n    }\n\n    /**\n     * If we hit a layer with REQUIRES_NEW, then create a new TransactionContextInfo\n     * and push the old one on top of this stack.\n     */\n    private Stack<TransactionContextInfo> oldTci = new Stack<TransactionContextInfo>();\n\n    /**\n     * The TransactionContextInfo which is on top of the stack.\n     */\n    private TransactionContextInfo currentTci = null;\n\n    private TransactionBeanStorage()\n    {\n    }\n\n    public static TransactionBeanStorage getInstance()\n    {\n        TransactionBeanStorage result = transactionBeanStorage.get();\n\n        if (result == null)\n        {\n            result = new TransactionBeanStorage();\n            transactionBeanStorage.set(result);\n        }\n\n        return result;\n    }\n\n    public static void close()\n    {\n        TransactionBeanStorage currentStorage = transactionBeanStorage.get();\n\n        if (currentStorage != null)\n        {\n            currentStorage.endAllTransactionScopes();\n            transactionBeanStorage.set(null);\n            transactionBeanStorage.remove();\n        }\n    }\n\n    public static boolean isOpen()\n    {\n        return transactionBeanStorage.get() != null;\n    }\n\n    /**\n     * Increment the ref counter and return the old value.\n     * Must only be called if the bean storage is not {@link #isEmpty()}.\n     *\n     * @return the the previous values of the refCounters. If 0 then we are 'outermost'\n     */\n    public int incrementRefCounter()\n    {\n        return currentTci.refCounter.incrementAndGet() - 1;\n    }\n\n    /**\n     * Decrement the reference counter and return the layer.\n     *\n     * @return the layer number. 0 represents the outermost interceptor for the qualifier\n     */\n    public int decrementRefCounter()\n    {\n        if (currentTci == null)\n        {\n            return 0;\n        }\n\n        return currentTci.refCounter.decrementAndGet();\n    }\n\n    /**\n     * @return <code>true</code> if we are the outermost interceptor over all qualifiers\n     *         and the TransactionBeanStorage is yet empty.\n     */\n    public boolean isEmpty()\n    {\n        return currentTci == null;\n    }\n\n    /**\n     * Start a new TransactionScope\n     */\n    public void startTransactionScope()\n    {\n        // first store away any previous TransactionContextInfo\n        if (currentTci != null)\n        {\n            oldTci.push(currentTci);\n        }\n        currentTci = new TransactionContextInfo();\n\n        if (LOGGER.isLoggable(Level.FINER))\n        {\n            LOGGER.finer( \"starting TransactionScope\");\n        }\n    }\n\n    /**\n     * End the TransactionScope with the given qualifier.\n     * This will subsequently destroy all beans which are stored\n     * in the context.\n     *\n     * This method only gets used if we leave a transaction with REQUIRES_NEW.\n     */\n    public void endTransactionScope()\n    {\n        if (LOGGER.isLoggable(Level.FINER))\n        {\n            LOGGER.finer(\"ending TransactionScope\");\n        }\n\n        destroyBeans(currentTci.contextualInstances);\n\n        if (!oldTci.isEmpty())\n        {\n            currentTci = oldTci.pop();\n            endTransactionScope();\n        }\n        else\n        {\n            currentTci = null;\n        }\n    }\n\n\n    public void storeUsedEntityManager(EntityManagerEntry entityManagerEntry)\n    {\n        currentTci.ems.add(entityManagerEntry);\n    }\n\n    public Set<EntityManagerEntry> getUsedEntityManagerEntries()\n    {\n        return currentTci.ems;\n    }\n\n    public void cleanUsedEntityManagers()\n    {\n        currentTci.ems.clear();\n    }\n\n    /**\n     * @return the Map which represents the currently active Context content.\n     */\n    public Map<Contextual, TransactionBeanEntry> getActiveTransactionContext()\n    {\n        if (currentTci == null)\n        {\n            return null;\n        }\n\n        return currentTci.contextualInstances;\n    }\n\n    private void endAllTransactionScopes()\n    {\n        while (!isEmpty())\n        {\n            endTransactionScope();\n        }\n    }\n\n    /**\n     * Properly destroy all the given beans.\n     * @param activeBeans to destroy\n     */\n    private void destroyBeans(Map<Contextual, TransactionBeanEntry> activeBeans)\n    {\n        for (TransactionBeanEntry beanEntry : activeBeans.values())\n        {\n            beanEntry.getBean().destroy(beanEntry.getContextualInstance(), beanEntry.getCreationalContext());\n        }\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/context/TransactionContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction.context;\n\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.context.spi.Context;\nimport jakarta.enterprise.context.spi.Contextual;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport java.lang.annotation.Annotation;\nimport java.util.Map;\n\n/**\n * CDI Context for managing &#064;{@link org.apache.deltaspike.jpa.api.transaction.TransactionScoped}\n * contextual instances.\n */\npublic class TransactionContext implements Context\n{\n    public <T> T get(Contextual<T> component)\n    {\n        Map<Contextual, TransactionBeanEntry> transactionBeanEntryMap =\n                TransactionBeanStorage.getInstance().getActiveTransactionContext();\n\n        if (transactionBeanEntryMap == null)\n        {\n            TransactionBeanStorage.close();\n\n            throw new ContextNotActiveException(\"Not accessed within a transactional method - use @\" +\n                    Transactional.class.getName());\n        }\n\n        TransactionBeanEntry transactionBeanEntry = transactionBeanEntryMap.get(component);\n        if (transactionBeanEntry != null)\n        {\n            return (T) transactionBeanEntry.getContextualInstance();\n        }\n\n        return null;\n    }\n\n    public <T> T get(Contextual<T> component, CreationalContext<T> creationalContext)\n    {\n        Map<Contextual, TransactionBeanEntry> transactionBeanEntryMap =\n            TransactionBeanStorage.getInstance().getActiveTransactionContext();\n\n        if (transactionBeanEntryMap == null)\n        {\n            TransactionBeanStorage.close();\n\n            throw new ContextNotActiveException(\"Not accessed within a transactional method - use @\" +\n                    Transactional.class.getName());\n        }\n\n        TransactionBeanEntry transactionBeanEntry = transactionBeanEntryMap.get(component);\n        if (transactionBeanEntry != null)\n        {\n            return (T) transactionBeanEntry.getContextualInstance();\n        }\n\n        // if it doesn't yet exist, we need to create it now!\n        T instance = component.create(creationalContext);\n        transactionBeanEntry = new TransactionBeanEntry(component, instance, creationalContext);\n        transactionBeanEntryMap.put(component, transactionBeanEntry);\n\n        return instance;\n    }\n\n    public Class<? extends Annotation> getScope()\n    {\n        return TransactionScoped.class;\n    }\n\n    public boolean isActive()\n    {\n        try\n        {\n            return TransactionBeanStorage.isOpen() &&\n                   TransactionBeanStorage.getInstance().getActiveTransactionContext() != null;\n        }\n        catch (ContextNotActiveException e)\n        {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/context/TransactionContextExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jpa.impl.transaction.context;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\n\n/**\n * CDI Extension which registers and manages the {@link TransactionContext}.\n */\npublic class TransactionContextExtension implements Extension, Deactivatable\n{\n    private Boolean isActivated = true;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    /**\n     * Register the TransactionContext as a CDI Context\n     *\n     * @param afterBeanDiscovery after-bean-discovery event\n     */\n    protected void registerTransactionContext(@Observes AfterBeanDiscovery afterBeanDiscovery)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        TransactionContext transactionContext = new TransactionContext();\n        afterBeanDiscovery.addContext(transactionContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\ndeltaspike_ordinal=50\ndeltaspike.jpa.user-transaction.jndi-name=java:comp/UserTransaction,java:/jboss/UserTransaction\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension\norg.apache.deltaspike.jpa.impl.descriptor.xml.PersistenceUnitDescriptorInitExtension\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/entitymanager/EntityManagerFactoryProducerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.entitymanager;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.spi.PersistenceProviderResolverHolder;\n\nimport org.apache.deltaspike.jpa.spi.entitymanager.PersistenceConfigurationProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\n\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class EntityManagerFactoryProducerTest\n{\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        // set the dummy PersistenceProviderResolver which creates our DummyEntityManagerFactory\n        PersistenceProviderResolverHolder.setPersistenceProviderResolver(new TestPersistenceProviderResolver());\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"unitDefinitionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(EntityManagerFactoryProducerTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\")\n                .addAsResource(new StringAsset(TestPersistenceProviderResolver.class.getName()),\n                        \"META-INF/services/jakarta.persistence.spi.PersistenceProviderResolver\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n\n    @Inject\n    @SampleDb\n    private EntityManager entityManager;\n\n    private @Inject PersistenceConfigurationProvider persistenceConfigurationProvider;\n\n    @Test\n    public void testUnitDefinitionQualifier() throws Exception\n    {\n        Assert.assertNotNull(entityManager);\n        Assert.assertNotNull(entityManager.getDelegate());\n\n        Assert.assertTrue(entityManager.getDelegate() instanceof TestEntityManager);\n        TestEntityManager tem = (TestEntityManager) entityManager.getDelegate();\n        Assert.assertEquals(\"testPersistenceUnit\", tem.getUnitName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/entitymanager/PersistenceConfigurationProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.entitymanager;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.spi.PersistenceProviderResolverHolder;\nimport java.util.Properties;\n\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.jpa.spi.entitymanager.PersistenceConfigurationProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class PersistenceConfigurationProviderTest\n{\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        // set the dummy PersistenceProviderResolver which creates our DummyEntityManagerFactory\n        PersistenceProviderResolverHolder.setPersistenceProviderResolver(new TestPersistenceProviderResolver());\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"unitDefinitionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addClass(PersistenceConfigurationProviderTest.class)\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n\n    private @Inject PersistenceConfigurationProvider persistenceConfigurationProvider;\n\n\n    @Test\n    public void testPersistenceConfigurationProvider()\n    {\n        Properties myUnitConfig = persistenceConfigurationProvider.getEntityManagerFactoryConfiguration(\"MyUnit\");\n        Assert.assertEquals(4, myUnitConfig.size());\n        Assert.assertEquals(BeanManagerProvider.getInstance().getBeanManager(), myUnitConfig.get(\"jakarta.persistence.bean.manager\"));\n        Assert.assertEquals(\"blub\", myUnitConfig.get(\"jakarta.persistence.jdbc.password\"));\n        Assert.assertEquals(\"sa\", myUnitConfig.get(\"jakarta.persistence.jdbc.user\"));\n        Assert.assertEquals(\"some.jdbc.Driver\", myUnitConfig.get(\"jakarta.persistence.jdbc.driver\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/entitymanager/SampleDb.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.entitymanager;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n\n/**\n * Sample Database Qualifier\n */\n@Target( { TYPE, METHOD, PARAMETER, FIELD })\n@Retention(value= RUNTIME)\n@Qualifier\npublic @interface SampleDb\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/entitymanager/SampleEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.entitymanager;\n\nimport org.apache.deltaspike.jpa.api.entitymanager.PersistenceUnitName;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManagerFactory;\n\n/**\n * Sample producer for a &#064;SampleDb EntityManager.\n */\n@ApplicationScoped\n@SuppressWarnings(\"unused\")\npublic class SampleEntityManagerProducer\n{\n    @Inject\n    @PersistenceUnitName(\"testPersistenceUnit\")\n    private EntityManagerFactory emf;\n\n    @Produces\n    @RequestScoped\n    @SampleDb\n    public TestEntityManager /*needed by weld - see DS-315*/ createEntityManager()\n    {\n        return (TestEntityManager)emf.createEntityManager();\n    }\n\n    public void closeEm(@Disposes @SampleDb TestEntityManager em)\n    {\n        em.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/entitymanager/TestPersistenceProviderResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.entitymanager;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.persistence.Cache;\nimport jakarta.persistence.EntityGraph;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.PersistenceUnitUtil;\nimport jakarta.persistence.Query;\nimport jakarta.persistence.SynchronizationType;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.metamodel.Metamodel;\nimport jakarta.persistence.spi.PersistenceProvider;\nimport jakarta.persistence.spi.PersistenceProviderResolver;\nimport jakarta.persistence.spi.PersistenceUnitInfo;\nimport jakarta.persistence.spi.ProviderUtil;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\n/**\n * PersistenceProviderResolver for dummy PersistenceProviders.\n */\n@Vetoed\npublic class TestPersistenceProviderResolver implements PersistenceProviderResolver\n{\n    private List<PersistenceProvider> persistenceProviders;\n\n    public TestPersistenceProviderResolver()\n    {\n        this.persistenceProviders = new ArrayList<PersistenceProvider>();\n        this.persistenceProviders.add(new DummyPersistenceProvider());\n    }\n\n    @Override\n    public void clearCachedProviders()\n    {\n    }\n\n    @Override\n    public List<PersistenceProvider> getPersistenceProviders()\n    {\n        return persistenceProviders;\n    }\n\n\n    @Vetoed\n    public static class DummyPersistenceProvider implements PersistenceProvider\n    {\n        @Override\n        public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map)\n        {\n            return new DummyEntityManagerFactory();\n        }\n\n        @Override\n        public EntityManagerFactory createEntityManagerFactory(String emName, Map map)\n        {\n            return new DummyEntityManagerFactory(emName, map);\n        }\n\n        @Override\n        public ProviderUtil getProviderUtil()\n        {\n            return null;  \n        }\n\n        @Override\n        public void generateSchema(PersistenceUnitInfo arg0, Map arg1)\n        {\n            \n        }\n\n        @Override\n        public boolean generateSchema(String arg0, Map arg1)\n        {\n            return true;\n        }\n    }\n\n    @Vetoed\n    public static class DummyEntityManagerFactory implements EntityManagerFactory\n    {\n        private final String emName;\n        private final Map map;\n\n        public DummyEntityManagerFactory()\n        {\n            this.emName = null;\n            this.map = null;\n\n        }\n\n        public DummyEntityManagerFactory(String emName, Map map)\n        {\n            this.emName = emName;\n            this.map = map;\n        }\n\n\n        @Override\n        public void close()\n        {\n        }\n\n        @Override\n        public EntityManager createEntityManager()\n        {\n            return new TestEntityManager(emName);\n        }\n\n        @Override\n        public EntityManager createEntityManager(Map map)\n        {\n            return new TestEntityManager(emName);\n        }\n\n        @Override\n        public CriteriaBuilder getCriteriaBuilder()\n        {\n            return null;  \n        }\n\n        @Override\n        public Metamodel getMetamodel()\n        {\n            return null;  \n        }\n\n        @Override\n        public boolean isOpen()\n        {\n            return false;  \n        }\n\n        @Override\n        public Map<String, Object> getProperties()\n        {\n            return map;\n        }\n\n        @Override\n        public Cache getCache()\n        {\n            return null;  \n        }\n\n        @Override\n        public PersistenceUnitUtil getPersistenceUnitUtil()\n        {\n            return null;  \n        }\n\n        @Override\n        public EntityManager createEntityManager(SynchronizationType arg0)\n        {\n            return null;\n        }\n\n        @Override\n        public EntityManager createEntityManager(SynchronizationType arg0, Map arg1)\n        {\n            return null;\n        }\n\n        @Override\n        public void addNamedQuery(String arg0, Query arg1)\n        {\n            \n        }\n\n        @Override\n        public <T> T unwrap(Class<T> arg0)\n        {\n            return null;\n        }\n\n        @Override\n        public <T> void addNamedEntityGraph(String arg0, EntityGraph<T> arg1)\n        {\n            \n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/shared/First.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.shared;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ FIELD, METHOD, PARAMETER })\n@Retention(RUNTIME)\n@Documented\n\n//cdi annotations\n@Qualifier\npublic @interface First\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/shared/Second.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.shared;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ FIELD, METHOD, PARAMETER })\n@Retention(RUNTIME)\n@Documented\n\n//cdi annotations\n@Qualifier\npublic @interface Second\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/shared/TestEntityManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.shared;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.persistence.EntityGraph;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityManagerFactory;\nimport jakarta.persistence.EntityTransaction;\nimport jakarta.persistence.FlushModeType;\nimport jakarta.persistence.LockModeType;\nimport jakarta.persistence.Query;\nimport jakarta.persistence.StoredProcedureQuery;\nimport jakarta.persistence.TypedQuery;\nimport jakarta.persistence.criteria.CriteriaBuilder;\nimport jakarta.persistence.criteria.CriteriaDelete;\nimport jakarta.persistence.criteria.CriteriaQuery;\nimport jakarta.persistence.criteria.CriteriaUpdate;\nimport jakarta.persistence.metamodel.Metamodel;\nimport java.util.List;\nimport java.util.Map;\n\n@Vetoed\npublic class TestEntityManager implements EntityManager\n{\n    private EntityTransaction entityTransaction = new TestEntityTransaction(this);\n\n    private boolean open = true;\n    private boolean flushed = false;\n    private String unitName = null;\n\n    public TestEntityManager()\n    {\n    }\n\n    public TestEntityManager(String name)\n    {\n        this.unitName = name;\n    }\n\n    public String getUnitName()\n    {\n        return unitName;\n    }\n\n    @Override\n    public void persist(Object entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> T merge(T entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void remove(Object entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, Map<String, Object> properties)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode, Map<String, Object> properties)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> T getReference(Class<T> entityClass, Object primaryKey)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void flush()\n    {\n        flushed = true;\n    }\n\n    @Override\n    public void setFlushMode(FlushModeType flushMode)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public FlushModeType getFlushMode()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode, Map<String, Object> properties)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void refresh(Object entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void refresh(Object entity, Map<String, Object> properties)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void refresh(Object entity, LockModeType lockMode)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void clear()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void detach(Object entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public boolean contains(Object entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public LockModeType getLockMode(Object entity)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void setProperty(String propertyName, Object value)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Map<String, Object> getProperties()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Query createQuery(String qlString)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Query createNamedQuery(String name)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString, Class resultClass)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString, String resultSetMapping)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public void joinTransaction()\n    {\n        // all fine, nothing to do\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Object getDelegate()\n    {\n        return this;\n    }\n\n    @Override\n    public void close()\n    {\n        if (!open)\n        {\n            throw new IllegalStateException(\"entity manager is closed already\");\n        }\n        open = false;\n    }\n\n    @Override\n    public boolean isOpen()\n    {\n        return open;\n    }\n\n    @Override\n    public EntityTransaction getTransaction()\n    {\n        return entityTransaction;\n    }\n\n    @Override\n    public EntityManagerFactory getEntityManagerFactory()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public CriteriaBuilder getCriteriaBuilder()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Metamodel getMetamodel()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    public boolean isFlushed()\n    {\n        return flushed;\n    }\n\n    public void setFlushed(boolean flushed) {\n        this.flushed = flushed;\n    }\n\n    @Override\n    public Query createQuery(CriteriaUpdate arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public Query createQuery(CriteriaDelete arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public StoredProcedureQuery createNamedStoredProcedureQuery(String arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String arg0, Class... arg1)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String arg0, String... arg1)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public boolean isJoinedToTransaction()\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> EntityGraph<T> createEntityGraph(Class<T> arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public EntityGraph<?> createEntityGraph(String arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public EntityGraph<?> getEntityGraph(String arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n\n    @Override\n    public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> arg0)\n    {\n        throw new IllegalStateException(\"not implemented\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/shared/TestEntityTransaction.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.shared;\n\nimport jakarta.persistence.EntityTransaction;\n\npublic class TestEntityTransaction implements EntityTransaction\n{\n    private boolean started = false;\n    private boolean committed = false;\n    private boolean rolledBack = false;\n    private boolean markRolledBack = false;\n    private TestEntityManager testEntityManager;\n\n    public TestEntityTransaction(TestEntityManager testEntityManager)\n    {\n        this.testEntityManager = testEntityManager;\n    }\n\n    @Override\n    public void begin()\n    {\n        if (started)\n        {\n            throw new IllegalStateException(\"transaction started already\");\n        }\n\n        started = true;\n    }\n\n    @Override\n    public void commit()\n    {\n        committed = true;\n        testEntityManager.setFlushed(true);\n    }\n\n    @Override\n    public void rollback()\n    {\n        rolledBack = true;\n    }\n\n    @Override\n    public void setRollbackOnly()\n    {\n        this.markRolledBack = true;\n    }\n\n    @Override\n    public boolean getRollbackOnly()\n    {\n        return this.markRolledBack;\n    }\n\n    @Override\n    public boolean isActive()\n    {\n        return started && !(committed || rolledBack);\n    }\n\n    public boolean isStarted()\n    {\n        return started;\n    }\n\n    public boolean isCommitted()\n    {\n        return committed;\n    }\n\n    public boolean isRolledBack()\n    {\n        return rolledBack;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/shared/TestException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.shared;\n\npublic class TestException extends RuntimeException\n{\n    private static final long serialVersionUID = -3719932856173828526L;\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/aggregation/AggregatedDefaultEntityManagerInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.aggregation;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class AggregatedDefaultEntityManagerInjectionTest\n{\n    @Inject\n    private TransactionalBean transactionalBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"aggregatedDefaultInjectionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(AggregatedDefaultEntityManagerInjectionTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void defaultEntityManagerInjection()\n    {\n        EntityManager injectedEntityManager = entityManagerProducer.getDefaultEntityManager();\n\n        Assert.assertNotNull(injectedEntityManager);\n        Assert.assertTrue(injectedEntityManager instanceof TestEntityManager);\n        TestEntityTransaction testTransaction = (TestEntityTransaction) (injectedEntityManager).getTransaction();\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(false, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        transactionalBean.executeInTransaction();\n\n        Assert.assertEquals(true, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/aggregation/BeanA.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.aggregation;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class BeanA\n{\n    @Inject\n    private EntityManager entityManager;\n\n    public void doA()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/aggregation/BeanB.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.aggregation;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class BeanB\n{\n    @Inject\n    private EntityManager entityManager;\n\n    public void doB()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/aggregation/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.aggregation;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/aggregation/TransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.aggregation;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class TransactionalBean\n{\n    @Inject\n    private BeanA beanA;\n\n    @Inject\n    private BeanB beanB;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        beanA.doA();\n        beanB.doB();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultinjection/DefaultEntityManagerInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultinjection;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class DefaultEntityManagerInjectionTest\n{\n    @Inject\n    private TransactionalBean transactionalBean;\n\n    @Inject\n    @Failed\n    private TransactionalBean failedTransactionalBean;\n\n    @Inject\n    private FailedFlushTransactionalBean failedFlushTransactionalBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"defaultInjectionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(DefaultEntityManagerInjectionTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void defaultEntityManagerInjection()\n    {\n        EntityManager injectedEntityManager = entityManagerProducer.getDefaultEntityManager();\n\n        Assert.assertNotNull(injectedEntityManager);\n        Assert.assertTrue(injectedEntityManager instanceof TestEntityManager);\n        TestEntityTransaction testTransaction = (TestEntityTransaction) (injectedEntityManager).getTransaction();\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(false, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        transactionalBean.executeInTransaction();\n\n        Assert.assertEquals(true, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n\n    @Test\n    public void defaultEntityManagerInjectionFailedTransaction()\n    {\n        EntityManager injectedEntityManager = entityManagerProducer.getDefaultEntityManager();\n\n        Assert.assertNotNull(injectedEntityManager);\n        Assert.assertTrue(injectedEntityManager instanceof TestEntityManager);\n        TestEntityTransaction testTransaction = (TestEntityTransaction) (injectedEntityManager).getTransaction();\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(false, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        try\n        {\n            failedTransactionalBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected\n        }\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(true, testTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n\n    @Test\n    public void defaultEntityManagerInjectionFailedFlush()\n    {\n        EntityManager injectedEntityManager = entityManagerProducer.getFailedFlushEntityManager();\n\n        Assert.assertNotNull(injectedEntityManager);\n        Assert.assertTrue(injectedEntityManager instanceof TestEntityManager);\n        TestEntityTransaction testTransaction = (TestEntityTransaction) (injectedEntityManager).getTransaction();\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(false, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        try\n        {\n            failedFlushTransactionalBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected\n        }\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(true, testTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultinjection/Failed.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultinjection;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ FIELD, METHOD, TYPE })\n@Retention(RUNTIME)\n@Documented\n\n//cdi annotations\n@Qualifier\npublic @interface Failed\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultinjection/FailedFlushTransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultinjection;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FailedFlushTransactionalBean\n{\n    @Inject\n    @Failed\n    private EntityManager entityManager;\n\n    @Inject\n    private EntityManager validEntityManager; //just needed, because we only flush in case of multiple entity-managers\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultinjection/FailedTransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultinjection;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@Failed\n@ApplicationScoped\npublic class FailedTransactionalBean extends TransactionalBean\n{\n    @Override\n    @Transactional\n    public void executeInTransaction()\n    {\n        throw new TestException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultinjection/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultinjection;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n    private TestEntityManager failedFlushEntityManager = new TestEntityManager() {\n        @Override\n        public void flush()\n        {\n            throw new TestException();\n        }\n    };\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @Failed\n    protected EntityManager failedFlushEntityManager()\n    {\n        return failedFlushEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFailedFlushEntityManager()\n    {\n        return failedFlushEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultinjection/TransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultinjection;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\n@Transactional(readOnly = true)\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultnested/DefaultNestedTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultnested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class DefaultNestedTransactionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"defaultNestedTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(DefaultNestedTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void defaultNestedTransaction()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultnested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultnested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultnested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultnested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/defaultnested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.defaultnested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    @Produces\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/multipleinjection/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        try\n        {\n            nestedTransactionBean.executeInTransaction();\n        }\n        catch (TestException e)\n        {\n            //expected -> do nothing\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/multipleinjection/nested/NestedMultiTransactionCatchedExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.multipleinjection.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedMultiTransactionCatchedExceptionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionCatchedExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedMultiTransactionCatchedExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionCatchedExceptionTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/multipleinjection/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        throw new TestException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/multipleinjection/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.multipleinjection.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        try\n        {\n            nestedTransactionBean.executeInTransaction();\n        }\n        catch (TestException e)\n        {\n            //catch to test that the transaction doesn't get rolled back\n            //do nothing\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        throw new TestException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/nested/NestedTransactionCatchedExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedTransactionCatchedExceptionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedTransactionCatchedExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedTransactionCatchedExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedTransactionCatchedExceptionTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/catched/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.catched.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/auto/MultiTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        throw new TestException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/auto/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.auto;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/auto/UncatchedExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class UncatchedExceptionTest\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoInjectionUncatchedExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(UncatchedExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoInjectionUncatchedExceptionTest()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        try\n        {\n            multiTransactionBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected -> do nothing\n        }\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(true, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/auto/MultiTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/auto/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.auto;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager() {\n        @Override\n        public void flush()\n        {\n            throw new TestException();\n        }\n    };\n\n    private TestEntityManager firstEntityManager = new TestEntityManager() {\n        @Override\n        public void flush()\n        {\n            throw new TestException();\n        }\n    };\n\n    private TestEntityManager secondEntityManager = new TestEntityManager() {\n        @Override\n        public void flush()\n        {\n            throw new TestException();\n        }\n    };\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/auto/UncatchedFlushExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class UncatchedFlushExceptionTest\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoInjectionUncatchedFlushExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(UncatchedFlushExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoInjectionUncatchedFlushExceptionTest()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        try\n        {\n            multiTransactionBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected -> do nothing\n        }\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(true, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager() {\n        @Override\n        public void flush()\n        {\n            throw new TestException();\n        }\n    };\n\n    private TestEntityManager secondEntityManager = new TestEntityManager() {\n        @Override\n        public void flush()\n        {\n            throw new TestException();\n        }\n    };\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/flush/nested/UncatchedFlushExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.flush.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class UncatchedFlushExceptionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionUncatchedFlushExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(UncatchedFlushExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionUncatchedFlushExceptionTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        try\n        {\n            firstLevelTransactionBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected -> do nothing\n        }\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        throw new TestException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/multipleinjection/nested/UncatchedExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.multipleinjection.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class UncatchedExceptionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionUncatchedExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(UncatchedExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionUncatchedExceptionTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        try\n        {\n            firstLevelTransactionBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected -> do nothing\n        }\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        throw new TestException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/nested/NestedTransactionWithExceptionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.jpa.api.shared.TestException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedTransactionWithExceptionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedTransactionWithExceptionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedTransactionWithExceptionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedTransactionWithExceptionTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        try\n        {\n            firstLevelTransactionBean.executeInTransaction();\n            Assert.fail(TestException.class.getName() + \" expected!\");\n        }\n        catch (TestException e)\n        {\n            //expected\n        }\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/exception/uncatched/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.exception.uncatched.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/auto/MultiTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransactionRollbackDefault()\n    {\n        this.defaultEntityManager.getTransaction().setRollbackOnly();\n    }\n\n    @Transactional\n    public void executeInTransactionRollback1()\n    {\n        this.firstEntityManager.getTransaction().setRollbackOnly();\n    }\n\n    @Transactional\n    public void executeInTransactionRollback2()\n    {\n        this.secondEntityManager.getTransaction().setRollbackOnly();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/auto/RollbackOnly1Test.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n//different classes needed due to arquillian restriction\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class RollbackOnly1Test\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoInjectionRollbackOnly1Test.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(RollbackOnly1Test.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoInjectionRollbackOnly1Test()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        multiTransactionBean.executeInTransactionRollback1();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(true, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/auto/RollbackOnly2Test.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n//different classes needed due to arquillian restriction\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class RollbackOnly2Test\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoInjectionRollbackOnly2Test.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(RollbackOnly2Test.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoInjectionRollbackOnly2Test()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        multiTransactionBean.executeInTransactionRollback2();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(true, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/auto/RollbackOnlyTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n//different classes needed due to arquillian restriction\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class RollbackOnlyTest\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoInjectionRollbackOnlyTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(RollbackOnlyTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoInjectionRollbackOnlyDefaultTest()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        multiTransactionBean.executeInTransactionRollbackDefault();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(true, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/auto/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.auto;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/nested/NestedMultiTransactionRollbackOnlyTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedMultiTransactionRollbackOnlyTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionRollbackOnlyTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedMultiTransactionRollbackOnlyTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionRollbackOnlyTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        secondEntityManager.getTransaction().setRollbackOnly();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/getRollbackOnly/multipleinjection/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.getRollbackOnly.multipleinjection.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/auto/MultiTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/auto/MultipleEntityManagerInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class MultipleEntityManagerInjectionTest\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoInjectionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(MultipleEntityManagerInjectionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoEntityManagerInjection()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        multiTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(true, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/auto/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.auto;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/manual/BeanManagedlTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.manual;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n\n/**\n * Same test as {@link ManualTransactionTest} but now with a UserTransaction instead\n * of manual EM Tx.\n */\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class BeanManagedlTransactionTest\n{\n    private static Asset beansXml = new StringAsset(\n            \"<beans>\" +\n            \"<alternatives>\" +\n            \"<class>org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy</class>\" +\n            \"</alternatives>\" +\n            \"</beans>\"\n    );\n\n\n    @Inject\n    private ManualTransactionBean manualTransactionBean;\n\n    @Inject\n    private MockUserTransactionResolver mockTxResolver;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"manualTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(BeanManagedlTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(beansXml, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void manualTransactionTest()\n    {\n\n        mockTxResolver.resetTx();\n        MockUserTransactionResolver.MockUserTransaction mockTx = mockTxResolver.resolveUserTransaction();\n        manualTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(false, mockTx.isActive());\n        Assert.assertEquals(true, mockTx.isBegin());\n        Assert.assertEquals(true, mockTx.isCommit());\n        Assert.assertEquals(false, mockTx.isRollback());\n        Assert.assertEquals(false, mockTx.isRollBackOnly());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/manual/ManualTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.manual;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class ManualTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional(qualifier = Default.class)\n    public void executeInDefaultTransaction()\n    {\n    }\n\n    @Transactional(qualifier = First.class)\n    public void executeInFirstTransaction()\n    {\n    }\n\n    @Transactional(qualifier = Second.class)\n    public void executeInSecondTransaction()\n    {\n    }\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/manual/ManualTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.manual;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ManualTransactionTest\n{\n    @Inject\n    private ManualTransactionBean manualTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"manualTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(ManualTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void manualTransactionTest()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        manualTransactionBean.executeInDefaultTransaction();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(true, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        manualTransactionBean.executeInFirstTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        manualTransactionBean.executeInSecondTransaction();\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/manual/MockUserTransactionResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.manual;\n\nimport org.apache.deltaspike.jpa.impl.transaction.ManagedUserTransactionResolver;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.transaction.HeuristicMixedException;\nimport jakarta.transaction.HeuristicRollbackException;\nimport jakarta.transaction.NotSupportedException;\nimport jakarta.transaction.RollbackException;\nimport jakarta.transaction.Status;\nimport jakarta.transaction.SystemException;\nimport jakarta.transaction.UserTransaction;\n\n@Specializes\n@ApplicationScoped\npublic class MockUserTransactionResolver extends ManagedUserTransactionResolver {\n\n    private MockUserTransaction mockTx;\n\n    @PostConstruct\n    public void resetTx() {\n        mockTx = new MockUserTransaction();\n    }\n\n    @Override\n    public MockUserTransaction resolveUserTransaction() {\n        return mockTx;\n    }\n\n    public static class MockUserTransaction implements UserTransaction {\n        private boolean begin = false;\n        private boolean commit = false;\n        private boolean rollback = false;\n        private boolean rollBackOnly =false;\n\n        private int status = Status.STATUS_NO_TRANSACTION;\n\n\n        @Override\n        public void begin() throws NotSupportedException, SystemException {\n            this.begin = true;\n            this.status = Status.STATUS_ACTIVE;\n        }\n\n        @Override\n        public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {\n            this.commit = true;\n            this.status = Status.STATUS_COMMITTED;\n        }\n\n        @Override\n        public int getStatus() throws SystemException {\n            return status;\n        }\n\n        @Override\n        public void rollback() throws IllegalStateException, SecurityException, SystemException {\n            this.rollback = true;\n            this.status = Status.STATUS_ROLLEDBACK;\n        }\n\n        @Override\n        public void setRollbackOnly() throws IllegalStateException, SystemException {\n            this.rollBackOnly = true;\n            this.status = Status.STATUS_MARKED_ROLLBACK;\n        }\n\n        @Override\n        public void setTransactionTimeout(int i) throws SystemException {\n            // do nothing\n        }\n\n        public boolean isActive()\n        {\n            return begin && !(commit || rollback);\n        }\n\n        public boolean isBegin() {\n            return begin;\n        }\n\n        public boolean isCommit() {\n            return commit;\n        }\n\n        public boolean isRollback() {\n            return rollback;\n        }\n\n        public boolean isRollBackOnly() {\n            return rollBackOnly;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/manual/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.manual;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @RequestScoped\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @RequestScoped\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @RequestScoped\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/nested/NestedMultiTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedMultiTransactionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedMultiTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/multipleinjection/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.multipleinjection.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/nested/NestedTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedTransactionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedTransaction.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedTransaction()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.nested;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/noentitymanager/NoEntityManagerProducerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.noentitymanager;\n\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\n\nimport jakarta.inject.Inject;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NoEntityManagerProducerTest\n{\n\n    @Inject\n    private TransactionalBean transactionalBean;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"noEntityManagerProducer.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NoEntityManagerProducerTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void shouldFailIfNoEntityManager()\n    {\n        try\n        {\n            transactionalBean.executeInTransaction();\n            fail(\"This should fail as there is no EntityManager\");\n        }\n        catch (Exception e)\n        {\n            /*\n             * The exception should tell the user that there is no EntityManager with the requested qualifier. The\n             * following asserts just check for the important keywords in the message of the exception. Not a very nice\n             * way to test this behavior but it will be sufficient to ensure the user gets all the information required\n             * to fix the problem.\n             */\n            assertTrue(\"Expected \"+e.getMessage()+\" to contain EntityManager\",e.getMessage().contains(\"EntityManager\"));\n            assertTrue(\"Expected \"+e.getMessage()+\" to contain Second\",e.getMessage().contains(Second.class.getName()));\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/noentitymanager/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.noentitymanager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n\n    private TestEntityManager entityManager = new TestEntityManager();\n\n    /**\n     * Producer method for an {@link EntityManager} qualified with {@link First}.\n     */\n    @Produces\n    @First\n    protected EntityManager entityManager()\n    {\n        return entityManager;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/noentitymanager/TransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.noentitymanager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.persistence.EntityManager;\n\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerConfig;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\n@ApplicationScoped\npublic class TransactionalBean\n{\n\n    /**\n     * This methods requests a transaction for the EntityManager qualified with {@link Second} although there is no\n     * producer for such an {@link EntityManager}.\n     */\n    @Transactional\n    @EntityManagerConfig(qualifier = Second.class)\n    public void executeInTransaction()\n    {\n        // no need to do anything\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/auto/MultiTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional(readOnly = true)\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/auto/MultipleEntityManagerInjectionReadOnlyTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n//different classes needed due to arquillian restriction\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class MultipleEntityManagerInjectionReadOnlyTest\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"multipleEntityManagerInjectionReadOnlyTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(MultipleEntityManagerInjectionReadOnlyTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoInjectionReadOnlyTest()\n    {\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(defaultEntityManager);\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(false, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        multiTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(false, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(false, defaultTransaction.isCommitted());\n        Assert.assertEquals(true, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/auto/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.auto;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager = new TestEntityManager();\n\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    protected EntityManager defaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/norollback/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.norollback;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/norollback/NestedMultiTransactionReadOnlyNoRollbackTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.norollback;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedMultiTransactionReadOnlyNoRollbackTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionReadOnlyNoRollbackTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedMultiTransactionReadOnlyNoRollbackTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionReadOnlyNoRollbackTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/norollback/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.norollback;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional(readOnly = true)\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/norollback/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.norollback;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/rollback/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.rollback;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional(readOnly = true)\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/rollback/NestedMultiTransactionReadOnlyRollbackTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.rollback;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedMultiTransactionReadOnlyRollbackTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionReadOnlyRollbackTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedMultiTransactionReadOnlyRollbackTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionReadOnlyRollbackTest()\n    {\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(false, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(false, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        firstLevelTransactionBean.executeInTransaction();\n\n        Assert.assertEquals(false, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(false, firstTransaction.isCommitted());\n        Assert.assertEquals(true, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(false, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(false, secondTransaction.isCommitted());\n        Assert.assertEquals(true, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/rollback/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.rollback;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/readonly/nested/rollback/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.readonly.nested.rollback;\n\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager = new TestEntityManager();\n\n    private TestEntityManager secondEntityManager = new TestEntityManager();\n\n    @Produces\n    @First\n    protected EntityManager firstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    @Produces\n    @Second\n    protected EntityManager secondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/stereotype/Repository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.stereotype;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ TYPE })\n@Retention(RUNTIME)\n@Documented\n\n//cdi annotations\n@Stereotype\n@Transactional\n@ApplicationScoped\npublic @interface Repository\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/stereotype/StereotypeTransactionalTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.stereotype;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class StereotypeTransactionalTest\n{\n    @Inject\n    private TransactionalBean transactionalBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"stereotypeTransactionalTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(StereotypeTransactionalTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void transactionalBeanViaStereotype()\n    {\n        EntityManager injectedEntityManager = entityManagerProducer.getEntityManager();\n\n        Assert.assertNotNull(injectedEntityManager);\n        Assert.assertTrue(injectedEntityManager instanceof TestEntityManager);\n        TestEntityTransaction testTransaction = (TestEntityTransaction) (injectedEntityManager).getTransaction();\n\n        Assert.assertEquals(false, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(false, testTransaction.isStarted());\n        Assert.assertEquals(false, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        transactionalBean.executeInTransaction();\n\n        Assert.assertEquals(true, ((TestEntityManager) injectedEntityManager).isFlushed());\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/stereotype/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.stereotype;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private EntityManager entityManager = new TestEntityManager();\n    \n    @Produces\n    protected EntityManager getEntityManager()\n    {\n        return entityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/stereotype/TransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.stereotype;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@Repository\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/transactionhelper/TransactionHelperTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.transactionhelper;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.jpa.api.transaction.TransactionHelper;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.persistence.EntityManager;\nimport jakarta.persistence.EntityTransaction;\nimport java.util.concurrent.Callable;\n\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class TransactionHelperTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"defaultInjectionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(TransactionHelperTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Test\n    public void testTransactionHelper() throws Exception\n    {\n        try\n        {\n            resolveEntityManager();\n            Assert.fail(\"ContextNotActiveException expected!\");\n        }\n        catch(ContextNotActiveException cnae)\n        {\n            // this was expected, all is fine!\n        }\n\n        Integer retVal = TransactionHelper.getInstance().executeTransactional( new Callable<Integer>() {\n\n            public Integer call() throws Exception\n            {\n                resolveEntityManager();\n\n                return Integer.valueOf(3);\n            }\n        });\n\n        Assert.assertEquals(retVal, Integer.valueOf(3));\n\n        try\n        {\n            resolveEntityManager();\n            Assert.fail(\"ContextNotActiveException expected!\");\n        }\n        catch(ContextNotActiveException cnae)\n        {\n            // this was expected, all is fine!\n        }\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n\n    private void resolveEntityManager()\n    {\n        EntityManager em = BeanProvider.getContextualReference(EntityManager.class);\n        Assert.assertNotNull(em);\n        EntityTransaction et = em.getTransaction();\n        Assert.assertNotNull(et);\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactional/transactionhelper/TransactionScopedEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactional.transactionhelper;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n/**\n * This class produces and closes the EntityManager\n * for our {@link TransactionHelperTest}\n */\n@Dependent\npublic class TransactionScopedEntityManagerProducer\n{\n\n    @Produces\n    @TransactionScoped\n    public EntityManager createEntityManager()\n    {\n        return new TestEntityManager();\n    }\n\n    public void closeEntityManager(@Disposes EntityManager em)\n    {\n        em.close();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultinjection/DefaultTransactionScopedEntityManagerInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultinjection;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class DefaultTransactionScopedEntityManagerInjectionTest\n{\n    @Inject\n    private TransactionalBean transactionalBean;\n\n    @Inject\n    private EntityManager entityManager;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"defaultTransactionScopedInjectionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(DefaultTransactionScopedEntityManagerInjectionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void defaultTransactionScopedEntityManagerInjection()\n    {\n        transactionalBean.executeInTransaction();\n\n        TestEntityTransaction testTransaction =\n            (TestEntityTransaction) entityManagerProducer.getEntityManager().getTransaction();\n\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCount());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n\n    @Test\n    public void entityManagerUsageWithoutTransaction()\n    {\n        try\n        {\n            //not available because there is no transactional method\n            entityManager.getTransaction();\n            Assert.fail(ContextNotActiveException.class.getName() + \" expected!\");\n        }\n        catch (ContextNotActiveException e)\n        {\n            //expected\n        }\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n\n    @Test\n    public void invalidEntityManagerUsageAfterTransaction()\n    {\n        transactionalBean.executeInTransaction();\n\n        try\n        {\n            //not available because there is no transactional method\n            entityManager.getTransaction();\n            Assert.fail(ContextNotActiveException.class.getName() + \" expected!\");\n        }\n        catch (ContextNotActiveException e)\n        {\n            //expected\n        }\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultinjection/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultinjection;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager entityManager;\n\n    private int closeEntityManagerCount = 0;\n    \n    @Produces\n    @TransactionScoped\n    protected EntityManager entityManager()\n    {\n        if (entityManager == null)\n        {\n            entityManager = new TestEntityManager();\n            return entityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeEntityManager(@Disposes EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCount++;\n    }\n\n    public int getCloseEntityManagerCount()\n    {\n        return closeEntityManagerCount;\n    }\n\n    public TestEntityManager getEntityManager()\n    {\n        return entityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultinjection/TransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultinjection;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        //just access the transaction-scoped bean\n        entityManager.getTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultnested/DefaultTransactionScopedNestedTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultnested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class DefaultTransactionScopedNestedTransactionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"defaultTransactionScopedNestedTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(DefaultTransactionScopedNestedTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void defaultTransactionScopedNestedTransaction()\n    {\n        firstLevelTransactionBean.executeInTransaction();\n\n        TestEntityTransaction testTransaction =\n            (TestEntityTransaction) entityManagerProducer.getEntityManager().getTransaction();\n\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCount());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultnested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultnested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultnested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultnested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/defaultnested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.defaultnested;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager entityManager;\n\n    private int closeEntityManagerCount = 0;\n\n    @Produces\n    @TransactionScoped\n    protected EntityManager entityManager()\n    {\n        if (entityManager == null)\n        {\n            entityManager = new TestEntityManager();\n            return entityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeEntityManager(@Disposes EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCount++;\n    }\n\n    public int getCloseEntityManagerCount()\n    {\n        return closeEntityManagerCount;\n    }\n\n    public TestEntityManager getEntityManager()\n    {\n        return entityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/auto/MultiTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/auto/MultipleTransactionScopedEntityManagerInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.auto;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class MultipleTransactionScopedEntityManagerInjectionTest\n{\n    @Inject\n    private MultiTransactionBean multiTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"autoTransactionScopedInjectionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(MultipleTransactionScopedEntityManagerInjectionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void autoTransactionScopedEntityManagerInjection()\n    {\n        multiTransactionBean.executeInTransaction();\n\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction)defaultEntityManager.getTransaction();\n\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityTransaction firstTransaction = (TestEntityTransaction)firstEntityManager.getTransaction();\n\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n        TestEntityTransaction secondTransaction = (TestEntityTransaction)secondEntityManager.getTransaction();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(true, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountDefaultEntityManager());\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountFirstEntityManager());\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountSecondEntityManager());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/auto/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.auto;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager;\n\n    private TestEntityManager firstEntityManager;\n\n    private TestEntityManager secondEntityManager;\n\n    private int closeEntityManagerCountDefaultEntityManager = 0;\n\n    private int closeEntityManagerCountFirstEntityManager = 0;\n\n    private int closeEntityManagerCountSecondEntityManager = 0;\n\n    @Produces\n    @TransactionScoped\n    protected EntityManager defaultEntityManager()\n    {\n        if (defaultEntityManager == null)\n        {\n            defaultEntityManager = new TestEntityManager();\n            return defaultEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    @Produces\n    @First\n    @TransactionScoped\n    protected EntityManager firstEntityManager()\n    {\n        if (firstEntityManager == null)\n        {\n            firstEntityManager = new TestEntityManager();\n            return firstEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    @Produces\n    @Second\n    @TransactionScoped\n    protected EntityManager secondEntityManager()\n    {\n        if (secondEntityManager == null)\n        {\n            secondEntityManager = new TestEntityManager();\n            return secondEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeDefaultEntityManager(@Disposes @Default EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountDefaultEntityManager++;\n    }\n\n    protected void closeFirstEntityManager(@Disposes @First EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountFirstEntityManager++;\n    }\n\n    protected void closeSecondEntityManager(@Disposes @Second EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountSecondEntityManager++;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public int getCloseEntityManagerCountDefaultEntityManager()\n    {\n        return closeEntityManagerCountDefaultEntityManager;\n    }\n\n    public int getCloseEntityManagerCountFirstEntityManager()\n    {\n        return closeEntityManagerCountFirstEntityManager;\n    }\n\n    public int getCloseEntityManagerCountSecondEntityManager()\n    {\n        return closeEntityManagerCountSecondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/manual/ManualTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.manual;\n\nimport org.apache.deltaspike.jpa.api.entitymanager.EntityManagerConfig;\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class ManualTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional(qualifier = Default.class)\n    public void executeInDefaultTransaction()\n    {\n    }\n\n    @Transactional\n    @EntityManagerConfig(qualifier = First.class)\n    public void executeInFirstTransaction()\n    {\n    }\n\n    @Transactional(qualifier = Second.class)\n    public void executeInSecondTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/manual/ManualTransactionScopedTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.manual;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class ManualTransactionScopedTransactionTest\n{\n    @Inject\n    private ManualTransactionBean manualTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"manualTransactionScopedTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(ManualTransactionScopedTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void manualTransactionScopedTransactionTest()\n    {\n        manualTransactionBean.executeInDefaultTransaction();\n        manualTransactionBean.executeInFirstTransaction();\n        manualTransactionBean.executeInSecondTransaction();\n\n        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();\n        TestEntityTransaction defaultTransaction = (TestEntityTransaction)defaultEntityManager.getTransaction();\n\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityTransaction firstTransaction = (TestEntityTransaction)firstEntityManager.getTransaction();\n\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n        TestEntityTransaction secondTransaction = (TestEntityTransaction)secondEntityManager.getTransaction();\n\n        Assert.assertEquals(true, defaultEntityManager.isFlushed());\n        Assert.assertEquals(false, defaultTransaction.isActive());\n        Assert.assertEquals(true, defaultTransaction.isStarted());\n        Assert.assertEquals(true, defaultTransaction.isCommitted());\n        Assert.assertEquals(false, defaultTransaction.isRolledBack());\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountDefaultEntityManager());\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountFirstEntityManager());\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountSecondEntityManager());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/manual/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.manual;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager defaultEntityManager;\n\n    private TestEntityManager firstEntityManager;\n\n    private TestEntityManager secondEntityManager;\n\n    private int closeEntityManagerCountDefaultEntityManager = 0;\n\n    private int closeEntityManagerCountFirstEntityManager = 0;\n\n    private int closeEntityManagerCountSecondEntityManager = 0;\n\n    @Produces\n    @TransactionScoped\n    protected EntityManager defaultEntityManager()\n    {\n        if (defaultEntityManager == null)\n        {\n            defaultEntityManager = new TestEntityManager();\n            return defaultEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    @Produces\n    @First\n    @TransactionScoped\n    protected EntityManager firstEntityManager()\n    {\n        if (firstEntityManager == null)\n        {\n            firstEntityManager = new TestEntityManager();\n            return firstEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    @Produces\n    @Second\n    @TransactionScoped\n    protected EntityManager secondEntityManager()\n    {\n        if (secondEntityManager == null)\n        {\n            secondEntityManager = new TestEntityManager();\n            return secondEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeDefaultEntityManager(@Disposes @Default EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountDefaultEntityManager++;\n    }\n\n    protected void closeFirstEntityManager(@Disposes @First EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountFirstEntityManager++;\n    }\n\n    protected void closeSecondEntityManager(@Disposes @Second EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountSecondEntityManager++;\n    }\n\n    public TestEntityManager getDefaultEntityManager()\n    {\n        return defaultEntityManager;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public int getCloseEntityManagerCountDefaultEntityManager()\n    {\n        return closeEntityManagerCountDefaultEntityManager;\n    }\n\n    public int getCloseEntityManagerCountFirstEntityManager()\n    {\n        return closeEntityManagerCountFirstEntityManager;\n    }\n\n    public int getCloseEntityManagerCountSecondEntityManager()\n    {\n        return closeEntityManagerCountSecondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/nested/NestedMultiTransactionScopedTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedMultiTransactionScopedTransactionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedMultiTransactionScopedTransactionTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedMultiTransactionScopedTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedMultiTransactionScopedTransactionTest()\n    {\n        firstLevelTransactionBean.executeInTransaction();\n\n        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();\n        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();\n\n        Assert.assertNotNull(firstEntityManager);\n        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();\n\n        Assert.assertNotNull(secondEntityManager);\n        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();\n\n        Assert.assertEquals(true, firstEntityManager.isFlushed());\n        Assert.assertEquals(false, firstTransaction.isActive());\n        Assert.assertEquals(true, firstTransaction.isStarted());\n        Assert.assertEquals(true, firstTransaction.isCommitted());\n        Assert.assertEquals(false, firstTransaction.isRolledBack());\n\n        Assert.assertEquals(true, secondEntityManager.isFlushed());\n        Assert.assertEquals(false, secondTransaction.isActive());\n        Assert.assertEquals(true, secondTransaction.isStarted());\n        Assert.assertEquals(true, secondTransaction.isCommitted());\n        Assert.assertEquals(false, secondTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountFirstEntityManager());\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCountSecondEntityManager());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/multipleinjection/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.multipleinjection.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.Second;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager;\n\n    private TestEntityManager secondEntityManager;\n\n    private int closeEntityManagerCountFirstEntityManager = 0;\n\n    private int closeEntityManagerCountSecondEntityManager = 0;\n\n    @Produces\n    @First\n    @TransactionScoped\n    protected EntityManager firstEntityManager()\n    {\n        if (firstEntityManager == null)\n        {\n            firstEntityManager = new TestEntityManager();\n            return firstEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    @Produces\n    @Second\n    @TransactionScoped\n    protected EntityManager secondEntityManager()\n    {\n        if (secondEntityManager == null)\n        {\n            secondEntityManager = new TestEntityManager();\n            return secondEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeFirstEntityManager(@Disposes @First EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountFirstEntityManager++;\n    }\n\n    protected void closeSecondEntityManager(@Disposes @Second EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCountSecondEntityManager++;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n\n    public TestEntityManager getSecondEntityManager()\n    {\n        return secondEntityManager;\n    }\n\n    public int getCloseEntityManagerCountFirstEntityManager()\n    {\n        return closeEntityManagerCountFirstEntityManager;\n    }\n\n    public int getCloseEntityManagerCountSecondEntityManager()\n    {\n        return closeEntityManagerCountSecondEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/nested/FirstLevelTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        nestedTransactionBean.executeInTransaction();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/nested/NestedTransactionBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@ApplicationScoped\npublic class NestedTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/nested/NestedTransactionScopedTransactionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.nested;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class NestedTransactionScopedTransactionTest\n{\n    @Inject\n    private FirstLevelTransactionBean firstLevelTransactionBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"nestedTransactionScopedTransaction.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(NestedTransactionScopedTransactionTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void nestedTransactionScopedTransaction()\n    {\n        firstLevelTransactionBean.executeInTransaction();\n\n        TestEntityTransaction testTransaction =\n            (TestEntityTransaction) entityManagerProducer.getFirstEntityManager().getTransaction();\n\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCount());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/nested/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.nested;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.First;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager firstEntityManager;\n\n    private int closeEntityManagerCount = 0;\n\n    @Produces\n    @First\n    @TransactionScoped\n    protected EntityManager firstEntityManager()\n    {\n        if (firstEntityManager == null)\n        {\n            firstEntityManager = new TestEntityManager();\n            return firstEntityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeEntityManager(@Disposes @First EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCount++;\n    }\n\n    public int getCloseEntityManagerCount()\n    {\n        return closeEntityManagerCount;\n    }\n\n    public TestEntityManager getFirstEntityManager()\n    {\n        return firstEntityManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/stereotype/Repository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.stereotype;\n\nimport org.apache.deltaspike.jpa.api.transaction.Transactional;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ TYPE })\n@Retention(RUNTIME)\n@Documented\n\n//cdi annotations\n@Stereotype\n@Transactional\n@ApplicationScoped\npublic @interface Repository\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/stereotype/StereotypeTransactionScopedTransactionalTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.stereotype;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionBeanStorage;\nimport org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Category(SeCategory.class)\npublic class StereotypeTransactionScopedTransactionalTest\n{\n    @Inject\n    private TransactionalBean transactionalBean;\n\n    @Inject\n    private TestEntityManagerProducer entityManagerProducer;\n\n    @Inject\n    private TestEntityTransactionHolder testEntityTransactionHolder;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"stereotypeTransactionScopedTransactionalTest.jar\")\n                .addPackage(ArchiveUtils.SHARED_PACKAGE)\n                .addPackage(StereotypeTransactionScopedTransactionalTest.class.getPackage().getName())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())\n                .addAsLibraries(testJar)\n                .addAsServiceProvider(Extension.class, TransactionContextExtension.class)\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Before\n    public void init()\n    {\n        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);\n    }\n\n    @Test\n    public void transactionalBeanViaStereotypeInTransactionScoped()\n    {\n        transactionalBean.executeInTransaction();\n\n        TestEntityTransaction testTransaction = testEntityTransactionHolder.getTestEntityTransaction();\n\n        Assert.assertEquals(false, testTransaction.isActive());\n        Assert.assertEquals(true, testTransaction.isStarted());\n        Assert.assertEquals(true, testTransaction.isCommitted());\n        Assert.assertEquals(false, testTransaction.isRolledBack());\n\n        Assert.assertEquals(1, entityManagerProducer.getCloseEntityManagerCount());\n\n        Assert.assertEquals(false, TransactionBeanStorage.isOpen());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/stereotype/TestEntityManagerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.stereotype;\n\nimport org.apache.deltaspike.jpa.api.transaction.TransactionScoped;\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Disposes;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.persistence.EntityManager;\n\n@RequestScoped\npublic class TestEntityManagerProducer\n{\n    private TestEntityManager entityManager;\n\n    private int closeEntityManagerCount = 0;\n\n    @Produces\n    @TransactionScoped\n    protected EntityManager entityManager()\n    {\n        if (entityManager == null)\n        {\n            entityManager = new TestEntityManager();\n            return entityManager;\n        }\n\n        throw new IllegalStateException(\"a second producer call isn't allowed\");\n    }\n\n    protected void closeEntityManager(@Disposes EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n        closeEntityManagerCount++;\n    }\n\n    public int getCloseEntityManagerCount()\n    {\n        return closeEntityManagerCount;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/stereotype/TestEntityTransactionHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.stereotype;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class TestEntityTransactionHolder\n{\n    private TestEntityTransaction testEntityTransaction;\n\n    public TestEntityTransaction getTestEntityTransaction()\n    {\n        return testEntityTransaction;\n    }\n\n    public void setTestEntityTransaction(TestEntityTransaction testEntityTransaction)\n    {\n        this.testEntityTransaction = testEntityTransaction;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/api/transactionscoped/stereotype/TransactionalBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.api.transactionscoped.stereotype;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction;\n\nimport jakarta.inject.Inject;\nimport jakarta.persistence.EntityManager;\n\n@Repository\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    //we can't provide a simple getter because it would be intercepted as well and\n    //would break the check we have to perform in the test\n    @Inject\n    private TestEntityTransactionHolder testEntityTransactionHolder;\n\n    public void executeInTransaction()\n    {\n        testEntityTransactionHolder.setTestEntityTransaction(\n                (TestEntityTransaction) entityManager.getTransaction());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/datasource/DummyConnection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.datasource;\n\nimport java.sql.Array;\nimport java.sql.Blob;\nimport java.sql.CallableStatement;\nimport java.sql.Clob;\nimport java.sql.Connection;\nimport java.sql.DatabaseMetaData;\nimport java.sql.NClob;\nimport java.sql.PreparedStatement;\nimport java.sql.SQLClientInfoException;\nimport java.sql.SQLException;\nimport java.sql.SQLWarning;\nimport java.sql.SQLXML;\nimport java.sql.Savepoint;\nimport java.sql.Statement;\nimport java.sql.Struct;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.concurrent.Executor;\n\n/**\n * Dummy JDBC Connection for use in a unit test\n */\npublic class DummyConnection implements Connection\n{\n    @Override\n    public void clearWarnings() throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public Statement createStatement() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public String nativeSQL(String sql) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public void setAutoCommit(boolean autoCommit) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public boolean getAutoCommit() throws SQLException\n    {\n        return false;\n    }\n\n    @Override\n    public void commit() throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public void rollback() throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public void close() throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public boolean isClosed() throws SQLException\n    {\n        return false;\n    }\n\n    @Override\n    public DatabaseMetaData getMetaData() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public void setReadOnly(boolean readOnly) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public boolean isReadOnly() throws SQLException\n    {\n        return false;\n    }\n\n    @Override\n    public void setCatalog(String catalog) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public String getCatalog() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public void setTransactionIsolation(int level) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public int getTransactionIsolation() throws SQLException\n    {\n        return 0;\n    }\n\n    @Override\n    public SQLWarning getWarnings() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Map<String, Class<?>> getTypeMap() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public void setTypeMap(Map<String, Class<?>> map) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public void setHoldability(int holdability) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public int getHoldability() throws SQLException\n    {\n        return 0;\n    }\n\n    @Override\n    public Savepoint setSavepoint() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Savepoint setSavepoint(String name) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public void rollback(Savepoint savepoint) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public void releaseSavepoint(Savepoint savepoint) throws SQLException\n    {\n        // not implemented\n    }\n\n    @Override\n    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Clob createClob() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Blob createBlob() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public NClob createNClob() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public SQLXML createSQLXML() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public boolean isValid(int timeout) throws SQLException\n    {\n        return false;\n    }\n\n    @Override\n    public void setClientInfo(String name, String value) throws SQLClientInfoException\n    {\n        // not implemented\n    }\n\n    @Override\n    public void setClientInfo(Properties properties) throws SQLClientInfoException\n    {\n        // not implemented\n    }\n\n    @Override\n    public String getClientInfo(String name) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Properties getClientInfo() throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Array createArrayOf(String typeName, Object[] elements) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public Struct createStruct(String typeName, Object[] attributes) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> iface) throws SQLException\n    {\n        return null;\n    }\n\n    @Override\n    public boolean isWrapperFor(Class<?> iface) throws SQLException\n    {\n        return false;\n    }\n\n    /*\n     * This method was introduced by Java7's java.sql.Driver and breaks backwards compatibility.\n     */\n    public int getNetworkTimeout() throws SQLException\n    {\n        return 0;\n    }\n    \n    /*\n     * This method was introduced by Java7's java.sql.Driver and breaks backwards compatibility.\n     */\n    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException\n    {\n        // not implemented\n    }\n\n    /*\n     * This method was introduced by Java7's java.sql.Driver and breaks backwards compatibility.\n     */\n    public void abort(Executor executor) throws SQLException\n    {\n        // not implemented\n    }\n    \n    /*\n     * This method was introduced by Java7's java.sql.Driver and breaks backwards compatibility.\n     */\n    public String getSchema() throws SQLException\n    {\n        return null;\n    }\n\n    /*\n     * This method was introduced by Java7's java.sql.Driver and breaks backwards compatibility.\n     */\n    public void setSchema(String schema) throws SQLException\n    {\n        // not implemented\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/datasource/DummyJdbcDriver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.datasource;\n\nimport java.sql.Connection;\nimport java.sql.Driver;\nimport java.sql.DriverPropertyInfo;\nimport java.sql.SQLException;\nimport java.sql.SQLFeatureNotSupportedException;\nimport java.util.Properties;\nimport java.util.logging.Logger;\n\n/**\n * A dummy JDBC driver for use in our unit tests\n */\npublic class DummyJdbcDriver implements Driver\n{\n    @Override\n    public boolean acceptsURL(String url) throws SQLException\n    {\n        return true;\n    }\n\n    @Override\n    public Connection connect(String url, Properties info) throws SQLException\n    {\n        return new DummyConnection();\n    }\n\n    @Override\n    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException\n    {\n        return new DriverPropertyInfo[0];  //To change body of implemented methods use File | Settings | File Templates.\n    }\n\n    @Override\n    public int getMajorVersion()\n    {\n        return 1;\n    }\n\n    @Override\n    public int getMinorVersion()\n    {\n        return 0;\n    }\n\n    @Override\n    public boolean jdbcCompliant()\n    {\n        return true;\n    }\n\n    /*\n     * This method was introduced by Java7's java.sql.Driver and breaks backwards compatibility.\n     */\n    public Logger getParentLogger() throws SQLFeatureNotSupportedException\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/EntityMappingsDescriptorParserTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\nimport java.io.IOException;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.EntityMappingsDescriptor;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.EntityMappingsDescriptorParser;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class EntityMappingsDescriptorParserTest\n{\n    private EntityMappingsDescriptorParser entityMappingsDescriptorParser;\n    private EntityMappingsDescriptor descriptor;\n\n    @Before\n    public void before() throws IOException\n    {\n        entityMappingsDescriptorParser\n            = new EntityMappingsDescriptorParser();\n        descriptor\n            = entityMappingsDescriptorParser.readAll(getClass().getResource(\"/\").getPath(), \"META-INF/test-orm.xml\");\n    }\n    \n    @Test\n    public void testPackageName() throws IOException\n    {\n        Assert.assertEquals(\"org.apache.deltaspike.test.jpa.spi.descriptor.xml\",\n                descriptor.getPackageName());\n    }\n    \n    @Test\n    public void testEntityDescriptors() throws IOException\n    {\n        Assert.assertNotNull(descriptor.getEntityDescriptors());\n        Assert.assertEquals(3, descriptor.getEntityDescriptors().size());\n    }\n    \n    @Test\n    public void testMappedSuperclassDescriptors() throws IOException\n    {\n        Assert.assertNotNull(descriptor.getMappedSuperclassDescriptors());\n        Assert.assertEquals(2, descriptor.getMappedSuperclassDescriptors().size());\n    }\n    \n    @Test\n    public void testEntityClass() throws IOException\n    {\n        Assert.assertEquals(MappedOne.class,\n                descriptor.getEntityDescriptors().get(0).getEntityClass());\n        Assert.assertEquals(MappedTwo.class,\n                descriptor.getEntityDescriptors().get(1).getEntityClass());\n        Assert.assertEquals(MappedThree.class,\n                descriptor.getEntityDescriptors().get(2).getEntityClass());\n    }\n    \n    @Test\n    public void testId() throws IOException\n    {\n        Assert.assertEquals(\"id\",\n                descriptor.getEntityDescriptors().get(0).getId()[0]);\n        Assert.assertEquals(\"teeSetId\",\n                descriptor.getEntityDescriptors().get(1).getId()[0]);\n        Assert.assertEquals(\"holeId\",\n                descriptor.getEntityDescriptors().get(1).getId()[1]);\n        Assert.assertEquals(null,\n                descriptor.getEntityDescriptors().get(2).getId());\n    }\n    \n    @Test\n    public void testVersion() throws IOException\n    {\n        Assert.assertEquals(\"version\",\n                descriptor.getEntityDescriptors().get(0).getVersion());\n        Assert.assertEquals(null,\n                descriptor.getEntityDescriptors().get(1).getVersion());\n        Assert.assertEquals(null,\n                descriptor.getEntityDescriptors().get(2).getVersion());\n        \n        Assert.assertEquals(null, descriptor.getMappedSuperclassDescriptors().get(0).getVersion());\n        Assert.assertEquals(\"version\", descriptor.getMappedSuperclassDescriptors().get(1).getVersion());\n    }\n    \n    @Test\n    public void testName() throws IOException\n    {\n        Assert.assertEquals(\"Mapped_One\",\n                descriptor.getEntityDescriptors().get(0).getName());\n    }\n    \n    @Test\n    public void testTableName() throws IOException\n    {\n        Assert.assertEquals(\"mapped_three_table\",\n                descriptor.getEntityDescriptors().get(2).getTableName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/MappedId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\npublic class MappedId\n{\n\n    private Long id;\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/MappedOne.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\npublic class MappedOne\n{\n\n    private Long id;\n    private String name;\n\n    public MappedOne()\n    {\n    }\n\n    public MappedOne(String name)\n    {\n        this.name = name;\n    }\n\n    public Long getId()\n    {\n        return id;\n    }\n\n    public void setId(Long id)\n    {\n        this.id = id;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/MappedSuperclass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\npublic class MappedSuperclass extends MappedId\n{\n\n    private Long counter;\n\n    public Long getCounter()\n    {\n        return counter;\n    }\n\n    public void setCounter(Long id)\n    {\n        this.counter = id;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/MappedThree.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\npublic class MappedThree extends MappedSuperclass\n{\n\n    private String name;\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/MappedTwo.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\npublic class MappedTwo\n{\n\n    private Long teeSetId;\n    private Long holeId;\n\n    private String name;\n\n    public Long getTeeSetId()\n    {\n        return teeSetId;\n    }\n\n    public void setTeeSetId(Long teeSetId)\n    {\n        this.teeSetId = teeSetId;\n    }\n\n    public Long getHoleId()\n    {\n        return holeId;\n    }\n\n    public void setHoleId(Long holeId)\n    {\n        this.holeId = holeId;\n    }\n\n    public String getName()\n    {\n        return name;\n    }\n\n    public void setName(String name)\n    {\n        this.name = name;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/PersistenceUnitDescriptorParserTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\nimport java.io.IOException;\nimport java.util.List;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptor;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptorParser;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class PersistenceUnitDescriptorParserTest\n{\n    private PersistenceUnitDescriptorParser persistenceUnitDescriptorParser;\n    private List<PersistenceUnitDescriptor> descriptors;\n\n    @Before\n    public void before() throws IOException\n    {\n        persistenceUnitDescriptorParser\n            = new PersistenceUnitDescriptorParser();\n        descriptors\n            = persistenceUnitDescriptorParser.readAll();\n    }\n    \n    @Test\n    public void testPackageName() throws IOException\n    {\n        Assert.assertEquals(\"test\", descriptors.get(0).getName());\n        Assert.assertEquals(\"test2\", descriptors.get(1).getName());\n    }\n    \n    @Test\n    public void testProperties() throws IOException\n    {\n        Assert.assertNotNull(descriptors.get(0).getProperties());\n        Assert.assertEquals(1, descriptors.get(0).getProperties().size());\n        \n        Assert.assertNotNull(descriptors.get(1).getProperties());\n        Assert.assertEquals(3, descriptors.get(1).getProperties().size());\n        \n        Assert.assertNotNull(descriptors.get(2).getProperties());\n        Assert.assertEquals(0, descriptors.get(2).getProperties().size());\n    }\n    \n    @Test\n    public void testEntityDescriptors() throws IOException\n    {\n        Assert.assertNotNull(descriptors.get(0).getEntityDescriptors());\n        Assert.assertEquals(3, descriptors.get(0).getEntityDescriptors().size());\n        Assert.assertEquals(MappedOne.class,\n            descriptors.get(0).getEntityDescriptors().get(0).getEntityClass());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/PersistenceUnitDescriptorProviderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\nimport java.io.IOException;\nimport junit.framework.Assert;\nimport org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptorProvider;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class PersistenceUnitDescriptorProviderTest\n{\n    @Before\n    public void before() throws IOException\n    {\n        PersistenceUnitDescriptorProvider.getInstance().init();\n    }\n    \n    @Test\n    public void testParentIdLookup()\n    {\n        String[] ids =\n            PersistenceUnitDescriptorProvider.getInstance().primaryKeyFields(MappedThree.class);\n        Assert.assertNotNull(ids);\n        Assert.assertEquals(1, ids.length);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/jpa/spi/descriptor/xml/TeeId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jpa.spi.descriptor.xml;\n\nimport java.io.Serializable;\n\nimport jakarta.persistence.Column;\nimport jakarta.persistence.Embeddable;\n\n@Embeddable\n@SuppressWarnings(\"serial\")\npublic class TeeId implements Serializable\n{\n\n    @Column(nullable = false)\n    private Long teeSetId;\n\n    @Column(nullable = false)\n    private Long holeId;\n\n    public TeeId()\n    {\n    }\n\n    public TeeId(long teeSetId, long holeId)\n    {\n        this.teeSetId = teeSetId;\n        this.holeId = holeId;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + (int) (holeId ^ (holeId >>> 32));\n        result = prime * result + (int) (teeSetId ^ (teeSetId >>> 32));\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj)\n    {\n        if (this == obj)\n        {\n            return true;\n        }\n        if (obj == null)\n        {\n            return false;\n        }\n        if (getClass() != obj.getClass())\n        {\n            return false;\n        }\n        TeeId other = (TeeId) obj;\n        if (holeId != other.holeId)\n        {\n            return false;\n        }\n        if (teeSetId != other.teeSetId)\n        {\n            return false;\n        }\n        return true;\n    }\n\n    public long getTeeSetId()\n    {\n        return teeSetId;\n    }\n\n    public void setTeeSetId(long teeSetId)\n    {\n        this.teeSetId = teeSetId;\n    }\n\n    public long getHoleId()\n    {\n        return holeId;\n    }\n\n    public void setHoleId(long holeId)\n    {\n        this.holeId = holeId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.util;\n\nimport org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\n/**\n * This class contains helpers for building frequently used archives\n */\npublic class ArchiveUtils\n{\n    public static final String SHARED_PACKAGE = TestEntityManager.class.getPackage().getName();\n\n    private ArchiveUtils()\n    {\n        // private ct\n    }\n\n    public static JavaArchive[] getDeltaSpikeCoreAndJpaArchive()\n    {\n        return ShrinkWrapArchiveUtil.getArchives(\n                null,\n                \"META-INF/beans.xml\",\n                new String[]{\"org.apache.deltaspike.core\", \"org.apache.deltaspike.jpa\"},\n                null,\n                \"ds-core_and_jpa\");\n    }\n\n    public static Asset getBeansXml()\n    {\n        @SuppressWarnings(\"UnnecessaryLocalVariable\")\n        Asset beansXml = new StringAsset(\n            \"<beans>\" +\n                \"<interceptors>\" +\n                    \"<class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>\" +\n                \"</interceptors>\" +\n            \"</beans>\"\n        );\n\n        return beansXml;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n# overwriting the original value from bla to blub\ndeltaspike.persistence.config.MyUnit.jakarta.persistence.jdbc.password=blub\n\n# and a new config entry\ndeltaspike.persistence.config.MyUnit.jakarta.persistence.jdbc.driver=some.jdbc.Driver"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/resources/META-INF/persistence.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<persistence version=\"2.0\" xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n    <persistence-unit name=\"test\"> \n        <jta-data-source>java:test/test</jta-data-source>\n        <mapping-file>META-INF/test-orm.xml</mapping-file>\n        <properties>\n            <property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\"/>\n        </properties>\n    </persistence-unit>\n    <persistence-unit name=\"test2\"> \n        <properties>\n            <property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\"/>\n            <property name=\"anyOtherProperty\" value=\"test\"/>\n            <property name=\"anyOtherProperty2\" value=\"test\"/>\n        </properties>\n    </persistence-unit>\n    <persistence-unit name=\"test3\"> \n\n    </persistence-unit>\n</persistence>\n"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/resources/META-INF/test-orm.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n        xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\" version=\"2.0\">\n\n    <package>org.apache.deltaspike.test.jpa.spi.descriptor.xml</package>\n    \n    <mapped-superclass class=\"MappedSuperclass\">\n    </mapped-superclass>\n    <mapped-superclass class=\"MappedId\">\n        <attributes>\n            <id name=\"id\">\n                <generated-value />\n            </id>\n            <version name=\"version\" />\n        </attributes>\n    </mapped-superclass>\n    \n    <entity class=\"MappedOne\" name=\"Mapped_One\">\n        <attributes>\n            <id name=\"id\">\n                <generated-value />\n            </id>\n            <version name=\"version\" />\n        </attributes>\n    </entity>\n    <entity class=\"org.apache.deltaspike.test.jpa.spi.descriptor.xml.MappedTwo\" name=\"Mapped_Two\">\n        <id-class class=\"org.apache.deltaspike.test.jpa.spi.descriptor.xml.TeeId\"/>\n        <attributes>\n            <id name=\"teeSetId\"/>\n            <id name=\"holeId\"/>\n        </attributes>\n    </entity>\n    <entity class=\"MappedThree\">\n        <table name=\"mapped_three_table\" />\n    </entity>\n    \n\n\n</entity-mappings>"
  },
  {
    "path": "deltaspike/modules/jpa/impl/src/test/resources/persistence-MyUnit.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\njakarta.persistence.jdbc.user=sa\njakarta.persistence.jdbc.password=bla"
  },
  {
    "path": "deltaspike/modules/jpa/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>jpa-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike JPA-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n\n    <dependencies>\n        <!-- JPA API -->\n        <dependency>\n            <groupId>jakarta.persistence</groupId>\n            <artifactId>jakarta.persistence-api</artifactId>\n        </dependency>\n    </dependencies>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>jsf-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jsf-module-api</artifactId>\n\n    <name>Apache DeltaSpike JSF-Module API</name>\n\n    <properties>\n        <junit.jupiter.version>5.9.2</junit.jupiter.version>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <version>${myfaces.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-test</artifactId>\n            <version>${myfaces.version}</version>\n            <scope>test</scope>\n        </dependency>\n\n        <dependency> <!-- transitive from myfaces-test but explicitely used -->\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-api</artifactId>\n            <version>${junit.jupiter.version}</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.config;\n\nimport java.lang.annotation.Annotation;\nimport org.apache.deltaspike.core.api.config.DeltaSpikeConfig;\nimport org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.lifecycle.ClientWindow;\n\n/**\n * Config for all JSF specific configurations.\n */\n@ApplicationScoped\npublic class JsfModuleConfig implements DeltaSpikeConfig\n{\n    private static final long serialVersionUID = -487295181899986237L;\n\n    private volatile Boolean initialized;\n    private boolean delegatedWindowHandlingEnabled;\n\n    protected JsfModuleConfig()\n    {\n    }\n\n    /**\n     * If the initial redirect is enabled, a redirect will be performed for adding the current window-id to the url.\n     *\n     * @return true for activating it, false otherwise\n     */\n    public boolean isInitialRedirectEnabled()\n    {\n        return true;\n    }\n\n    /**\n     * Per default all faces-messages are preserved for the next rendering process\n     * @return true if the messages should be preserved automatically, false otherwise\n     */\n    public boolean isAlwaysKeepMessages()\n    {\n        return true;\n    }\n\n    /**\n     * Per default the current view gets replaced with the error-view (in case of a security-violation).\n     * For using a redirect it's needed to return true and using Page.NavigationMode.REDIRECT for @View of the\n     * error-view-config.\n     * @return true if the navigation-handler should be used in case of a security-violation, false otherwise\n     */\n    public boolean isAlwaysUseNavigationHandlerOnSecurityViolation()\n    {\n        return false;\n    }\n\n    /**\n     * If the window-handling of Faces is enabled,\n     * {@link org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig.ClientWindowRenderMode#DELEGATED}\n     * will be returned. In all other cases <code>null</code> gets returned as application wide default value.\n     * That leads to a default-handling per session (which includes logic for handling bots,...)\n     * @return application-default for the window-mode\n     */\n    public ClientWindowConfig.ClientWindowRenderMode getDefaultWindowMode()\n    {\n        lazyInit();\n\n        if (this.delegatedWindowHandlingEnabled)\n        {\n            return ClientWindowConfig.ClientWindowRenderMode.DELEGATED;\n        }\n        return null;\n    }\n\n    /**\n     * Defines the {@link jakarta.inject.Qualifier} which will be used for the\n     * FacesContextWrapper ExceptionHandler\n     * for unhandled JSF exceptions.\n     *\n     * @return the {@link jakarta.inject.Qualifier}.\n     */\n    public Class<? extends Annotation> getExceptionQualifier()\n    {\n        return Default.class;\n    }\n\n    public boolean isAllowPostRequestWithoutDoubleSubmitPrevention()\n    {\n        return true;\n    }\n\n    private void lazyInit()\n    {\n        if (this.initialized == null)\n        {\n            init();\n        }\n    }\n\n    protected synchronized void init()\n    {\n        if (this.initialized == null)\n        {\n            FacesContext facesContext = FacesContext.getCurrentInstance();\n\n            // can happen in case of a very simple test-setup without a mocked jsf container\n            if (facesContext == null)\n            {\n                this.delegatedWindowHandlingEnabled = false;\n            }\n            else\n            {\n                String initParam = facesContext.getExternalContext()\n                        .getInitParameter(ClientWindow.CLIENT_WINDOW_MODE_PARAM_NAME);\n                this.delegatedWindowHandlingEnabled =\n                        !(initParam == null || \"none\".equalsIgnoreCase(initParam.trim()));\n            }\n\n            this.initialized = true;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/base/JsfBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.config.base;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig;\nimport org.apache.deltaspike.core.api.config.base.CoreBaseConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\npublic interface JsfBaseConfig extends DeltaSpikeBaseConfig\n{\n    interface ViewConfigCustomization\n    {\n        String CUSTOM_DEFAULT_BASE_PATH_BUILDER = ConfigResolver.resolve(View.DefaultBasePathBuilder.class.getName())\n                .withCurrentProjectStage(true)\n                .getValue();\n\n        String CUSTOM_DEFAULT_FILE_NAME_BUILDER = ConfigResolver.resolve(View.DefaultFileNameBuilder.class.getName())\n                .withCurrentProjectStage(true)\n                .getValue();\n\n        String CUSTOM_DEFAULT_EXTENSION_BUILDER = ConfigResolver.resolve(View.DefaultExtensionBuilder.class.getName())\n                .withCurrentProjectStage(true)\n                .getValue();\n\n        String CUSTOM_DEFAULT_FOLDER_NAME_BUILDER = ConfigResolver\n                .resolve(Folder.DefaultFolderNameBuilder.class.getName())\n                .withCurrentProjectStage(true)\n                .getValue();\n    }\n\n    interface ScopeCustomization\n    {\n        interface WindowRestriction\n        {\n            int ID_MAX_LENGTH_DEFAULT = 10;\n\n            Integer MAX_COUNT =\n                ConfigResolver.resolve(CoreBaseConfig.ScopeCustomization.WindowRestriction.MAX_COUNT_KEY)\n                    .as(Integer.class)\n                    .withCurrentProjectStage(true)\n                    .withDefault(64)\n                    .getValue();\n\n            //10 is enough for the integer generated by DefaultClientWindow#generateNewWindowId - see DELTASPIKE-752\n            Integer ID_MAX_LENGTH = ConfigResolver.resolve(\"deltaspike.window-id.max_length\")\n                    .as(Integer.class)\n                    .withCurrentProjectStage(true)\n                    .withDefault(ID_MAX_LENGTH_DEFAULT)\n                    .getValue();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/view/Folder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.SkipMetaDataMerge;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;\nimport org.apache.deltaspike.jsf.api.literal.FolderLiteral;\nimport org.apache.deltaspike.jsf.util.NamingConventionUtils;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.Iterator;\nimport java.util.Set;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Optional annotation to specify folder specific meta-data\n */\n\n//don't use @Inherited\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData(preProcessor = Folder.FolderConfigPreProcessor.class)\npublic @interface Folder\n{\n    /**\n     * Allows to specify a custom (folder-)name\n     *\n     * @return name of the folder\n     */\n    @SkipMetaDataMerge\n    String name() default \".\";\n\n    /**\n     * Allows to add a custom inline path-builder\n     * (a custom default implementation can be configured globally via the config mechanism provided by DeltaSpike)\n     * @return path builder which allows to customize the naming conventions for the folder-name\n     */\n    Class<? extends NameBuilder> folderNameBuilder() default DefaultFolderNameBuilder.class;\n\n    static class FolderConfigPreProcessor implements ConfigPreProcessor<Folder>\n    {\n        @Override\n        public Folder beforeAddToConfig(Folder folder, ViewConfigNode viewConfigNode)\n        {\n            boolean defaultValueReplaced = false;\n\n            /*\n             * file name\n             */\n            NameBuilder folderNameBuilder = getFolderNameBuilder(folder);\n            String name = folderNameBuilder.build(folder, viewConfigNode);\n\n            if (folderNameBuilder.isDefaultValueReplaced())\n            {\n                defaultValueReplaced = true;\n            }\n\n            if (defaultValueReplaced)\n            {\n                Folder result = new FolderLiteral(name, folder.folderNameBuilder());\n                updateNodeMetaData(viewConfigNode, result);\n                return result;\n            }\n            return folder;\n        }\n\n        private void updateNodeMetaData(ViewConfigNode viewConfigNode, Folder folder)\n        {\n            Set<Annotation> metaData = viewConfigNode.getMetaData();\n\n            Iterator<? extends Annotation> metaDataIterator = metaData.iterator();\n\n            while (metaDataIterator.hasNext())\n            {\n                if (Folder.class.equals(metaDataIterator.next().annotationType()))\n                {\n                    metaDataIterator.remove();\n                    break;\n                }\n            }\n            metaData.add(folder);\n        }\n\n        private NameBuilder getFolderNameBuilder(Folder folder)\n        {\n            NameBuilder folderNameBuilder;\n            if (DefaultFolderNameBuilder.class.equals(folder.folderNameBuilder()))\n            {\n                String customDefaultFolderNameBuilderClassName =\n                    JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_FOLDER_NAME_BUILDER;\n\n                if (customDefaultFolderNameBuilderClassName != null)\n                {\n                    folderNameBuilder =\n                        (NameBuilder) ClassUtils.tryToInstantiateClassForName(customDefaultFolderNameBuilderClassName);\n                }\n                else\n                {\n                    folderNameBuilder = new DefaultFolderNameBuilder();\n                }\n            }\n            else\n            {\n                folderNameBuilder = ClassUtils.tryToInstantiateClass(folder.folderNameBuilder());\n            }\n            return folderNameBuilder;\n        }\n    }\n\n    //TODO discuss if we use a central interface in the spi package\n    //advantage: can be reused\n    //disadvantage: a wrong builder can get assigned more easily, show usages will list more\n    interface NameBuilder\n    {\n        String build(Folder folder, ViewConfigNode viewConfigNode);\n\n        boolean isDefaultValueReplaced();\n    }\n\n    class DefaultFolderNameBuilder implements NameBuilder\n    {\n        private boolean defaultValueReplaced = false;\n\n        @Override\n        public String build(Folder folder, ViewConfigNode viewConfigNode)\n        {\n            String name = folder.name();\n\n            if (name == null /*null used as marker value for dyn. added instances*/ || \".\".equals(name) /*default*/)\n            {\n                name = NamingConventionUtils.toPath(viewConfigNode);\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (name != null && name.startsWith(\".\"))\n            {\n                name = NamingConventionUtils.toPath(viewConfigNode.getParent()) + name.substring(1);\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (name != null && !name.startsWith(\".\") && !name.startsWith(\"/\"))\n            {\n                name = NamingConventionUtils.toPath(viewConfigNode.getParent()) + name;\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (name != null && !name.endsWith(\"/\"))\n            {\n                name = name + \"/\";\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (name != null && name.contains(\"//\"))\n            {\n                name = name.replace(\"//\", \"/\");\n\n                this.defaultValueReplaced = true;\n            }\n\n            return name;\n        }\n\n        public boolean isDefaultValueReplaced()\n        {\n            return defaultValueReplaced;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/view/View.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.SkipMetaDataMerge;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;\nimport org.apache.deltaspike.jsf.api.literal.ViewLiteral;\nimport org.apache.deltaspike.jsf.util.NamingConventionUtils;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.lang.reflect.Modifier;\nimport java.util.Iterator;\nimport java.util.Set;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport static org.apache.deltaspike.jsf.api.config.view.View.Extension.XHTML;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.FORWARD;\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.EXCLUDE;\n\n/**\n * Optional annotation to specify page specific meta-data\n */\n\n//don't use @Inherited\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData(preProcessor = View.ViewConfigPreProcessor.class)\npublic @interface View\n{\n    /**\n     * Allows to specify a custom base-path for the page represented by the view-config\n     * @return base-path\n     */\n    @SkipMetaDataMerge\n    String basePath() default \"\";\n\n    /**\n     * Allows to specify a custom (file-)name for the page represented by the view-config\n     *\n     * @return name of the page\n     */\n    @SkipMetaDataMerge\n    String name() default \"\";\n\n    /**\n     * Allows to specify the (file-)extension for the page represented by the view-config\n     *\n     * @return extension of the page\n     */\n    String extension() default Extension.DEFAULT;\n\n    /**\n     * Allows to specify navigation-mode which should be used to navigate to the page represented by the view-config\n     *\n     * @return navigation-mode which should be used to navigate to the page represented by the view-config\n     */\n    NavigationMode navigation() default NavigationMode.DEFAULT;\n\n    /**\n     * for including view params in jsf2\n     *\n     * @return the strategy which should be used by jsf2 for handling view-parameters (for the navigation)\n     */\n    ViewParameterMode viewParams() default ViewParameterMode.DEFAULT;\n\n    /**\n     * Allows to add a custom inline path-builder\n     * (a custom default implementation can be configured globally via the config mechanism provided by DeltaSpike)\n     * @return path builder which allows to customize the naming conventions for the base-path\n     */\n    Class<? extends NameBuilder> basePathBuilder() default DefaultBasePathBuilder.class;\n\n    /**\n     * Allows to add a custom inline path-builder\n     * (a custom default implementation can be configured globally via the config mechanism provided by DeltaSpike)\n     * @return path builder which allows to customize the naming conventions for the file-name\n     */\n    Class<? extends NameBuilder> fileNameBuilder() default DefaultFileNameBuilder.class;\n\n    /**\n     * Allows to add a custom inline path-builder\n     * (a custom default implementation can be configured globally via the config mechanism provided by DeltaSpike)\n     * @return path builder which allows to customize the naming conventions for the file-extension\n     */\n    Class<? extends NameBuilder> extensionBuilder() default DefaultExtensionBuilder.class;\n\n    /**\n     * Extension of the markup file\n     */\n    interface Extension\n    {\n        String DEFAULT = \"\";\n        String XHTML = \"xhtml\";\n        String JSF = \"jsf\";\n        String FACES = \"faces\";\n        String JSP = \"jsp\";\n    }\n\n    /**\n     * Type of the navigation which should be used by the {@link jakarta.faces.application.NavigationHandler}\n     */\n    enum NavigationMode\n    {\n        DEFAULT, FORWARD, REDIRECT\n    }\n\n    /**\n     * Mode specifies if JSF2 should include view-params\n     */\n    enum ViewParameterMode\n    {\n        DEFAULT, INCLUDE, EXCLUDE\n    }\n\n    static class ViewConfigPreProcessor implements ConfigPreProcessor<View>\n    {\n        @Override\n        public View beforeAddToConfig(View view, ViewConfigNode viewConfigNode)\n        {\n            validateViewMetaData(view, viewConfigNode);\n\n            boolean defaultValueReplaced = false;\n\n            View.NavigationMode navigation = view.navigation();\n            View.ViewParameterMode viewParams = view.viewParams();\n\n            /*\n             * base path\n             */\n            NameBuilder basePathBuilder = getBasePathBuilder(view);\n            String basePath = basePathBuilder.build(view, viewConfigNode);\n\n            if (basePathBuilder.isDefaultValueReplaced())\n            {\n                defaultValueReplaced = true;\n            }\n\n            /*\n             * file name\n             */\n            NameBuilder fileNameBuilder = getFileNameBuilder(view);\n            String name = fileNameBuilder.build(view, viewConfigNode);\n\n            if (fileNameBuilder.isDefaultValueReplaced())\n            {\n                defaultValueReplaced = true;\n            }\n\n            /*\n             * extension\n             */\n            NameBuilder extensionBuilder = getExtensionBuilder(view);\n            String extension = extensionBuilder.build(view, viewConfigNode);\n\n            if (extensionBuilder.isDefaultValueReplaced())\n            {\n                defaultValueReplaced = true;\n            }\n\n            /*\n             * navigation\n             */\n            if (View.NavigationMode.DEFAULT.equals(navigation) || navigation == null)\n            {\n                defaultValueReplaced = true;\n                navigation = FORWARD;\n            }\n\n            if (View.ViewParameterMode.DEFAULT.equals(viewParams) || viewParams == null)\n            {\n                defaultValueReplaced = true;\n                viewParams = EXCLUDE;\n            }\n\n            if (defaultValueReplaced)\n            {\n                View result = new ViewLiteral(basePath, name, extension, navigation, viewParams,\n                        view.basePathBuilder(), view.fileNameBuilder(), view.extensionBuilder());\n                updateNodeMetaData(viewConfigNode, result);\n                return result;\n            }\n            return view;\n        }\n\n        protected void validateViewMetaData(View view, ViewConfigNode viewConfigNode)\n        {\n            String basePath = view.basePath();\n            if (viewConfigNode.getSource().isInterface() && !\"\".equals(basePath) && basePath != null)\n            {\n                throw new IllegalStateException(\"Using @\" + View.class.getName() + \"#basePath isn't allowed on\" +\n                    \" folder-nodes (= interfaces). Use @\" + Folder.class.getName() + \" for intended folder-nodes\" +\n                    \" or a class instead of the interface for page-nodes.\");\n            }\n        }\n\n        private void updateNodeMetaData(ViewConfigNode viewConfigNode, View view)\n        {\n            Set<Annotation> metaData = viewConfigNode.getMetaData();\n\n            Iterator<? extends Annotation> metaDataIterator = metaData.iterator();\n\n            while (metaDataIterator.hasNext())\n            {\n                if (View.class.equals(metaDataIterator.next().annotationType()))\n                {\n                    metaDataIterator.remove();\n                    break;\n                }\n            }\n            metaData.add(view);\n        }\n\n        private NameBuilder getBasePathBuilder(View view)\n        {\n            NameBuilder basePathBuilder;\n            if (DefaultBasePathBuilder.class.equals(view.basePathBuilder()))\n            {\n                String customDefaultBasePathBuilderClassName =\n                    JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_BASE_PATH_BUILDER;\n\n                if (customDefaultBasePathBuilderClassName != null)\n                {\n                    basePathBuilder =\n                        (NameBuilder)ClassUtils.tryToInstantiateClassForName(customDefaultBasePathBuilderClassName);\n                }\n                else\n                {\n                    basePathBuilder = new DefaultBasePathBuilder();\n                }\n            }\n            else\n            {\n                basePathBuilder = ClassUtils.tryToInstantiateClass(view.basePathBuilder());\n            }\n            return basePathBuilder;\n        }\n\n        private NameBuilder getFileNameBuilder(View view)\n        {\n            NameBuilder fileNameBuilder;\n            if (DefaultFileNameBuilder.class.equals(view.fileNameBuilder()))\n            {\n                String customDefaultFileNameBuilderClassName =\n                    JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_FILE_NAME_BUILDER;\n\n                if (customDefaultFileNameBuilderClassName != null)\n                {\n                    fileNameBuilder =\n                        (NameBuilder)ClassUtils.tryToInstantiateClassForName(customDefaultFileNameBuilderClassName);\n                }\n                else\n                {\n                    fileNameBuilder = new DefaultFileNameBuilder();\n                }\n            }\n            else\n            {\n                fileNameBuilder = ClassUtils.tryToInstantiateClass(view.fileNameBuilder());\n            }\n            return fileNameBuilder;\n        }\n\n        private NameBuilder getExtensionBuilder(View view)\n        {\n            NameBuilder extensionBuilder;\n            if (DefaultExtensionBuilder.class.equals(view.extensionBuilder()))\n            {\n                String customDefaultExtensionBuilderClassName =\n                    JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_EXTENSION_BUILDER;\n\n                if (customDefaultExtensionBuilderClassName != null)\n                {\n                    extensionBuilder =\n                        (NameBuilder)ClassUtils.tryToInstantiateClassForName(customDefaultExtensionBuilderClassName);\n                }\n                else\n                {\n                    extensionBuilder = new DefaultExtensionBuilder();\n                }\n            }\n            else\n            {\n                extensionBuilder = ClassUtils.tryToInstantiateClass(view.extensionBuilder());\n            }\n            return extensionBuilder;\n        }\n\n        //it's possible that the given source is a folder-node\n        //e.g. @View(navigation = REDIRECT) specified for a whole folder\n        private static boolean isView(Class source)\n        {\n            return !Modifier.isAbstract(source.getModifiers()) && !Modifier.isInterface(source.getModifiers());\n        }\n    }\n\n    //TODO discuss if we use a central interface in the spi package\n    //advantage: can be reused\n    //disadvantage: a wrong builder can get assigned more easily, show usages will list more\n    interface NameBuilder\n    {\n        String build(View view, ViewConfigNode viewConfigNode);\n\n        boolean isDefaultValueReplaced();\n    }\n\n    abstract class AbstractNameBuilder implements NameBuilder\n    {\n        protected boolean defaultValueReplaced = false;\n\n        public boolean isDefaultValueReplaced()\n        {\n            return defaultValueReplaced;\n        }\n    }\n\n    class DefaultBasePathBuilder extends AbstractNameBuilder\n    {\n        @Override\n        public String build(View view, ViewConfigNode viewConfigNode)\n        {\n            String basePath = view.basePath();\n            Class source = viewConfigNode.getSource();\n\n            if ((\"\".equals(basePath) || basePath == null) &&\n                    ViewConfigPreProcessor.isView(source) /*only calc the path for real pages*/)\n            {\n                this.defaultValueReplaced = true;\n\n                basePath = NamingConventionUtils.toPath(viewConfigNode.getParent());\n            }\n\n            if (basePath != null && basePath.startsWith(\".\"))\n            {\n                basePath = NamingConventionUtils.toPath(viewConfigNode.getParent()) + basePath.substring(1);\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (basePath != null && !basePath.startsWith(\".\") && !basePath.startsWith(\"/\"))\n            {\n                basePath = NamingConventionUtils.toPath(viewConfigNode.getParent()) + basePath;\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (basePath != null && !basePath.endsWith(\"/\"))\n            {\n                basePath = basePath + \"/\";\n\n                this.defaultValueReplaced = true;\n            }\n\n            if (basePath != null && basePath.contains(\"//\"))\n            {\n                basePath = basePath.replace(\"//\", \"/\");\n\n                this.defaultValueReplaced = true;\n            }\n\n            return basePath;\n        }\n    }\n\n    class DefaultFileNameBuilder extends AbstractNameBuilder\n    {\n        @Override\n        public String build(View view, ViewConfigNode viewConfigNode)\n        {\n            String name = view.name();\n            Class source = viewConfigNode.getSource();\n\n            if ((\"\".equals(name) || name == null) &&\n                    ViewConfigPreProcessor.isView(source) /*only calc the path for real pages*/)\n            {\n                this.defaultValueReplaced = true;\n                String className = viewConfigNode.getSource().getSimpleName();\n                name = className.substring(0, 1).toLowerCase() + className.substring(1);\n            }\n\n            return name;\n        }\n    }\n\n    class DefaultExtensionBuilder extends AbstractNameBuilder\n    {\n        @Override\n        public String build(View view, ViewConfigNode viewConfigNode)\n        {\n            String extension = view.extension();\n\n            if (View.Extension.DEFAULT.equals(extension) || extension == null)\n            {\n                defaultValueReplaced = true;\n                extension = XHTML;\n            }\n\n            return extension;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/phase/AfterPhase.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.listener.phase;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Qualifier for after-request observers\n */\n\n@Target({ PARAMETER, FIELD, METHOD })\n@Retention(RUNTIME)\n@Documented\n\n@Qualifier\n\n/**\n * - for request-observer-methods\n * //TODO - for lifecycle callbacks in view-definitions\n *\n * Parameter-type of the observer: {@link jakarta.faces.event.PhaseEvent}\n */\npublic @interface AfterPhase\n{\n    /**\n     * {@link JsfPhaseId} which is the equivalent for the {@link jakarta.faces.event.PhaseId} value.\n     * For more details see {@link JsfPhaseId}\n     *\n     * @return request-id which defines the jsf-lifecycle-request to completely define this qualifier\n     */\n    JsfPhaseId value();\n}"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/phase/BeforePhase.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.listener.phase;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ PARAMETER, FIELD, METHOD })\n@Retention(RUNTIME)\n@Documented\n\n@Qualifier\n\n/**\n * - for request-observer-methods\n * //TODO - for lifecycle callbacks in view-definitions\n *\n * Parameter-type of the observer: {@link jakarta.faces.event.PhaseEvent}\n */\npublic @interface BeforePhase\n{\n    /**\n     * {@link JsfPhaseId} which is the equivalent for the {@link jakarta.faces.event.PhaseId} value.\n     * For more details see {@link JsfPhaseId}\n     *\n     * @return request-id which defines the jsf-lifecycle-request to completely define this qualifier\n     */\n    JsfPhaseId value();\n}"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/phase/JsfPhaseId.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.listener.phase;\n\n/**\n * It isn't possible to use the original implementation of JSF in combination with annotations\n */\npublic enum JsfPhaseId\n{\n    RESTORE_VIEW(jakarta.faces.event.PhaseId.RESTORE_VIEW),\n    APPLY_REQUEST_VALUES(jakarta.faces.event.PhaseId.APPLY_REQUEST_VALUES),\n    PROCESS_VALIDATIONS(jakarta.faces.event.PhaseId.PROCESS_VALIDATIONS),\n    UPDATE_MODEL_VALUES(jakarta.faces.event.PhaseId.UPDATE_MODEL_VALUES),\n    INVOKE_APPLICATION(jakarta.faces.event.PhaseId.INVOKE_APPLICATION),\n    RENDER_RESPONSE(jakarta.faces.event.PhaseId.RENDER_RESPONSE),\n    ANY_PHASE(jakarta.faces.event.PhaseId.ANY_PHASE);\n\n    private jakarta.faces.event.PhaseId phaseId;\n\n    JsfPhaseId(jakarta.faces.event.PhaseId phaseId)\n    {\n        this.phaseId = phaseId;\n    }\n\n    /**\n     * Converts the jsf implementation to the ds implementation\n     *\n     * @param phaseId current request-id which has to be converted\n     * @return ds implementation for the given request-id\n     */\n    public static JsfPhaseId convertFromFacesClass(jakarta.faces.event.PhaseId phaseId)\n    {\n        if (RESTORE_VIEW.getPhaseId().equals(phaseId))\n        {\n            return RESTORE_VIEW;\n        }\n\n        if (RENDER_RESPONSE.getPhaseId().equals(phaseId))\n        {\n            return RENDER_RESPONSE;\n        }\n\n        if (APPLY_REQUEST_VALUES.getPhaseId().equals(phaseId))\n        {\n            return APPLY_REQUEST_VALUES;\n        }\n\n        if (PROCESS_VALIDATIONS.getPhaseId().equals(phaseId))\n        {\n            return PROCESS_VALIDATIONS;\n        }\n\n        if (UPDATE_MODEL_VALUES.getPhaseId().equals(phaseId))\n        {\n            return UPDATE_MODEL_VALUES;\n        }\n\n        if (INVOKE_APPLICATION.getPhaseId().equals(phaseId))\n        {\n            return INVOKE_APPLICATION;\n        }\n\n        return null;\n    }\n\n    jakarta.faces.event.PhaseId getPhaseId()\n    {\n        return phaseId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/phase/JsfPhaseListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.listener.phase;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Annotation for implementations of {@link jakarta.faces.event.PhaseListener}.\n */\n\n@Target(TYPE)\n@Retention(RUNTIME)\n@Inherited\n@Documented\n\n@Stereotype\npublic @interface JsfPhaseListener\n{\n    /**\n     * @return ordinal for invocation-order - higher ordinals first\n     */\n    int ordinal() default 1000; //aligned with value in BaseConfigSource\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/literal/FolderLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jsf.api.literal;\n\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link Folder}\n */\n//TODO remove null trick once we can merge with default values and the tests pass\npublic class FolderLiteral extends AnnotationLiteral<Folder> implements Folder\n{\n    private static final long serialVersionUID = 2582580975876369665L;\n\n    private final String name;\n    private final Class<? extends NameBuilder> folderNameBuilder;\n\n    public FolderLiteral(boolean virtual)\n    {\n        if (virtual)\n        {\n            this.name = null;\n        }\n        else\n        {\n            this.name = \"\";\n        }\n\n        final String customDefaultFolderNameBuilderClassName =\n            JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_FOLDER_NAME_BUILDER;\n\n        if (customDefaultFolderNameBuilderClassName != null)\n        {\n            this.folderNameBuilder = ClassUtils.tryToLoadClassForName(customDefaultFolderNameBuilderClassName);\n        }\n        else\n        {\n            this.folderNameBuilder = DefaultFolderNameBuilder.class;\n        }\n    }\n\n    public FolderLiteral(String name, Class<? extends NameBuilder> folderNameBuilder)\n    {\n        this.name = name;\n        this.folderNameBuilder = folderNameBuilder;\n    }\n\n    @Override\n    public String name()\n    {\n        return this.name;\n    }\n\n    @Override\n    public Class<? extends NameBuilder> folderNameBuilder()\n    {\n        return this.folderNameBuilder;\n    }\n\n    /*\n    * generated\n    */\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n        if (!(o instanceof FolderLiteral))\n        {\n            return false;\n        }\n        if (!super.equals(o))\n        {\n            return false;\n        }\n\n        FolderLiteral that = (FolderLiteral) o;\n\n        if (!folderNameBuilder.equals(that.folderNameBuilder))\n        {\n            return false;\n        }\n        if (name != null ? !name.equals(that.name) : that.name != null)\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        int result = name != null ? name.hashCode() : 0;\n        result = 31 * result + folderNameBuilder.hashCode();\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/literal/ViewLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.jsf.api.literal;\n\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Literal for {@link org.apache.deltaspike.jsf.api.config.view.View}\n */\n//TODO remove null trick once we can merge with default values and the tests pass\npublic class ViewLiteral extends AnnotationLiteral<View> implements View\n{\n    private static final long serialVersionUID = 1582580975876369665L;\n\n    private final String basePath;\n    private final String name;\n    private final String extension;\n    private final NavigationMode navigation;\n    private final ViewParameterMode viewParams;\n\n    private final Class<? extends NameBuilder> basePathBuilder;\n    private final Class<? extends NameBuilder> fileNameBuilder;\n    private final Class<? extends NameBuilder> extensionBuilder;\n\n    public ViewLiteral(boolean virtual)\n    {\n        if (virtual)\n        {\n            this.basePath = null;\n            this.name = null;\n            this.extension = null;\n            this.navigation = null;\n            this.viewParams = null;\n        }\n        else\n        {\n            this.basePath = \"\";\n            this.name = \"\";\n            this.extension = Extension.DEFAULT;\n            this.navigation = NavigationMode.FORWARD;\n            this.viewParams = ViewParameterMode.DEFAULT;\n        }\n\n        final String customDefaultBasePathBuilderClassName =\n            JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_BASE_PATH_BUILDER;\n\n        if (customDefaultBasePathBuilderClassName != null)\n        {\n            this.basePathBuilder = ClassUtils.tryToLoadClassForName(customDefaultBasePathBuilderClassName);\n        }\n        else\n        {\n            this.basePathBuilder = DefaultBasePathBuilder.class;\n        }\n\n\n        final String customDefaultFileNameBuilderClassName =\n            JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_FILE_NAME_BUILDER;\n\n        if (customDefaultFileNameBuilderClassName != null)\n        {\n            this.fileNameBuilder = ClassUtils.tryToLoadClassForName(customDefaultFileNameBuilderClassName);\n        }\n        else\n        {\n            this.fileNameBuilder = DefaultFileNameBuilder.class;\n        }\n\n\n        final String customDefaultExtensionBuilderClassName =\n            JsfBaseConfig.ViewConfigCustomization.CUSTOM_DEFAULT_EXTENSION_BUILDER;\n\n        if (customDefaultExtensionBuilderClassName != null)\n        {\n            this.extensionBuilder = ClassUtils.tryToLoadClassForName(customDefaultExtensionBuilderClassName);\n        }\n        else\n        {\n            this.extensionBuilder = DefaultExtensionBuilder.class;\n        }\n    }\n\n    public ViewLiteral(String basePath,\n                       String name,\n                       String extension,\n                       NavigationMode navigation,\n                       ViewParameterMode viewParams,\n                       Class<? extends NameBuilder> basePathBuilder,\n                       Class<? extends NameBuilder> fileNameBuilder,\n                       Class<? extends NameBuilder> extensionBuilder)\n    {\n        this.basePath = basePath;\n        this.name = name;\n        this.extension = extension;\n        this.navigation = navigation;\n        this.viewParams = viewParams;\n        this.basePathBuilder = basePathBuilder;\n        this.fileNameBuilder = fileNameBuilder;\n        this.extensionBuilder = extensionBuilder;\n    }\n\n    @Override\n    public String basePath()\n    {\n        return this.basePath;\n    }\n\n    @Override\n    public String name()\n    {\n        return this.name;\n    }\n\n    @Override\n    public String extension()\n    {\n        return this.extension;\n    }\n\n    @Override\n    public NavigationMode navigation()\n    {\n        return this.navigation;\n    }\n\n    @Override\n    public ViewParameterMode viewParams()\n    {\n        return this.viewParams;\n    }\n\n    @Override\n    public Class<? extends NameBuilder> basePathBuilder()\n    {\n        return this.basePathBuilder;\n    }\n\n    @Override\n    public Class<? extends NameBuilder> fileNameBuilder()\n    {\n        return this.fileNameBuilder;\n    }\n\n    @Override\n    public Class<? extends NameBuilder> extensionBuilder()\n    {\n        return this.extensionBuilder;\n    }\n\n    /*\n     * generated\n     */\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n        if (!(o instanceof ViewLiteral))\n        {\n            return false;\n        }\n        if (!super.equals(o))\n        {\n            return false;\n        }\n\n        ViewLiteral that = (ViewLiteral) o;\n\n        if (basePath != null ? !basePath.equals(that.basePath) : that.basePath != null)\n        {\n            return false;\n        }\n        if (!basePathBuilder.equals(that.basePathBuilder))\n        {\n            return false;\n        }\n        if (extension != null ? !extension.equals(that.extension) : that.extension != null)\n        {\n            return false;\n        }\n        if (!extensionBuilder.equals(that.extensionBuilder))\n        {\n            return false;\n        }\n        if (!fileNameBuilder.equals(that.fileNameBuilder))\n        {\n            return false;\n        }\n        if (name != null ? !name.equals(that.name) : that.name != null)\n        {\n            return false;\n        }\n        if (navigation != that.navigation)\n        {\n            return false;\n        }\n        if (viewParams != that.viewParams)\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        int result = (basePath != null ? basePath.hashCode() : 0);\n        result = 31 * result + (name != null ? name.hashCode() : 0);\n        result = 31 * result + (extension != null ? extension.hashCode() : 0);\n        result = 31 * result + (navigation != null ? navigation.hashCode() : 0);\n        result = 31 * result + (viewParams != null ? viewParams.hashCode() : 0);\n        result = 31 * result + basePathBuilder.hashCode();\n        result = 31 * result + fileNameBuilder.hashCode();\n        result = 31 * result + extensionBuilder.hashCode();\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/message/JsfMessage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.api.message;\n\nimport jakarta.faces.component.UIComponent;\nimport java.io.Serializable;\n\n/**\n * <p>An injectable component for typesafe FacesMessages.\n * T must be a class which is annotated with\n * {@link org.apache.deltaspike.core.api.message.MessageBundle}</p>\n *\n * <p>Usage:\n * <pre>\n * &#064;Inject\n * JsfMessage&lt;MyMessages&gt; msg;\n * ...\n * msg.addError().userNotLoggedIn(user);\n * </pre>\n * <p>MessageBundle methods which are used as JsfMessage can return a\n * {@link org.apache.deltaspike.core.api.message.Message} or a String.\n * In case of a String we use it for both the summary and detail\n * information on the FacesMessage. </p>\n * <p>If a Message is returned, we lookup the 'detail' and 'summary'\n * categories (see {@link org.apache.deltaspike.core.api.message.Message#toString(String)}\n * for creating the FacesMessage.</p>\n *\n */\npublic interface JsfMessage<T> extends Serializable\n{\n    String CATEGORY_DETAIL = \"detail\";\n    String CATEGORY_SUMMARY = \"summary\";\n\n    /**\n     * If the JsfMessage is used in a UIComponent we allow to set the clientId\n     * @param clientId\n     */\n    JsfMessage<T> forClientId(String clientId);\n\n    /**\n     * @param uiComponent\n     */\n    JsfMessage<T> forComponent(UIComponent uiComponent);\n\n    /**\n     * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_ERROR\n     */\n    T addError();\n\n    /**\n     * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_FATAL\n     */\n    T addFatal();\n\n    /**\n     * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_INFO\n     */\n    T addInfo();\n\n    /**\n     * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_WARN\n     */\n    T addWarn();\n\n    /**\n     * @return the underlying Message implementation without adding any FacesMessage\n     */\n    T get();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/config/view/navigation/NavigationParameterStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.spi.config.view.navigation;\n\nimport org.apache.deltaspike.core.spi.InterceptorStrategy;\n\n/**\n * Allows to provide a custom {@link InterceptorStrategy}\n */\npublic interface NavigationParameterStrategy extends InterceptorStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/ClientWindowConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.spi.scope.window;\n\nimport jakarta.faces.context.FacesContext;\nimport java.io.Serializable;\n\n/**\n * Configuration for ClientWindow handler which is used\n * to determine the correct windowId for &#063;WindowScoped beans.\n */\npublic interface ClientWindowConfig extends Serializable\n{\n    public enum ClientWindowRenderMode\n    {\n        /**\n         * Any window or browser tab detection is disabled for this request\n         */\n        NONE,\n\n        /**\n         * <p>The GET request results in an intermediate small html page which\n         * checks if the browser tab fits the selected windowId</p>\n         * <p>The ClientWindow html extracts the windowId from the window.name and\n         * enforces a 2nd GET which will contain the windowId and will get routed\n         * through to the target JSF page.</p>\n         */\n        CLIENTWINDOW,\n\n        /**\n         * Render each GET request with the windowId you get during the request\n         * and perform a lazy check on the client side via JavaScript or similar.\n         */\n        LAZY,\n\n        /**\n         * Delegates to the default window-handling\n         */\n        DELEGATED,\n    }\n\n    /**\n     * @return whether JavaScript is enabled\n     */\n    boolean isJavaScriptEnabled();\n\n    /**\n     * @param javaScriptEnabled whether JavaScript is enabled\n     */\n    void setJavaScriptEnabled(boolean javaScriptEnabled);\n\n    /**\n     * Determine whether this request should take care of clientWindow detection.\n     * This can e.g. get disabled for download pages or if a useragent doesn't\n     * support html5 or any other required technique.\n     * This only gets checked for GET requests!\n     *\n     * @param facesContext\n     * @return the selected ClientWindowRenderMode\n     */\n    ClientWindowRenderMode getClientWindowRenderMode(FacesContext facesContext);\n\n    /**\n     * @return the prepared html which gets sent out to the client as intermediate client window.\n     */\n    String getClientWindowHtml();\n\n    /**\n     * @return Whether the DOM tree should store in the localStorage for the windowhandler.html\n     *         when clicking on a link.\n     *         Currently, it's only used by {@link ClientWindowRenderMode#CLIENTWINDOW}.\n     * See windowhandler.html\n     */\n    boolean isClientWindowStoreWindowTreeEnabledOnLinkClick();\n\n    /**\n     * @return Whether the DOM tree should store in the localStorage for the windowhandler.html\n     *         when clicking on a button.\n     *         Currently, it's only used by {@link ClientWindowRenderMode#CLIENTWINDOW}.\n     * See windowhandler.html\n     */\n    boolean isClientWindowStoreWindowTreeEnabledOnButtonClick();\n\n    boolean isClientWindowTokenizedRedirectEnabled();\n    \n    /**\n     * Restricts the number of active windows.\n     *\n     * @return limit for active windows\n     */\n    int getMaxWindowContextCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.spi.scope.window;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.inject.Inject;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Map;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\nimport org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;\nimport org.apache.deltaspike.jsf.util.ValueExpressionEvaluationInputStream;\n\n/**\n * <p>Default implementation of {@link ClientWindowConfig}.\n * By default it will use the internal <code>windowhandler.html</code></p>\n *\n * <p>You can &#064;Specializes this class to tweak the configuration or\n * provide a completely new implementation as &#064;Alternative.</p>\n */\n@SessionScoped\npublic class DefaultClientWindowConfig implements ClientWindowConfig\n{\n    private static final long serialVersionUID = -708423418378550210L;\n\n    /**\n     * The location of the default windowhandler resource\n     */\n    private static final String DEFAULT_WINDOW_HANDLER_HTML_FILE = \"static/windowhandler.html\";\n\n\n    private volatile Boolean javaScriptEnabled = null;\n\n    /**\n     * lazily initiated via {@link #getUserAgent(jakarta.faces.context.FacesContext)}\n     */\n    private volatile String userAgent = null;\n\n    /**\n     * Contains the cached ClientWindow handler html for this session.\n     */\n    private String clientWindowtml;\n\n    @Inject\n    private JsfModuleConfig jsfModuleConfig;\n\n    @Inject\n    private ProjectStage projectStage;\n\n    private ClientWindowRenderMode defaultClientWindowRenderMode;\n    private int maxWindowContextCount;\n\n    @PostConstruct\n    protected void init()\n    {\n        this.defaultClientWindowRenderMode = this.jsfModuleConfig.getDefaultWindowMode();\n        this.maxWindowContextCount = JsfBaseConfig.ScopeCustomization.WindowRestriction.MAX_COUNT;\n    }\n\n    @Override\n    public boolean isJavaScriptEnabled()\n    {\n        if (javaScriptEnabled == null)\n        {\n            synchronized (this)\n            {\n                // double lock checking idiom on volatile variable works since java5\n                if (javaScriptEnabled == null)\n                {\n                    // no info means that it is default -> true\n                    javaScriptEnabled = Boolean.TRUE;\n                }\n            }\n        }\n        return javaScriptEnabled;\n    }\n\n\n    @Override\n    public void setJavaScriptEnabled(boolean javaScriptEnabled)\n    {\n        this.javaScriptEnabled = Boolean.valueOf(javaScriptEnabled);\n    }\n\n    /**\n     * By default we use {@link ClientWindowRenderMode#LAZY} unless\n     * we detect a bot. Use {@link org.apache.deltaspike.jsf.api.config.JsfModuleConfig#getDefaultWindowMode()}\n     * to change this default behavior. Alternative:\n     * Override this method to exclude other requests from getting accessed.\n     */\n    @Override\n    public ClientWindowRenderMode getClientWindowRenderMode(FacesContext facesContext)\n    {\n        if (!isJavaScriptEnabled())\n        {\n            if (this.defaultClientWindowRenderMode != null)\n            {\n                return this.defaultClientWindowRenderMode; //currently mainly needed for 'DELEGATED'\n            }\n            return ClientWindowRenderMode.NONE;\n        }\n\n        String userAgent = getUserAgent(facesContext);\n\n        if (userAgent != null &&\n            ( userAgent.indexOf(\"bot\")     >= 0 || // Googlebot, etc\n              userAgent.indexOf(\"Bot\")     >= 0 || // BingBot, etc\n              userAgent.indexOf(\"Slurp\")   >= 0 || // Yahoo Slurp\n              userAgent.indexOf(\"Crawler\") >= 0    // various other Crawlers\n            ) )\n        {\n            return ClientWindowRenderMode.NONE;\n        }\n\n        if (this.defaultClientWindowRenderMode != null)\n        {\n            return this.defaultClientWindowRenderMode;\n        }\n        return ClientWindowRenderMode.LAZY;\n    }\n\n    @Override\n    public String getClientWindowHtml()\n    {\n        if (projectStage != ProjectStage.Development && clientWindowtml != null)\n        {\n            // use cached windowHandlerHtml except in Development\n            return clientWindowtml;\n        }\n\n        InputStream is = ClassUtils.getClassLoader(null).getResourceAsStream(getClientWindowResourceLocation());\n        // wrap InputStream to evaluate EL expressions like resource includes\n        is = new ValueExpressionEvaluationInputStream(FacesContext.getCurrentInstance(), is);\n        StringBuffer sb = new StringBuffer();\n        try\n        {\n            byte[] buf = new byte[16 * 1024];\n            int bytesRead;\n            while ((bytesRead = is.read(buf)) != -1)\n            {\n                String sbuf = new String(buf, 0, bytesRead);\n                sb.append(sbuf);\n            }\n        }\n        catch (IOException e)\n        {\n            ExceptionUtils.throwAsRuntimeException(e);\n        }\n        finally\n        {\n            try\n            {\n                is.close();\n            }\n            catch (IOException e)\n            {\n                // do nothing, all fine so far\n            }\n        }\n\n        clientWindowtml = sb.toString();\n\n        return clientWindowtml;\n    }\n\n    /**\n     * This information will get stored as it cannot\n     * change during the session anyway.\n     * @return the UserAgent of the request.\n     */\n    public String getUserAgent(FacesContext facesContext)\n    {\n        if (userAgent == null)\n        {\n            synchronized (this)\n            {\n                if (userAgent == null)\n                {\n                    Map<String, String[]> requestHeaders =\n                            facesContext.getExternalContext().getRequestHeaderValuesMap();\n\n                    if (requestHeaders != null &&\n                            requestHeaders.containsKey(\"User-Agent\"))\n                    {\n                        String[] userAgents = requestHeaders.get(\"User-Agent\");\n                        userAgent = userAgents.length > 0 ? userAgents[0] : null;\n                    }\n                }\n            }\n        }\n\n        return userAgent;\n    }\n\n\n    /**\n     * Overwrite this to define your own ClientWindow handler html location.\n     * This will get picked up as resource from the classpath.\n     */\n    public String getClientWindowResourceLocation()\n    {\n        return DEFAULT_WINDOW_HANDLER_HTML_FILE;\n    }\n\n    @Override\n    public int getMaxWindowContextCount()\n    {\n        return this.maxWindowContextCount;\n    }\n\n    @Override\n    public boolean isClientWindowStoreWindowTreeEnabledOnLinkClick()\n    {\n        return true;\n    }\n\n    @Override\n    public boolean isClientWindowStoreWindowTreeEnabledOnButtonClick()\n    {\n        return false;\n    }\n    \n    @Override\n    public boolean isClientWindowTokenizedRedirectEnabled()\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/util/NamingConventionUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.util;\n\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\n\nimport java.lang.annotation.Annotation;\n\npublic abstract class NamingConventionUtils\n{\n    public static String toPath(ViewConfigNode node)\n    {\n        if (node == null || node.getParent() == null) //root-node\n        {\n            return \"/\";\n        }\n\n        Folder folderMetaData = null;\n\n        for (Annotation nodeMetaData : node.getMetaData())\n        {\n            if (Folder.class.isAssignableFrom(nodeMetaData.annotationType()))\n            {\n                folderMetaData = (Folder)nodeMetaData;\n                break;\n            }\n        }\n\n\n        String folderName = null;\n\n        if (folderMetaData != null)\n        {\n            folderName = folderMetaData.name();\n        }\n\n        if (\".\".equals(folderName))\n        {\n            folderName = null; //default value -> fallback to the default naming\n        }\n\n        if (folderName == null)\n        {\n            folderName = node.getSource().getSimpleName();\n            folderName = \"./\" + folderName.substring(0, 1).toLowerCase() + folderName.substring(1) + \"/\";\n        }\n\n        //@Folder found and no relative path\n        if (folderMetaData != null && !folderName.startsWith(\".\"))\n        {\n            return folderName;\n        }\n        return toPath(node.getParent()) + folderName.substring(1);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/util/ValueExpressionEvaluationInputStream.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.util;\n\nimport jakarta.faces.context.FacesContext;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PushbackInputStream;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.ListIterator;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * A filtered stream that evaluates value expressions in the original stream while reading from it.\n */\npublic class ValueExpressionEvaluationInputStream extends InputStream\n{\n\n    /**\n     * Logger for this class.\n     */\n    private static final Logger log = Logger.getLogger(ValueExpressionEvaluationInputStream.class.getName());\n\n    private FacesContext facesContext;\n    private PushbackInputStream wrapped;\n    private String currentValue;\n    private int currentValueIndex = -1;\n\n    public ValueExpressionEvaluationInputStream(FacesContext facesContext, InputStream inputStream)\n    {\n        this.facesContext = facesContext;\n        this.wrapped = new PushbackInputStream(inputStream, 512);\n    }\n\n    /**\n     * Reads a byte from the original stream and checks for value expression occurrences.\n     * A value expression has the following format: #{xxx}\n     * If a value expression is found, its occurrence in the stream will replaced with\n     * the evaluated value of the expression.\n     *\n     * @return\n     * @throws java.io.IOException\n     */\n    @Override\n    public int read() throws IOException\n    {\n        // check for a current value\n        if (currentValueIndex != -1)\n        {\n            if (currentValueIndex < currentValue.length())\n            {\n                return currentValue.charAt(currentValueIndex++);\n            }\n            else\n            {\n                // current value exhausted, reset index\n                currentValueIndex = -1;\n            }\n        }\n\n        // read byte and check for value expression begin\n        int c1 = wrapped.read();\n        if (c1 != '#')\n        {\n            return c1;  // can't be a value expression, just return the character\n        }\n        else\n        {\n            // could be a value expression, next character must be '{'\n            int c2 = wrapped.read();\n            if (c2 != '{')\n            {\n                wrapped.unread(c2);  // we did not find a value expression, unread byte that we read too much\n                return c1;   // return original character\n            }\n            else\n            {\n                // read until '}', '\\n' or eof occurs (end of value expression or data)\n                List<Integer> possibleValueExpression = new LinkedList<Integer>();\n                int c = wrapped.read();\n                boolean insideString = (c == '\\'');  // a '}' inside a string must not terminate the expression string\n                while (c != -1 && c != '\\n' && (insideString || c != '}'))\n                {\n                    possibleValueExpression.add(c);\n                    c = wrapped.read();\n                    if (c == '\\'')\n                    {\n                        insideString = !insideString;\n                    }\n                }\n\n                if (c != '}')\n                {\n                    // we did not find a value expression, unread bytes that we read too much (in reverse order)\n                    if (c != -1)  // we can't unread eof\n                    {\n                        wrapped.unread(c);\n                    }\n                    ListIterator<Integer> it = possibleValueExpression.listIterator(possibleValueExpression.size());\n                    while (it.hasPrevious())\n                    {\n                        wrapped.unread(it.previous());\n                    }\n                    wrapped.unread(c2);\n                    return c1; // return original character\n                }\n                else\n                {\n                    // we found a value expression #{xxx} (xxx is stored in possibleValueExpression)\n                    // create the expression string\n                    String expressionString = createExpressionString(possibleValueExpression);\n\n                    // evaluate it\n                    String expressionValue = facesContext.getApplication()\n                            .evaluateExpressionGet(facesContext, expressionString, String.class);\n\n                    if (expressionValue == null)\n                    {\n                        if (log.isLoggable(Level.WARNING))\n                        {\n                            log.warning(\"ValueExpression \" + expressionString + \" evaluated to null.\");\n                        }\n\n                        expressionValue = \"null\";  // fallback value for null\n                    }\n\n                    // do NOT unread the evaluated value, but rather store it in an internal buffer,\n                    // because otherwise we could recursively evaluate value expressions (a value expression\n                    // that resolves to a string containing \"#{...}\" would be re-evaluated).\n                    this.currentValue = expressionValue;\n\n                    // return first character of currentValue, if exists (not an empty string)\n                    if (currentValue.length() != 0)\n                    {\n                        this.currentValueIndex = 0;\n                        return currentValue.charAt(currentValueIndex++);\n                    }\n                    else  // currentValue is an empty string\n                    {\n                        // in this case we must recursively start a new read (incl. checks for a new value expression)\n                        this.currentValueIndex = -1;\n                        return read();\n                    }\n                }\n            }\n        }\n    }\n\n    private String createExpressionString(List<Integer> expressionList)\n    {\n        char[] expressionChars = new char[expressionList.size() + 3];  // #{expressionList}\n        int i = 0;\n\n        expressionChars[i++] = '#';\n        expressionChars[i++] = '{';\n        for (Integer c : expressionList)\n        {\n            expressionChars[i++] = (char) c.intValue();\n        }\n        expressionChars[i] = '}';\n\n        return String.valueOf(expressionChars);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/jsf/api/src/test/java/org/apache/deltaspike/jsf/util/ValueExpressionEvaluationInputStreamTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.util;\n\nimport org.junit.jupiter.api.Test;\n\nimport jakarta.faces.context.FacesContext;\nimport java.io.ByteArrayInputStream;\nimport org.apache.myfaces.test.base.junit.AbstractJsfTestCase;\nimport org.junit.jupiter.api.Assertions;\n\n/**\n * Tests for {@link ValueExpressionEvaluationInputStream}.\n */\npublic class ValueExpressionEvaluationInputStreamTest extends AbstractJsfTestCase\n{\n\n    @Test\n    public void testStreamWithoutExpression_mustBeUnmodified() throws Exception\n    {\n        final String data = \"aa\\nbbbb\\ncccc\\ndddd\\n\\n\";\n        byte[] dataArray = data.getBytes();\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[dataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(dataArray, inputStreamDataArray);  // data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n    @Test\n    public void testStreamWithSimpleExpression_mustBeEvaluated() throws Exception\n    {\n        final String data = \"aa\\nbbbb\\ncc#{requestScope.test}cc\\ndddd\\n\\n\";\n        final String evaluatedData = \"aa\\nbbbb\\ncctest-valuecc\\ndddd\\n\\n\";\n        byte[] dataArray = data.getBytes();\n        byte[] evaluatedDataArray = evaluatedData.getBytes();\n\n        // put test value into scope, so that expression can evaluate to this value\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"test-value\");\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[evaluatedDataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(evaluatedDataArray, inputStreamDataArray);  // evaluated data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n    @Test\n    public void testStreamWithHalfExpressionAtEnd_mustBeUnmodified() throws Exception\n    {\n        final String data = \"aa\\nbbbb\\ncccc\\ndddd\\n\\n#{requestScope.test\"; // } is missing at the end\n        byte[] dataArray = data.getBytes();\n\n        // put test value into scope, so that expression could evaluate to this value\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"test-value\");\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[dataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(dataArray, inputStreamDataArray);  // data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n    @Test\n    public void testStreamWithHalfExpressionAtLineEnd_mustBeUnmodified() throws Exception\n    {\n        final String data = \"aa\\nbb#{requestScope.test\\n}bb\\ncccc\\ndddd\\n\\n\"; // } is missing at the end\n        byte[] dataArray = data.getBytes();\n\n        // put test value into scope, so that expression could evaluate to this value\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"test-value\");\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[dataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(dataArray, inputStreamDataArray);  // data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n    @Test\n    public void testStreamWithExpressionEvaluatingToExpressionString_mustOnlyEvaluateFirstExpression() throws Exception\n    {\n        final String data = \"aa\\nbbbb\\ncc#{requestScope.test}cc\\ndddd\\n\\n\";\n        final String evaluatedData = \"aa\\nbbbb\\ncc#{requestScope.test2}cc\\ndddd\\n\\n\";\n        byte[] dataArray = data.getBytes();\n        byte[] evaluatedDataArray = evaluatedData.getBytes();\n\n        // put test value into scope, so that expression can evaluate to this value\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"#{requestScope.test2}\");\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test2\", \"test-value\");\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[evaluatedDataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(evaluatedDataArray, inputStreamDataArray);  // evaluated data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n    @Test\n    public void testStreamThatOnlyConsistsOfExpression_mustEvaluateExpression() throws Exception\n    {\n        final String data = \"#{requestScope.test}\";\n        final String evaluatedData = \"test-value\";\n        byte[] dataArray = data.getBytes();\n        byte[] evaluatedDataArray = evaluatedData.getBytes();\n\n        // put test value into scope, so that expression can evaluate to this value\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"test-value\");\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[evaluatedDataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(evaluatedDataArray, inputStreamDataArray);  // evaluated data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n    @Test\n    public void testStreamWithNullExpression_mustEvaluateToEmptyString() throws Exception\n    {\n        final String data = \"aa\\nbbbb\\ncc#{requestScope.test}cc\\ndddd\\n\\n\";\n        final String evaluatedData = \"aa\\nbbbb\\ncccc\\ndddd\\n\\n\";\n        byte[] dataArray = data.getBytes();\n        byte[] evaluatedDataArray = evaluatedData.getBytes();\n\n        // make sure there is no value\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().remove(\"test\");\n\n        ValueExpressionEvaluationInputStream inputStream = new ValueExpressionEvaluationInputStream(\n                FacesContext.getCurrentInstance(), new ByteArrayInputStream(dataArray));\n\n        byte[] inputStreamDataArray = new byte[evaluatedDataArray.length];\n        inputStream.read(inputStreamDataArray);\n\n        // checks\n        Assertions.assertArrayEquals(evaluatedDataArray, inputStreamDataArray);  // evaluated data arrays must match\n        Assertions.assertEquals(-1, inputStream.read()); // stream must be at eof\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>jsf-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jsf-module-impl</artifactId>\n\n    <name>Apache DeltaSpike JSF-Module Impl</name>\n\n    <properties>\n        <selenium.version>4.34.0</selenium.version>\n    </properties>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-resources-plugin</artifactId>\n                <version>2.6</version>\n                <executions>\n                    <execution>\n                        <phase>process-resources</phase>\n                        <goals>\n                            <goal>copy-resources</goal>\n                        </goals>\n                        <configuration>\n                            <includeEmptyDirs>true</includeEmptyDirs>\n                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/deltaspike-uncompressed</outputDirectory>\n                            <resources>\n                                <resource>\n                                    <directory>${project.build.directory}/classes/META-INF/resources/deltaspike</directory>\n                                </resource>\n                            </resources>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n            <plugin>\n                <groupId>org.primefaces.extensions</groupId>\n                <artifactId>resources-optimizer-maven-plugin</artifactId>\n                <version>1.0.0</version>\n                <executions>\n                    <execution>\n                        <phase>compile</phase>\n                        <goals>\n                            <goal>optimize</goal>\n                        </goals>\n                    </execution>\n                </executions>\n                <configuration>\n                    <inputDir>${project.build.directory}/classes/META-INF/resources/deltaspike/</inputDir>\n                    <resourceSets>\n                        <resourcesSet>\n                            <includes>\n                                <include>**/*.js</include>\n                                <include>**/*.css</include>\n                            </includes>\n                        </resourcesSet>\n                    </resourceSets>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-jsf-module-api</artifactId>\n            <version>${project.version}</version>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-proxy-module-impl-asm</artifactId>\n            <version>${project.version}</version>\n            <optional>true</optional>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.owasp.encoder</groupId>\n            <artifactId>encoder</artifactId>\n            <scope>compile</scope>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.el</groupId>\n            <artifactId>jakarta.el-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.jboss.arquillian.container</groupId>\n            <artifactId>arquillian-container-test-api</artifactId>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.arquillian.junit</groupId>\n            <artifactId>arquillian-junit-core</artifactId>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.arquillian.test</groupId>\n            <artifactId>arquillian-test-api</artifactId>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.shrinkwrap</groupId>\n            <artifactId>shrinkwrap-api</artifactId>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.seleniumhq.selenium</groupId>\n            <artifactId>htmlunit3-driver</artifactId>\n            <version>${selenium.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.seleniumhq.selenium</groupId>\n            <artifactId>selenium-api</artifactId>\n            <version>${selenium.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.seleniumhq.selenium</groupId>\n            <artifactId>selenium-support</artifactId>\n            <version>${selenium.version}</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <profiles>\n        <profile>\n            <id>tomee-build-managed</id>\n            <build>\n                <plugins>\n                    <!--\n                     * JSF-2.3 broke backward compatibility by trying to handle CDI beans themselves.\n                     * Some JSF annotations now have a 'managed' attribute, which must be set to true\n                     * to properly serve CDI Injection.\n                     * This cannot be done easily in unit tests which are backward compatible by design.\n                    -->\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <version>${maven.surefire.plugin.version}</version>\n                        <configuration>\n                            <excludes>\n                                <exclude>org/apache/deltaspike/test/jsf/impl/injection/**/*</exclude>\n                            </excludes>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n\n            <dependencies>\n                <!-- for debugging -->\n                <dependency>\n                    <groupId>org.apache.myfaces.core</groupId>\n                    <artifactId>myfaces-impl</artifactId>\n                    <version>${myfaces.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/clientwindow/ClientSideClientWindow.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.clientwindow;\n\nimport jakarta.faces.FacesException;\nimport jakarta.faces.context.ExternalContext;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.Collections;\nimport java.util.Map;\n\npublic class ClientSideClientWindow extends DeltaSpikeClientWindow\n{\n    /**\n     * Value which can be used as \"window-id\" by external clients which aren't aware of windows.\n     * It deactivates e.g. the redirect for the initial request.\n     */\n    private static final String AUTOMATED_ENTRY_POINT_PARAMETER_KEY = \"automatedEntryPoint\";\n\n    private static final String UNINITIALIZED_WINDOW_ID_VALUE = \"uninitializedWindowId\";\n    private static final String WINDOW_ID_REPLACE_PATTERN = \"$$windowIdValue$$\";\n    private static final String REQUEST_URL_REPLACE_PATTERN = \"$$requestUrl$$\";\n    private static final String NOSCRIPT_URL_REPLACE_PATTERN = \"$$noscriptUrl$$\";\n\n    /**\n     * Use this parameter to force a 'direct' request from the clients without any windowId detection\n     * We keep this name for backward compat with CODI.\n     */\n    private static final String NOSCRIPT_PARAMETER = \"mfDirect\";\n\n\n    @Override\n    public void decode(FacesContext facesContext)\n    {\n        boolean post = isPost(facesContext);\n\n        if (post)\n        {\n            id = getWindowIdPostParameter(facesContext);\n        }\n        else if (isNoscriptRequest(facesContext.getExternalContext()))\n        {\n            // the client has JavaScript disabled\n            getClientWindowConfig().setJavaScriptEnabled(false);\n\n            id = DEFAULT_WINDOW_ID;\n        }\n        else\n        {\n            id = getVerifiedWindowIdFromCookie(facesContext.getExternalContext());\n\n            boolean newWindowIdRequested = false;\n            if (AUTOMATED_ENTRY_POINT_PARAMETER_KEY.equals(id))\n            {\n                // this is a marker for generating a new windowId\n                id = generateNewWindowId();\n                newWindowIdRequested = true;\n            }\n\n            if (id == null || newWindowIdRequested)\n            {\n                // GET request without windowId - send windowhandlerfilter.html to get the windowId\n                sendWindowHandlerHtml(facesContext, facesContext.getExternalContext(), id);\n                facesContext.responseComplete();\n            }\n        }\n\n        id = sanitiseWindowId(id);\n    }\n\n    protected boolean isNoscriptRequest(ExternalContext externalContext)\n    {\n        String noscript = externalContext.getRequestParameterMap().get(NOSCRIPT_PARAMETER);\n\n        return (noscript != null && \"true\".equals(noscript));\n    }\n\n    protected void sendWindowHandlerHtml(FacesContext facesContext, ExternalContext externalContext, String windowId)\n    {\n        HttpServletResponse httpResponse = (HttpServletResponse) externalContext.getResponse();\n\n        try\n        {\n            httpResponse.setStatus(HttpServletResponse.SC_OK);\n            httpResponse.setContentType(\"text/html\");\n\n            String windowHandlerHtml = getClientWindowConfig().getClientWindowHtml();\n            if (windowId == null)\n            {\n                windowId = UNINITIALIZED_WINDOW_ID_VALUE;\n            }\n\n            // set the windowId value in the javascript code\n            windowHandlerHtml = windowHandlerHtml.replace(WINDOW_ID_REPLACE_PATTERN,\n                                                          org.owasp.encoder.Encode.forJavaScriptBlock(windowId));\n            // set the current request url\n            // on the client we can't use window.location as the location\n            // could be a different when using forwards\n            windowHandlerHtml = windowHandlerHtml.replace(REQUEST_URL_REPLACE_PATTERN,\n                                                          org.owasp.encoder.Encode.forJavaScriptBlock(\n                                                              ClientWindowHelper.constructRequestUrl(facesContext, externalContext)));\n            // set the noscript-URL for users with no JavaScript\n            windowHandlerHtml =\n                windowHandlerHtml.replace(NOSCRIPT_URL_REPLACE_PATTERN,\n                                          org.owasp.encoder.Encode.forHtmlAttribute(getNoscriptUrl(externalContext)));\n\n            OutputStream os = httpResponse.getOutputStream();\n            try\n            {\n                os.write(windowHandlerHtml.getBytes());\n            }\n            finally\n            {\n                os.close();\n            }\n        }\n        catch (IOException ioe)\n        {\n            throw new FacesException(ioe);\n        }\n    }\n\n    protected String getNoscriptUrl(ExternalContext externalContext)\n    {\n        String url = externalContext.getRequestPathInfo();\n        if (url == null)\n        {\n            url = \"\";\n        }\n\n        // only use the very last part of the url\n        int lastSlash = url.lastIndexOf('/');\n        if (lastSlash != -1)\n        {\n            url = url.substring(lastSlash + 1);\n        }\n\n        // add request parameter\n        url = JsfUtils.addPageParameters(externalContext, url, true);\n        url = JsfUtils.addParameter(externalContext, url, false, NOSCRIPT_PARAMETER, \"true\");\n\n        // NOTE that the url could contain data for an XSS attack\n        // like e.g. ?\"></a><a href%3D\"http://hacker.org/attack.html?a\n        // DO NOT REMOVE THE FOLLOWING LINES!\n        url = url.replace(\"\\\"\", \"\");\n        url = url.replace(\"\\'\", \"\");\n\n        return url;\n    }\n\n    protected String getVerifiedWindowIdFromCookie(ExternalContext externalContext)\n    {\n        String cookieName =\n                ClientWindowHelper.Cookies.REQUEST_WINDOW_ID_PREFIX + getRequestTokenParameter(externalContext);\n        Cookie cookie = (Cookie) externalContext.getRequestCookieMap().get(cookieName);\n\n        if (cookie != null)\n        {\n            // manually blast the cookie away, otherwise it pollutes the\n            // cookie storage in some browsers. E.g. Firefox doesn't\n            // cleanup properly, even if the max-age is reached.\n            cookie.setMaxAge(0);\n\n            return cookie.getValue();\n        }\n\n        return null;\n    }\n\n    protected String getRequestTokenParameter(ExternalContext externalContext)\n    {\n        String requestToken =\n                externalContext.getRequestParameterMap().get(ClientWindowHelper.RequestParameters.REQUEST_TOKEN);\n        if (requestToken != null)\n        {\n            return requestToken;\n        }\n\n        return \"\";\n    }\n\n    @Override\n    public String interceptRedirect(FacesContext facesContext, String url)\n    {\n        // following cases we can mark as valid next request:\n        // 1) request == !ajax and GET\n        //   A redirect via ExternalContext can only be done in a JSF request.\n        //   As the windowId is validated before the JSF lifecycle starts\n        //   (via windowhandler streaming/request token validation), we can assume that the current request\n        //   is valid and we can just mark the next request/redirect as valid, too.\n        // 2) request == ajax and POST\n        //   Ajax is always a \"post back\", so the browser tab was already validated in earlier requests.\n        //   \n        //   \n        // following cases we can NOT mark as valid next request:\n        // 1) request == !ajax and POST\n        //   This is a Post/Redirect/Get - as the post can be done to a new browser tab\n        //   (via the target attribute on the form), the windowId must NOT be valid.\n        // 2) request == ajax and GET\n        //   Not a common JSF request.\n        //   \n        boolean ajax = facesContext.getPartialViewContext().isAjaxRequest();\n        boolean post = isPost(facesContext);\n        boolean get = !post;\n        if ((!ajax && get) || (ajax && post))\n        {\n            String requestToken = generateNewRequestToken();\n            String windowId = getId();\n            \n            ClientWindowHelper.addRequestWindowIdCookie(facesContext,\n                    requestToken,\n                    windowId);\n\n            url = JsfUtils.addParameter(facesContext.getExternalContext(),\n                    url,\n                    true,\n                    ClientWindowHelper.RequestParameters.REQUEST_TOKEN,\n                    requestToken);\n\n            return url;\n        }\n        \n        return url;\n    }\n\n    @Override\n    public boolean isInitialRedirectSupported(FacesContext facesContext)\n    {\n        return false;\n    }\n\n    @Override\n    public Map<String, String> getQueryURLParameters(FacesContext facesContext)\n    {\n        return Collections.emptyMap();\n    }\n\n    @Override\n    public boolean isClientWindowRenderModeEnabled(FacesContext facesContext)\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/clientwindow/DeltaSpikeClientWindow.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.clientwindow;\n\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.lifecycle.ClientWindow;\nimport jakarta.faces.render.ResponseStateManager;\nimport jakarta.servlet.http.HttpServletRequest;\nimport java.util.Map;\nimport java.util.Random;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.StringUtils;\nimport org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;\nimport org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;\n\npublic abstract class DeltaSpikeClientWindow extends ClientWindow\n{\n    /**\n     * This windowId will be used for all requests with disabled windowId feature\n     */\n    public static final String DEFAULT_WINDOW_ID = \"default\";\n    \n    protected String id;\n    protected int maxWindowIdCount = 10;\n\n    public DeltaSpikeClientWindow()\n    {\n        this.maxWindowIdCount = ClientWindowHelper.getMaxWindowIdLength();\n    }\n\n    @Override\n    public String getId()\n    {\n        return id;\n    }\n\n    /**\n     * We have to escape some characters to make sure we do not open\n     * any XSS vectors. E.g. replace (,<, & etc to\n     * prevent attackers from injecting JavaScript function calls or html.\n     */\n    protected String sanitiseWindowId(String windowId)\n    {\n        if (windowId == null)\n        {\n            return null;\n        }\n\n        windowId = StringUtils.removeSpecialChars(windowId);\n        if (windowId.length() > this.maxWindowIdCount)\n        {\n            windowId = windowId.substring(0, this.maxWindowIdCount);\n        }\n        return windowId;\n    }\n\n    protected String generateNewWindowId()\n    {\n        //X TODO proper mechanism\n        return Integer.toString((new Random()).nextInt() % 10000);\n    }\n\n    protected String generateNewRequestToken()\n    {\n        return Integer.toString((int) Math.floor(Math.random() * 999));\n    }\n    \n    protected boolean isPost(FacesContext facesContext)\n    {\n        if (facesContext.isPostback())\n        {\n            return true;\n        }\n\n        Object request = facesContext.getExternalContext().getRequest();\n        if (request instanceof HttpServletRequest)\n        {\n            if (\"POST\".equals(((HttpServletRequest) request).getMethod()))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    protected String getWindowIdPostParameter(FacesContext facesContext)\n    {\n        Map<String, String> requestParams = facesContext.getExternalContext().getRequestParameterMap();\n        return requestParams.get(ResponseStateManager.CLIENT_WINDOW_PARAM);\n    }\n\n    protected String getWindowIdParameter(FacesContext facesContext)\n    {\n        Map<String, String> requestParameters = facesContext.getExternalContext().getRequestParameterMap();\n        return requestParameters.get(ResponseStateManager.CLIENT_WINDOW_URL_PARAM);\n    }\n    \n    protected ClientWindowConfig getClientWindowConfig()\n    {\n        return BeanProvider.getContextualReference(ClientWindowConfig.class);\n    }\n\n    /**\n     * @return true if the implementation possible sends an initial redirect.\n     */\n    public abstract boolean isInitialRedirectSupported(FacesContext facesContext);\n    \n    /**\n     * @return The new redirect url.\n     */\n    public abstract String interceptRedirect(FacesContext facesContext, String url);\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/clientwindow/LazyClientWindow.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.clientwindow;\n\nimport org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;\n\nimport jakarta.faces.context.FacesContext;\nimport java.util.Collections;\nimport java.util.Map;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.StringUtils;\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\n\npublic class LazyClientWindow extends DeltaSpikeClientWindow\n{\n    @Override\n    public void decode(FacesContext facesContext)\n    {\n        id = ClientWindowHelper.getInitialRedirectWindowId(facesContext);\n\n        if (StringUtils.isEmpty(id))\n        {\n            id = getWindowIdParameter(facesContext);\n        }\n\n        boolean post = isPost(facesContext);\n\n        if (StringUtils.isEmpty(id) && post)\n        {\n            id = getWindowIdPostParameter(facesContext);\n        }\n\n        if (StringUtils.isEmpty(id))\n        {\n            id = generateNewWindowId();\n\n            JsfModuleConfig jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class);\n            if (jsfModuleConfig.isInitialRedirectEnabled() && !post)\n            {\n                id = sanitiseWindowId(id); // handleInitialRedirect already takes the id, just be sure and sanitise now\n                ClientWindowHelper.handleInitialRedirect(facesContext, id);\n                facesContext.responseComplete();\n            }\n        }\n\n        id = sanitiseWindowId(id);\n    }\n\n    @Override\n    public Map<String, String> getQueryURLParameters(FacesContext facesContext)\n    {\n        return Collections.emptyMap();\n    }\n\n    @Override\n    public boolean isInitialRedirectSupported(FacesContext facesContext)\n    {\n        return true;\n    }\n\n    @Override\n    public String interceptRedirect(FacesContext facesContext, String url)\n    {\n        return url;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/token/PostRequestTokenComponent.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.component.token;\n\nimport org.apache.deltaspike.jsf.impl.token.PostRequestTokenMarker;\n\nimport jakarta.faces.component.FacesComponent;\nimport jakarta.faces.component.UIInput;\n\n\n/**\n * Component for rendering the post-request-token\n */\n@FacesComponent(PostRequestTokenComponent.COMPONENT_TYPE)\npublic class PostRequestTokenComponent extends UIInput\n{\n    public static final String COMPONENT_TYPE = \"org.apache.deltaspike.PostRequestTokenHolder\";\n\n    private transient String markedId;\n\n    @Override\n    public String getId()\n    {\n        if (this.markedId == null)\n        {\n            String originalId = super.getId();\n\n            if (originalId.contains(PostRequestTokenMarker.POST_REQUEST_TOKEN_KEY))\n            {\n                this.markedId = originalId;\n            }\n            else\n            {\n                this.markedId = originalId + \"_\" + PostRequestTokenMarker.POST_REQUEST_TOKEN_KEY;\n            }\n        }\n        return this.markedId;\n    }\n\n    //don't use #restoreState - we couldn't support stateless views,...\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/token/RequestTokenHtmlRenderer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.component.token;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.jsf.impl.token.PostRequestTokenManager;\n\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.context.ResponseWriter;\nimport jakarta.faces.render.FacesRenderer;\nimport jakarta.faces.render.Renderer;\nimport java.io.IOException;\n\n@FacesRenderer(\n    componentFamily = PostRequestTokenComponent.COMPONENT_FAMILY,\n    rendererType = PostRequestTokenComponent.COMPONENT_TYPE)\npublic class RequestTokenHtmlRenderer extends Renderer\n{\n    private static final String INPUT_ELEMENT = \"input\";\n    private static final String TYPE_ATTRIBUTE = \"type\";\n    private static final String INPUT_TYPE_HIDDEN = \"hidden\";\n\n    private static final String ID_ATTRIBUTE = \"id\";\n    private static final String NAME_ATTRIBUTE = \"name\";\n    private static final String VALUE_ATTRIBUTE = \"value\";\n\n    private volatile PostRequestTokenManager postRequestTokenManager;\n\n    @Override\n    public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException\n    {\n        ResponseWriter writer = facesContext.getResponseWriter();\n\n        writer.startElement(INPUT_ELEMENT, component);\n        writer.writeAttribute(TYPE_ATTRIBUTE, INPUT_TYPE_HIDDEN, null);\n\n        String clientId = component.getClientId(facesContext);\n        writer.writeAttribute(ID_ATTRIBUTE, clientId, null);\n        writer.writeAttribute(NAME_ATTRIBUTE, clientId, null);\n\n        String currentPostRequestToken = getPostRequestTokenManager().getCurrentToken();\n        if (currentPostRequestToken != null)\n        {\n            writer.writeAttribute(VALUE_ATTRIBUTE, currentPostRequestToken, VALUE_ATTRIBUTE);\n        }\n\n        writer.endElement(INPUT_ELEMENT);\n    }\n\n    //don't use #decode - we couldn't support DSP for immediate actions\n\n    private PostRequestTokenManager getPostRequestTokenManager()\n    {\n        if (this.postRequestTokenManager == null)\n        {\n            synchronized (this)\n            {\n                if (this.postRequestTokenManager == null)\n                {\n                    this.postRequestTokenManager = BeanProvider.getContextualReference(PostRequestTokenManager.class);\n                }\n            }\n        }\n\n        return this.postRequestTokenManager;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdComponent.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.jsf.impl.component.window;\r\n\r\nimport jakarta.faces.component.FacesComponent;\r\nimport jakarta.faces.component.UIOutput;\r\n\r\n\r\n/**\r\n * {@link WindowIdHtmlRenderer} will render a small script needed for ajax-requests\r\n */\r\n@FacesComponent(WindowIdComponent.COMPONENT_TYPE)\r\npublic class WindowIdComponent extends UIOutput\r\n{\r\n    public static final String COMPONENT_TYPE = \"org.apache.deltaspike.WindowIdHolder\";\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.component.window;\n\nimport jakarta.faces.application.ResourceDependencies;\nimport jakarta.faces.application.ResourceDependency;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.context.ResponseWriter;\nimport jakarta.faces.lifecycle.ClientWindow;\nimport jakarta.faces.render.FacesRenderer;\nimport jakarta.faces.render.Renderer;\nimport java.io.IOException;\nimport jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletResponse;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.jsf.impl.clientwindow.DeltaSpikeClientWindow;\nimport org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;\nimport org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;\n\n@FacesRenderer(componentFamily = WindowIdComponent.COMPONENT_FAMILY, rendererType = WindowIdComponent.COMPONENT_TYPE)\n@ResourceDependencies( {\n        @ResourceDependency(library = \"deltaspike\", name = \"windowhandler.js\", target = \"head\"),\n        @ResourceDependency(library = \"jakarta.faces\", name = \"faces.js\", target = \"head\") } )\npublic class WindowIdHtmlRenderer extends Renderer\n{\n    private volatile ClientWindowConfig clientWindowConfig;\n    private int maxWindowIdLength = 10;\n\n    /**\n     * 'deltaspikeJsWindowId' will be used to:\n     * Write a simple hidden field into the form.\n     * This might change in the future...\n     * @param context\n     * @param component\n     * @throws IOException\n     */\n    @Override\n    public void encodeBegin(FacesContext context, UIComponent component) throws IOException\n    {\n        super.encodeBegin(context, component);\n\n        lazyInit();\n\n        ClientWindowConfig.ClientWindowRenderMode clientWindowRenderMode =\n                clientWindowConfig.getClientWindowRenderMode(context);\n\n        // see DELTASPIKE-1113\n        boolean delegatedWindowMode =\n            ClientWindowConfig.ClientWindowRenderMode.DELEGATED.equals(clientWindowRenderMode);\n        if (delegatedWindowMode)\n        {\n            return;\n        }\n\n        ClientWindow clientWindow = context.getExternalContext().getClientWindow();\n        if (clientWindow == null && !(clientWindow instanceof DeltaSpikeClientWindow))\n        {\n            return;\n        }\n        \n        String windowId = clientWindow.getId();\n        // just to get sure if a user provides a own client window\n        windowId = secureWindowId(windowId);\n\n        ResponseWriter writer = context.getResponseWriter();\n        writer.write(\"<script type=\\\"text/javascript\\\">\");\n        writer.write(\"(function(){\");\n        writer.write(\"dswh.init('\");\n        writer.writeText(windowId, null);\n        writer.write(\"','\"\n                + clientWindowRenderMode.name() + \"',\"\n                + maxWindowIdLength + \",{\");\n\n        writer.write(\"'tokenizedRedirect':\" + clientWindowConfig.isClientWindowTokenizedRedirectEnabled());\n        writer.write(\",'storeWindowTreeOnLinkClick':\"\n                + clientWindowConfig.isClientWindowStoreWindowTreeEnabledOnLinkClick());\n        writer.write(\",'storeWindowTreeOnButtonClick':\"\n                + clientWindowConfig.isClientWindowStoreWindowTreeEnabledOnButtonClick());\n\n        // see #729\n        if (((DeltaSpikeClientWindow) clientWindow).isInitialRedirectSupported(context))\n        {\n            Object cookie = ClientWindowHelper.getRequestWindowIdCookie(context, windowId);\n            if (cookie != null && cookie instanceof Cookie)\n            {\n                Cookie servletCookie = (Cookie) cookie;\n                writer.write(\",'initialRedirectWindowId':'\" + secureWindowId(servletCookie.getValue()) + \"'\");\n                // expire/remove cookie\n                servletCookie.setMaxAge(0);\n                ((HttpServletResponse) context.getExternalContext().getResponse()).addCookie(servletCookie);\n            }\n        }\n\n        writer.write(\"});\");\n        writer.write(\"})();\");\n        writer.write(\"</script>\");\n    }\n\n    protected String secureWindowId(String windowId)\n    {\n        //restrict the length to prevent script-injection\n        if (windowId != null && windowId.length() > this.maxWindowIdLength)\n        {\n            windowId = windowId.substring(0, this.maxWindowIdLength);\n        }\n        return windowId;\n    }\n\n    private void lazyInit()\n    {\n        if (clientWindowConfig == null)\n        {\n            synchronized (this)\n            {\n                if (clientWindowConfig == null)\n                {\n                    clientWindowConfig = BeanProvider.getContextualReference(ClientWindowConfig.class);\n                    maxWindowIdLength = ClientWindowHelper.getMaxWindowIdLength();\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/AbstractConfigNode.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\npublic abstract class AbstractConfigNode implements ViewConfigNode\n{\n    private final ViewConfigNode parent;\n    private List<ViewConfigNode> children = new ArrayList<ViewConfigNode>();\n    private Set<Annotation> metaData;\n    private List<Annotation> inheritedMetaData = new ArrayList<Annotation>();\n    private Map<Class<? extends Annotation>, List<CallbackDescriptor>> callbackDescriptors =\n        new HashMap<Class<? extends Annotation>, List<CallbackDescriptor>>();\n\n    protected AbstractConfigNode(ViewConfigNode parent, Set<Annotation> metaData)\n    {\n        this.parent = parent;\n        this.metaData = new HashSet<Annotation>(metaData); //might be read-only (from Annotated#getAnnotations)\n    }\n\n    @Override\n    public ViewConfigNode getParent()\n    {\n        return this.parent;\n    }\n\n    @Override\n    public List<ViewConfigNode> getChildren()\n    {\n        return this.children;\n    }\n\n    @Override\n    public Set<Annotation> getMetaData()\n    {\n        return this.metaData;\n    }\n\n    @Override\n    public List<Annotation> getInheritedMetaData()\n    {\n        return this.inheritedMetaData;\n    }\n\n    @Override\n    public Map<Class<? extends Annotation>, List<CallbackDescriptor>> getCallbackDescriptors()\n    {\n        return this.callbackDescriptors;\n    }\n\n    @Override\n    public List<CallbackDescriptor> getCallbackDescriptors(Class<? extends Annotation> metaDataType)\n    {\n        List<CallbackDescriptor> result = this.callbackDescriptors.get(metaDataType);\n\n        if (result == null)\n        {\n            result = new ArrayList<CallbackDescriptor>();\n            this.callbackDescriptors.put(metaDataType, result);\n        }\n        return result;\n    }\n\n    @Override\n    public void registerCallbackDescriptors(Class<? extends Annotation> metaDataType,\n                                            CallbackDescriptor callbackDescriptor)\n    {\n        if (!callbackDescriptor.getCallbackMethods().isEmpty())\n        {\n            getCallbackDescriptors(metaDataType).add(callbackDescriptor);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/AbstractPathConfigDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ExecutableCallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\nabstract class AbstractPathConfigDescriptor<CT> implements ConfigDescriptor<CT>\n{\n    private final Class<? extends CT> source;\n    private List<Annotation> metaData;\n    private Map<Class<? extends Annotation>, List<CallbackDescriptor>> callbackDescriptors;\n\n    AbstractPathConfigDescriptor(Class<? extends CT> configClass,\n                                 List<Annotation> mergedMetaData,\n                                 Map<Class<? extends Annotation>, List<CallbackDescriptor>> callbackDescriptors)\n    {\n        this.source = configClass;\n        this.metaData = Collections.unmodifiableList(mergedMetaData);\n        this.callbackDescriptors = callbackDescriptors;\n    }\n\n    @Override\n    public Class<? extends CT> getConfigClass()\n    {\n        return this.source;\n    }\n\n    @Override\n    public List<Annotation> getMetaData()\n    {\n        return this.metaData;\n    }\n\n    @Override\n    public <T extends Annotation> List<T> getMetaData(Class<T> target)\n    {\n        List<T> result = new ArrayList<T>();\n\n        for (Annotation annotation : this.metaData)\n        {\n            if (target.isAssignableFrom(annotation.annotationType()))\n            {\n                result.add((T) annotation);\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public CallbackDescriptor getCallbackDescriptor(Class<? extends Annotation> metaDataType)\n    {\n        return getCallbackDescriptor(metaDataType, DefaultCallback.class);\n    }\n\n    @Override\n    public CallbackDescriptor getCallbackDescriptor(Class<? extends Annotation> metaDataType,\n                                                    Class<? extends Annotation> callbackType)\n    {\n        return findCallbackDescriptor(metaDataType, callbackType);\n    }\n\n    @Override\n    public <T extends ExecutableCallbackDescriptor> T getExecutableCallbackDescriptor(\n            Class<? extends Annotation> metaDataType,\n            Class<? extends T> executorType)\n    {\n        return getExecutableCallbackDescriptor(metaDataType, DefaultCallback.class, executorType);\n    }\n\n    @Override\n    public <T extends ExecutableCallbackDescriptor> T getExecutableCallbackDescriptor(\n            Class<? extends Annotation> metaDataType,\n            Class<? extends Annotation> callbackType,\n            Class<? extends T> executorType)\n    {\n        return findCallbackDescriptor(metaDataType, callbackType);\n    }\n\n    private <T extends CallbackDescriptor> T findCallbackDescriptor(Class<? extends Annotation> metaDataType,\n                                                                    Class<? extends Annotation> callbackType)\n    {\n        List<CallbackDescriptor> foundDescriptors = callbackDescriptors.get(metaDataType);\n\n        if (foundDescriptors == null || foundDescriptors.isEmpty())\n        {\n            return null;\n        }\n\n        if (callbackType == null || DefaultCallback.class.equals(callbackType))\n        {\n            if (foundDescriptors.size() > 1)\n            {\n                //TODO validate during bootstrapping\n                throw new IllegalStateException(\"multiple descriptors for \" +\n                        ((callbackType == null) ? DefaultCallback.class.getName() : callbackType.getName()) +\n                        \" aren't allowed\");\n            }\n            return (T)foundDescriptors.iterator().next();\n        }\n\n        for (CallbackDescriptor callbackDescriptor : foundDescriptors)\n        {\n            if (callbackDescriptor.isBoundTo(callbackType))\n            {\n                return (T)callbackDescriptor;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public String toString()\n    {\n        return getPath();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.view.metadata.Aggregated;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.SkipMetaDataMerge;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.spi.config.view.ConfigNodeConverter;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.util.AnnotationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.util.ViewConfigUtils;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\npublic class DefaultConfigNodeConverter implements ConfigNodeConverter\n{\n    @Override\n    public ConfigDescriptor convert(ViewConfigNode node)\n    {\n        List<Annotation> mergedMetaData = mergeMetaData(node.getMetaData(), node.getInheritedMetaData());\n        //e.g. replace default placeholders needed for the merge with real default values\n        mergedMetaData = preProcessMetaData(mergedMetaData, node);\n\n        Class sourceClass = node.getSource();\n\n        if (ViewConfigUtils.isFolderConfig(sourceClass))\n        {\n            Folder folderAnnotation = findMetaDataByType(mergedMetaData, Folder.class);\n            return new DefaultFolderConfigDescriptor(folderAnnotation.name(), node.getSource(),\n                    mergedMetaData, node.getCallbackDescriptors());\n        }\n        else if (ViewConfig.class.isAssignableFrom(sourceClass))\n        {\n            View viewAnnotation = findMetaDataByType(mergedMetaData, View.class);\n            String viewId = viewAnnotation.basePath() + viewAnnotation.name() + \".\" + viewAnnotation.extension();\n            return new DefaultViewPathConfigDescriptor(viewId, (Class<? extends ViewConfig>) node.getSource(),\n                    filterInheritedFolderMetaData(mergedMetaData), node.getCallbackDescriptors());\n        }\n        else\n        {\n            throw new IllegalStateException(node.getSource() + \" isn't a valid view-config\");\n        }\n    }\n\n    private <T> T findMetaDataByType(List<Annotation> metaData, Class<T> target)\n    {\n        for (Annotation annotation : metaData)\n        {\n            if (target.equals(annotation.annotationType()))\n            {\n                return (T) annotation;\n            }\n        }\n\n        return null;\n    }\n\n    private List<Annotation> mergeMetaData(Set<Annotation> metaData, List<Annotation> inheritedMetaData)\n    {\n        //TODO add qualifier support\n        List<Annotation> nodeViewMetaData = new ArrayList<Annotation>();\n        List<Annotation> viewMetaDataFromStereotype = new ArrayList<Annotation>();\n\n        for (Annotation annotation : metaData)\n        {\n            if (annotation.annotationType().isAnnotationPresent(ViewMetaData.class))\n            {\n                nodeViewMetaData.add(annotation);\n            }\n\n            //TODO move to stereotype-util, improve it and merge it with DefaultViewConfigInheritanceStrategy\n            if (annotation.annotationType().isAnnotationPresent(Stereotype.class))\n            {\n                for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())\n                {\n                    if (metaAnnotation.annotationType().isAnnotationPresent(ViewMetaData.class))\n                    {\n                        viewMetaDataFromStereotype.add(metaAnnotation);\n                    }\n                }\n            }\n        }\n\n        //merge meta-data of same level\n        List<Annotation> result = mergeAnnotationInstances(viewMetaDataFromStereotype, nodeViewMetaData);\n\n        if (inheritedMetaData != null && !inheritedMetaData.isEmpty())\n        {\n            //merge meta-data with levels above\n            result = mergeAnnotationInstances(inheritedMetaData, result);\n        }\n\n        return result;\n    }\n\n    private List<Annotation> mergeAnnotationInstances(List<Annotation> inheritedMetaData, List<Annotation> nodeMetaData)\n    {\n        List<Annotation> mergedResult = new ArrayList<Annotation>();\n\n        for (Annotation inheritedAnnotation : inheritedMetaData)\n        {\n            ViewMetaData viewMetaData = inheritedAnnotation.annotationType().getAnnotation(ViewMetaData.class);\n\n            if (viewMetaData == null)\n            {\n                continue;\n            }\n\n            Aggregated aggregated = inheritedAnnotation.annotationType().getAnnotation(Aggregated.class);\n\n            if (aggregated == null)\n            {\n                aggregated = viewMetaData.annotationType().getAnnotation(Aggregated.class);\n            }\n\n            if (aggregated.value()) //aggregation for the whole annotation is allowed\n            {\n                mergedResult.add(inheritedAnnotation);\n            }\n            else\n            {\n                Annotation currentNodeMetaData = findInResult(nodeMetaData, inheritedAnnotation);\n                if (currentNodeMetaData == null)\n                {\n                    Annotation mergedMetaData = findInResult(mergedResult, inheritedAnnotation);\n\n                    if (mergedMetaData == null)\n                    {\n                        mergedResult.add(inheritedAnnotation);\n                    }\n                    else\n                    {\n                        Annotation mergedAnnotation = mergeAnnotationInstance(mergedMetaData, inheritedAnnotation);\n                        mergedResult.add(mergedAnnotation);\n                    }\n                }\n                else\n                {\n                    Annotation mergedAnnotation = mergeAnnotationInstance(currentNodeMetaData, inheritedAnnotation);\n                    mergedResult.add(mergedAnnotation);\n                }\n            }\n        }\n\n        //add all annotations at the beginning which weren't used for the merge\n        mergedResult.addAll(0, nodeMetaData);\n        return mergedResult;\n    }\n\n    private Annotation mergeAnnotationInstance(Annotation existingMetaData, Annotation inheritedMetaData)\n    {\n        Map<String, Object> values = new HashMap<String, Object>();\n\n        for (Method annotationMethod : existingMetaData.annotationType().getDeclaredMethods())\n        {\n            annotationMethod.setAccessible(true); //TODO\n\n            Annotation defaultAnnotation = AnnotationInstanceProvider.of(existingMetaData.annotationType());\n            try\n            {\n                Object defaultValue = null;\n\n                try\n                {\n                    defaultValue = annotationMethod.invoke(defaultAnnotation);\n                }\n                catch (Exception e) //happens with primitive data-types without default values\n                {\n                    defaultValue = null;\n                }\n\n                Object existingValue = annotationMethod.invoke(existingMetaData);\n\n                if (existingValue == null /*possible with literal instances*/ ||\n                        existingValue.equals(defaultValue))\n                {\n                    Object inheritedValue = annotationMethod.invoke(inheritedMetaData);\n\n                    if (inheritedValue == null /*possible with literal instances*/ ||\n                            inheritedValue.equals(defaultValue) ||\n                            annotationMethod.isAnnotationPresent(SkipMetaDataMerge.class))\n                    {\n                        values.put(annotationMethod.getName(), defaultValue);\n                    }\n                    else\n                    {\n                        values.put(annotationMethod.getName(), inheritedValue);\n                    }\n                }\n                else\n                {\n                    values.put(annotationMethod.getName(), existingValue);\n                }\n            }\n            catch (Exception e)\n            {\n                ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n        //TODO add aggregation in case of arrays\n        return AnnotationInstanceProvider.of(existingMetaData.annotationType(), values);\n    }\n\n    private List<Annotation> preProcessMetaData(List<Annotation> mergedMetaData, ViewConfigNode node)\n    {\n        List<Annotation> result = new ArrayList<Annotation>(mergedMetaData.size());\n\n        for (Annotation annotation : mergedMetaData)\n        {\n            ViewMetaData viewMetaData = annotation.annotationType().getAnnotation(ViewMetaData.class);\n            Class<? extends ConfigPreProcessor> preProcessorClass = viewMetaData.preProcessor();\n            if (!ConfigPreProcessor.class.equals(preProcessorClass))\n            {\n                String customPreProcessorClassName = ConfigResolver.getPropertyValue(preProcessorClass.getName(), null);\n\n                if (customPreProcessorClassName != null)\n                {\n                    Class<? extends ConfigPreProcessor> customPreProcessorClass =\n                            ClassUtils.tryToLoadClassForName(customPreProcessorClassName, ConfigPreProcessor.class);\n\n                    if (customPreProcessorClass != null)\n                    {\n                        preProcessorClass = customPreProcessorClass;\n                    }\n                    else\n                    {\n                        throw new IllegalStateException(customPreProcessorClassName + \" is configured to replace \" +\n                            preProcessorClass.getName() + \", but it wasn't possible to load it.\");\n                    }\n                }\n                ConfigPreProcessor preProcessor = ClassUtils.tryToInstantiateClass(preProcessorClass);\n\n                Annotation resultToAdd = preProcessor.beforeAddToConfig(annotation, node);\n\n                //it isn't possible to detect changed annotations\n                if (resultToAdd != annotation) //check if the annotation(-instance) was changed\n                {\n                    validateAnnotationChange(annotation);\n                    rewriteMetaDataOfNode(node.getMetaData(), annotation, resultToAdd);\n                    rewriteMetaDataOfNode(node.getInheritedMetaData(), annotation, resultToAdd);\n                }\n                result.add(resultToAdd);\n            }\n            else\n            {\n                result.add(annotation);\n            }\n        }\n\n        return result;\n    }\n\n    private Annotation findInResult(List<Annotation> annotationList, Annotation annotationToFind)\n    {\n        for (Annotation annotation : annotationList)\n        {\n            if (annotationToFind.annotationType().equals(annotation.annotationType()))\n            {\n                annotationList.remove(annotation);\n                return annotation;\n            }\n        }\n        return null;\n    }\n\n    private List<Annotation> filterInheritedFolderMetaData(List<Annotation> mergedMetaData)\n    {\n        List<Annotation> result = new ArrayList<Annotation>();\n\n        for (Annotation metaData : mergedMetaData)\n        {\n            if (!Folder.class.equals(metaData.annotationType()))\n            {\n                result.add(metaData);\n            }\n        }\n\n        return result;\n    }\n\n    protected void validateAnnotationChange(Annotation annotation)\n    {\n        Class<? extends Annotation> annotationType = annotation.annotationType();\n\n        if (Folder.class.equals(annotationType) || View.class.equals(annotationType))\n        {\n            return;\n        }\n\n        ViewMetaData viewMetaData = annotationType.getAnnotation(ViewMetaData.class);\n        if (viewMetaData == null)\n        {\n            return;\n        }\n\n        Aggregated aggregated = viewMetaData.annotationType().getAnnotation(Aggregated.class);\n        if (aggregated != null && aggregated.value())\n        {\n            throw new IllegalStateException(\"it isn't supported to change aggregated meta-data,\" +\n                \"because inheritance won't work correctly\");\n        }\n    }\n\n    protected void rewriteMetaDataOfNode(Collection<Annotation> metaData,\n                                         Annotation oldMetaData, Annotation newMetaData)\n    {\n        Iterator<Annotation> metaDataIterator = metaData.iterator();\n\n        while (metaDataIterator.hasNext())\n        {\n            Annotation currentMetaData = metaDataIterator.next();\n\n            if (AnnotationUtils.getQualifierHashCode(currentMetaData) ==\n                AnnotationUtils.getQualifierHashCode(oldMetaData))\n            {\n                metaDataIterator.remove();\n                metaData.add(newMetaData);\n                break;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultErrorViewAwareExceptionHandlerWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.api.projectstage.TestStage;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.faces.FacesException;\nimport jakarta.faces.application.ViewExpiredException;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.ExceptionHandler;\nimport jakarta.faces.context.ExceptionHandlerWrapper;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.context.Flash;\nimport jakarta.faces.event.ExceptionQueuedEvent;\nimport jakarta.faces.event.ExceptionQueuedEventContext;\nimport java.util.Iterator;\n\npublic class DefaultErrorViewAwareExceptionHandlerWrapper extends ExceptionHandlerWrapper implements Deactivatable\n{\n    private ExceptionHandler wrapped;\n\n    private volatile ViewNavigationHandler viewNavigationHandler;\n\n    /**\n     * Constructor used by proxy libs\n     */\n    protected DefaultErrorViewAwareExceptionHandlerWrapper()\n    {\n    }\n\n    public DefaultErrorViewAwareExceptionHandlerWrapper(ExceptionHandler wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    @Override\n    public void handle() throws FacesException\n    {\n        lazyInit();\n        Iterator<ExceptionQueuedEvent> exceptionQueuedEventIterator = getUnhandledExceptionQueuedEvents().iterator();\n\n        while (exceptionQueuedEventIterator.hasNext())\n        {\n            ExceptionQueuedEventContext exceptionQueuedEventContext =\n                    (ExceptionQueuedEventContext) exceptionQueuedEventIterator.next().getSource();\n\n            @SuppressWarnings({ \"ThrowableResultOfMethodCallIgnored\" })\n            Throwable throwable = exceptionQueuedEventContext.getException();\n\n            String viewId = null;\n\n            if (!isExceptionToHandle(throwable))\n            {\n                continue;\n            }\n\n            FacesContext facesContext = exceptionQueuedEventContext.getContext();\n            Flash flash = facesContext.getExternalContext().getFlash();\n\n            if (throwable instanceof ViewExpiredException)\n            {\n                viewId = ((ViewExpiredException) throwable).getViewId();\n            }\n            else if (throwable instanceof ContextNotActiveException)\n            {\n                //the error page uses a cdi scope which isn't active as well\n                //(it's recorded below - see flash.put(throwable.getClass().getName(), throwable);)\n                if (flash.containsKey(ContextNotActiveException.class.getName()))\n                {\n                    //TODO show it in case of project-stage development\n                    break;\n                }\n\n                if (facesContext.getViewRoot() != null)\n                {\n                    viewId = facesContext.getViewRoot().getViewId();\n                }\n                else\n                {\n                    viewId = BeanProvider.getContextualReference(ViewConfigResolver.class)\n                            //has to return a value otherwise this handler wouldn't be active\n                            .getDefaultErrorViewConfigDescriptor().getViewId();\n                }\n            }\n\n            if (viewId != null)\n            {\n                UIViewRoot uiViewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);\n\n                if (uiViewRoot == null)\n                {\n                    continue;\n                }\n\n                if (facesContext.isProjectStage(jakarta.faces.application.ProjectStage.Development) ||\n                        ProjectStageProducer.getInstance().getProjectStage() == ProjectStage.Development ||\n                        ProjectStageProducer.getInstance().getProjectStage() instanceof TestStage)\n                {\n                    throwable.printStackTrace();\n                }\n\n                facesContext.setViewRoot(uiViewRoot);\n                exceptionQueuedEventIterator.remove();\n\n                //record the current exception -> to check it at the next call or to use it on the error-page\n                flash.put(throwable.getClass().getName(), throwable);\n                flash.keep(throwable.getClass().getName());\n\n                this.viewNavigationHandler.navigateTo(DefaultErrorView.class);\n\n                break;\n            }\n        }\n\n        this.wrapped.handle();\n    }\n\n    //TODO it should be possible to configure the exceptions we handle\n    //e.g. @View could specify which exception/s a page\n    // - can recover from (-> redirect in case of a POST to refresh the state + optional message)\n    // - can't recover from (-> redirect to the default-error page)\n    protected boolean isExceptionToHandle(Throwable throwable)\n    {\n        return throwable instanceof ViewExpiredException ||\n                throwable instanceof ContextNotActiveException;\n    }\n\n    private void lazyInit()\n    {\n        if (this.viewNavigationHandler == null)\n        {\n            this.viewNavigationHandler = BeanProvider.getContextualReference(ViewNavigationHandler.class);\n        }\n    }\n\n    @Override\n    public ExceptionHandler getWrapped()\n    {\n        lazyInit();\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultFolderConfigDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\nimport java.util.Map;\n\nclass DefaultFolderConfigDescriptor extends AbstractPathConfigDescriptor<Object>\n{\n    private final String path;\n\n    DefaultFolderConfigDescriptor(String path,\n                                  Class configClass,\n                                  List<Annotation> mergedMetaData,\n                                  Map<Class<? extends Annotation>, List<CallbackDescriptor>> callbackDescriptors)\n    {\n        super(configClass, mergedMetaData, callbackDescriptors);\n        this.path = path;\n    }\n\n    @Override\n    public String getPath()\n    {\n        return this.path;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultViewConfigInheritanceStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.Aggregated;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigInheritanceStrategy;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.util.ViewConfigUtils;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.Stack;\n\n//TODO remove parts which aren't needed any longer\npublic class DefaultViewConfigInheritanceStrategy implements ViewConfigInheritanceStrategy\n{\n    @Override\n    public List<Annotation> resolveInheritedMetaData(ViewConfigNode viewConfigNode)\n    {\n        List<Annotation> inheritedAnnotations = new ArrayList<Annotation>();\n\n        Set<Class> processedTypes = new HashSet<Class>();\n        processedTypes.add(ViewConfig.class); //filter the base interface in any case\n\n        Stack<Class> classesToAnalyze = new Stack<Class>();\n        addInterfaces(processedTypes, classesToAnalyze, viewConfigNode.getSource()); //don't add the page-class itself\n\n        while (!classesToAnalyze.empty())\n        {\n            Class currentClass = classesToAnalyze.pop();\n\n            if (processedTypes.contains(currentClass))\n            {\n                continue;\n            }\n            processedTypes.add(currentClass);\n\n            addInterfaces(processedTypes, classesToAnalyze, currentClass);\n\n            //don't add the annotations of the final view-config class itself (we just need the inherited annotations)\n            if (ViewConfigUtils.isFolderConfig(currentClass))\n            {\n                inheritedAnnotations.addAll(findViewMetaData(currentClass, viewConfigNode));\n            }\n\n            Class nextClass = currentClass.getSuperclass();\n            if (nextClass != null && !Object.class.equals(nextClass))\n            {\n                if (!processedTypes.contains(nextClass))\n                {\n                    classesToAnalyze.push(nextClass);\n                }\n            }\n        }\n\n        //add meta-data inherited via stereotypes on the node itself\n        inheritedAnnotations.addAll(findViewMetaData(viewConfigNode.getSource(), viewConfigNode));\n\n        return inheritedAnnotations;\n    }\n\n    protected List<Annotation> findViewMetaData(Class currentClass, ViewConfigNode viewConfigNode)\n    {\n        //don't include meta-data from the node itself, because it would be stored as inherited meta-data\n        if (currentClass.equals(viewConfigNode.getSource()))\n        {\n            return Collections.emptyList();\n        }\n\n        List<Annotation> result = new ArrayList<Annotation>();\n\n        for (Annotation annotation : currentClass.getAnnotations())\n        {\n            Class<? extends Annotation> annotationClass = annotation.annotationType();\n\n            if (annotationClass.getName().startsWith(\"java\"))\n            {\n                continue;\n            }\n\n            addViewMetaData(annotation, result);\n        }\n\n        result = tryToReplaceWithMergedMetaDataFromAncestor(currentClass, viewConfigNode.getParent(), result);\n        return result;\n    }\n\n    //only supported for meta-data which isn't aggregated\n    protected List<Annotation> tryToReplaceWithMergedMetaDataFromAncestor(\n        Class currentClass, ViewConfigNode parentViewConfigNode, List<Annotation> foundResult)\n    {\n        ViewConfigNode ancestorNode = findNodeWithClass(currentClass, parentViewConfigNode);\n        if (ancestorNode == null)\n        {\n            return foundResult;\n        }\n\n        List<Annotation> result = new ArrayList<Annotation>(foundResult.size());\n\n        //only replace the meta-data found for the node and don't add all meta-data from the ancestor-node\n        for (Annotation annotation : foundResult)\n        {\n            Annotation finalMetaData = getFinalMetaDataFromNode(ancestorNode, annotation);\n            result.add(finalMetaData);\n        }\n\n        return result;\n    }\n\n    //the meta-data returned by this method is merged and potentially customized by a ConfigPreProcessor\n    private Annotation getFinalMetaDataFromNode(ViewConfigNode viewConfigNode, Annotation annotation)\n    {\n        Class<? extends Annotation> targetType = annotation.annotationType();\n\n        //skip @View and @Folder, because they get created dynamically to support their optional usage\n        //the dynamic generation depends on the level and if it is a synthetic information\n        if (View.class.equals(targetType) || Folder.class.equals(targetType))\n        {\n            return annotation;\n        }\n\n        //skip aggregated meta-data, because it can't be replaced\n        //(there is no info available about the instance which replaced the original one\n        // which might be equivalent to the annotation passed to this method)\n        ViewMetaData viewMetaData = annotation.annotationType().getAnnotation(ViewMetaData.class);\n        if (viewMetaData == null)\n        {\n            return annotation;\n        }\n        Aggregated aggregated = viewMetaData.annotationType().getAnnotation(Aggregated.class);\n        if (aggregated == null || aggregated.value())\n        {\n            return annotation;\n        }\n\n        for (Annotation nodeMetaData : viewConfigNode.getMetaData())\n        {\n            if (targetType.equals(nodeMetaData.annotationType()))\n            {\n                return nodeMetaData;\n            }\n        }\n        return annotation;\n    }\n\n    private ViewConfigNode findNodeWithClass(Class nodeClass, ViewConfigNode viewConfigNode)\n    {\n        if (viewConfigNode == null || nodeClass == null)\n        {\n            return null;\n        }\n\n        if (nodeClass.equals(viewConfigNode.getSource()))\n        {\n            return viewConfigNode;\n        }\n        return findNodeWithClass(nodeClass, viewConfigNode.getParent());\n    }\n\n    protected void addViewMetaData(Annotation currentAnnotation, List<Annotation> metaDataList)\n    {\n        Class<? extends Annotation> annotationClass = currentAnnotation.annotationType();\n\n        if (annotationClass.isAnnotationPresent(ViewMetaData.class))\n        {\n            metaDataList.add(currentAnnotation);\n        }\n\n        if (annotationClass.isAnnotationPresent(Stereotype.class))\n        {\n            for (Annotation inheritedViaStereotype : annotationClass.getAnnotations())\n            {\n                if (inheritedViaStereotype.annotationType().isAnnotationPresent(ViewMetaData.class))\n                {\n                    metaDataList.add(inheritedViaStereotype);\n                }\n            }\n        }\n    }\n\n    protected void addInterfaces(Set<Class> processedTypes, Stack<Class> classesToAnalyze, Class nextClass)\n    {\n        for (Class<?> interfaceToAdd : nextClass.getInterfaces())\n        {\n            addInterfaces(processedTypes, classesToAnalyze, interfaceToAdd);\n\n            if (!processedTypes.contains(interfaceToAdd))\n            {\n                classesToAnalyze.push(interfaceToAdd);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultViewConfigResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.spi.config.view.ConfigDescriptorValidator;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ConfigNodeConverter;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigInheritanceStrategy;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.api.literal.FolderLiteral;\nimport org.apache.deltaspike.jsf.api.literal.ViewLiteral;\nimport org.apache.deltaspike.jsf.impl.util.ViewConfigUtils;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Stack;\n\n@Vetoed\npublic class DefaultViewConfigResolver implements ViewConfigResolver\n{\n    private Map<Class<? extends ViewConfig>, ViewConfigDescriptor> viewDefinitionToViewDefinitionEntryMapping;\n    private Map<String, ViewConfigDescriptor> viewPathToViewDefinitionEntryMapping;\n\n    private Map<Class, ConfigDescriptor> folderDefinitionToViewDefinitionEntryMapping;\n    private Map<String, ConfigDescriptor> folderPathToViewDefinitionEntryMapping;\n\n    private ViewConfigDescriptor defaultErrorView;\n\n    public DefaultViewConfigResolver(ViewConfigNode rootViewConfigNode,\n                                     ConfigNodeConverter configNodeConverter,\n                                     ViewConfigInheritanceStrategy inheritanceStrategy,\n                                     List<ConfigDescriptorValidator> configDescriptorValidators)\n    {\n        Map<Class<? extends ViewConfig>, ViewConfigDescriptor> viewConfigs =\n            new HashMap<Class<? extends ViewConfig>, ViewConfigDescriptor>();\n        Map<Class, ConfigDescriptor> folderConfigs =\n            new HashMap<Class, ConfigDescriptor>();\n\n        Map<String, Class<? extends ViewConfig>> foundViewIds = new HashMap<String, Class<? extends ViewConfig>>();\n\n        Stack<ViewConfigNode> nodesToConvert = new Stack<ViewConfigNode>();\n\n        nodesToConvert.addAll(rootViewConfigNode.getChildren());\n\n        while (!nodesToConvert.empty())\n        {\n            ViewConfigNode currentNode = nodesToConvert.pop();\n\n            //e.g. @View is optional for users, but required from other parts of DeltaSpike -> ensure that it's in place\n            addOptionalMetaDataToConfig(currentNode);\n\n            currentNode.getInheritedMetaData().addAll(inheritanceStrategy.resolveInheritedMetaData(currentNode));\n            ConfigDescriptor currentConfigDescriptor = configNodeConverter.convert(currentNode);\n\n            for (ConfigDescriptorValidator validator : configDescriptorValidators)\n            {\n                if (!validator.isValid(currentConfigDescriptor))\n                {\n                    throw new IllegalStateException(currentConfigDescriptor.getConfigClass().getName() + \" is invalid\");\n                }\n            }\n\n            if (currentConfigDescriptor instanceof ViewConfigDescriptor)\n            {\n                ViewConfigDescriptor currentViewConfigDescriptor = (ViewConfigDescriptor) currentConfigDescriptor;\n\n                if (foundViewIds.containsKey(currentViewConfigDescriptor.getViewId()))\n                {\n                    throw new IllegalStateException(currentViewConfigDescriptor.getViewId() + \" is configured twice. \" +\n                        \"That isn't allowed - see: \" + currentConfigDescriptor.getConfigClass().getName() + \" and \" +\n                        foundViewIds.get(currentViewConfigDescriptor.getViewId()).getName());\n                }\n                else\n                {\n                    foundViewIds.put(\n                        currentViewConfigDescriptor.getViewId(), currentViewConfigDescriptor.getConfigClass());\n                }\n\n                if (this.defaultErrorView == null)\n                {\n                    if (DefaultErrorView.class.isAssignableFrom(currentViewConfigDescriptor.getConfigClass()))\n                    {\n                        this.defaultErrorView = currentViewConfigDescriptor;\n                    }\n                }\n                else if (DefaultErrorView.class.isAssignableFrom(currentViewConfigDescriptor.getConfigClass()))\n                {\n                    throw new IllegalStateException(\"It isn't allowed to configure multiple default-error-views. \" +\n                        \"Found default-error-views: \" + this.defaultErrorView.getConfigClass() + \" and \" +\n                        currentViewConfigDescriptor.getConfigClass().getName());\n                }\n\n                if (!viewConfigs.containsKey(currentViewConfigDescriptor.getConfigClass()))\n                {\n                    viewConfigs.put(currentViewConfigDescriptor.getConfigClass(), currentViewConfigDescriptor);\n                }\n            }\n            else\n            {\n                if (!folderConfigs.containsKey(currentConfigDescriptor.getConfigClass()))\n                {\n                    folderConfigs.put(currentConfigDescriptor.getConfigClass(), currentConfigDescriptor);\n                }\n            }\n\n            nodesToConvert.addAll(currentNode.getChildren());\n        }\n\n        this.viewDefinitionToViewDefinitionEntryMapping = Collections.unmodifiableMap(viewConfigs);\n        this.folderDefinitionToViewDefinitionEntryMapping = Collections.unmodifiableMap(folderConfigs);\n\n        initCaches();\n    }\n\n    protected void addOptionalMetaDataToConfig(ViewConfigNode currentNode)\n    {\n        Class sourceClass = currentNode.getSource();\n        if (ViewConfigUtils.isFolderConfig(sourceClass))\n        {\n            for (Annotation annotation : currentNode.getMetaData())\n            {\n                if (annotation.annotationType().equals(Folder.class))\n                {\n                    return;\n                }\n            }\n            currentNode.getMetaData().add(new FolderLiteral(true));\n            return;\n        }\n\n        for (Annotation annotation : currentNode.getMetaData())\n        {\n            if (annotation.annotationType().equals(View.class))\n            {\n                return;\n            }\n        }\n\n        currentNode.getMetaData().add(new ViewLiteral(true));\n    }\n\n    @Override\n    public ConfigDescriptor<?> getConfigDescriptor(String path)\n    {\n        if (path == null)\n        {\n            return null;\n        }\n\n        ConfigDescriptor result = this.folderPathToViewDefinitionEntryMapping.get(path);\n\n        if (result == null)\n        {\n            result = getViewConfigDescriptor(path); //TODO re-visit it\n        }\n\n        return result;\n    }\n\n    @Override\n    public ViewConfigDescriptor getViewConfigDescriptor(String viewId)\n    {\n        if (viewId == null)\n        {\n            return null;\n        }\n\n        return this.viewPathToViewDefinitionEntryMapping.get(viewId);\n    }\n\n    @Override\n    public ConfigDescriptor<?> getConfigDescriptor(Class configClass)\n    {\n        ConfigDescriptor result = null;\n        if (ViewConfig.class.isAssignableFrom(configClass))\n        {\n            result = getViewConfigDescriptor(configClass);\n        }\n\n        if (result == null)\n        {\n            result = this.folderDefinitionToViewDefinitionEntryMapping.get(configClass);\n        }\n\n        return result;\n    }\n\n    @Override\n    public List<ConfigDescriptor<?>> getConfigDescriptors()\n    {\n        ConfigDescriptor<?>[] folderResult = this.folderDefinitionToViewDefinitionEntryMapping.values()\n                .toArray(new ConfigDescriptor<?>[this.folderDefinitionToViewDefinitionEntryMapping.size()]);\n\n        ConfigDescriptor<?>[] viewResult = this.viewDefinitionToViewDefinitionEntryMapping.values()\n                .toArray(new ConfigDescriptor<?>[this.viewDefinitionToViewDefinitionEntryMapping.size()]);\n\n        List<ConfigDescriptor<?>> result = new ArrayList<ConfigDescriptor<?>>();\n        result.addAll(Arrays.asList(folderResult));\n        result.addAll(Arrays.asList(viewResult));\n        return result;\n    }\n\n    @Override\n    public ViewConfigDescriptor getViewConfigDescriptor(Class<? extends ViewConfig> viewDefinitionClass)\n    {\n        if (DefaultErrorView.class.equals(viewDefinitionClass))\n        {\n            return getDefaultErrorViewConfigDescriptor();\n        }\n        return this.viewDefinitionToViewDefinitionEntryMapping.get(viewDefinitionClass);\n    }\n\n    @Override\n    public List<ViewConfigDescriptor> getViewConfigDescriptors()\n    {\n        ViewConfigDescriptor[] result = this.viewDefinitionToViewDefinitionEntryMapping.values()\n                .toArray(new ViewConfigDescriptor[this.viewDefinitionToViewDefinitionEntryMapping.size()]);\n\n        return new ArrayList<ViewConfigDescriptor>(Arrays.asList(result));\n    }\n\n    @Override\n    public ViewConfigDescriptor getDefaultErrorViewConfigDescriptor()\n    {\n        return this.defaultErrorView;\n    }\n\n    protected void initCaches()\n    {\n        //folders\n        Map<String, ConfigDescriptor> folderPathMapping = new HashMap<String, ConfigDescriptor>();\n        for (ConfigDescriptor folderConfigDescriptor : this.folderDefinitionToViewDefinitionEntryMapping.values())\n        {\n            if (folderPathMapping.containsKey(folderConfigDescriptor.toString()))\n            {\n                throw new IllegalStateException(\"Duplicated config for the same folder configured. See: \" +\n                    folderPathMapping.get(\n                            folderConfigDescriptor.toString()).getConfigClass().getName() +\n                    \" and \" + folderConfigDescriptor.getConfigClass().getName());\n            }\n            folderPathMapping.put(folderConfigDescriptor.getPath(), folderConfigDescriptor);\n        }\n        this.folderPathToViewDefinitionEntryMapping = Collections.unmodifiableMap(folderPathMapping);\n\n        //pages\n        Map<String, ViewConfigDescriptor> viewPathMapping = new HashMap<String, ViewConfigDescriptor>();\n        for (ViewConfigDescriptor pageConfigDescriptor : this.viewDefinitionToViewDefinitionEntryMapping.values())\n        {\n            if (viewPathMapping.containsKey(pageConfigDescriptor.getViewId()))\n            {\n                throw new IllegalStateException(\"Duplicated config for the same page configured. See: \" +\n                        viewPathMapping.get(\n                            pageConfigDescriptor.getViewId()).getConfigClass().getName() +\n                    \" and \" + pageConfigDescriptor.getConfigClass().getName());\n            }\n            viewPathMapping.put(pageConfigDescriptor.getPath(), pageConfigDescriptor);\n        }\n        this.viewPathToViewDefinitionEntryMapping = Collections.unmodifiableMap(viewPathMapping);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultViewPathConfigDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\nimport java.util.Map;\n\nclass DefaultViewPathConfigDescriptor\n        extends AbstractPathConfigDescriptor<ViewConfig>\n        implements ViewConfigDescriptor\n{\n    private final String viewId;\n\n    DefaultViewPathConfigDescriptor(String viewId,\n                                    Class<? extends ViewConfig> configClass,\n                                    List<Annotation> mergedMetaData,\n                                    Map<Class<? extends Annotation>, List<CallbackDescriptor>> callbackDescriptors)\n    {\n        super(configClass, mergedMetaData, callbackDescriptors);\n        this.viewId = viewId;\n    }\n\n    @Override\n    public String getPath()\n    {\n        return this.viewId;\n    }\n\n    @Override\n    public String getViewId()\n    {\n        return this.viewId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport java.lang.annotation.Annotation;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\npublic class FolderConfigNode extends AbstractConfigNode\n{\n    //not all interfaces have to implement the ViewConfig interface\n    private final Class<?> nodeId;\n\n    public FolderConfigNode(Class<?> nodeId, ViewConfigNode parent, Set<Annotation> nodeMetaData)\n    {\n        super(parent, nodeMetaData);\n        this.nodeId = nodeId;\n    }\n\n    public FolderConfigNode(ViewConfigNode nodeToCopy, Class viewConfigClass)\n    {\n        super(nodeToCopy.getParent(), nodeToCopy.getMetaData());\n        getInheritedMetaData().addAll(nodeToCopy.getInheritedMetaData());\n        getChildren().addAll(nodeToCopy.getChildren());\n\n        for (Map.Entry<Class<? extends Annotation>, List<CallbackDescriptor>> callbackDescriptorEntry :\n                nodeToCopy.getCallbackDescriptors().entrySet())\n        {\n            for (CallbackDescriptor callbackDescriptor : callbackDescriptorEntry.getValue())\n            {\n                registerCallbackDescriptors(callbackDescriptorEntry.getKey(), callbackDescriptor);\n            }\n        }\n        this.nodeId = viewConfigClass;\n    }\n\n    @Override\n    public Class<?> getSource()\n    {\n        return this.nodeId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/PageViewConfigNode.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Set;\n\npublic class PageViewConfigNode extends AbstractConfigNode\n{\n    private final Class<? extends ViewConfig> nodeId;\n\n    public PageViewConfigNode(Class<? extends ViewConfig> nodeId, ViewConfigNode parent, Set<Annotation> nodeMetaData)\n    {\n        super(parent, nodeMetaData);\n        this.nodeId = nodeId;\n    }\n\n    @Override\n    public Class<? extends ViewConfig> getSource()\n    {\n        return this.nodeId;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/ViewConfigExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.ViewRef;\nimport org.apache.deltaspike.core.spi.config.view.ConfigDescriptorValidator;\nimport org.apache.deltaspike.core.api.config.view.metadata.InlineViewMetaData;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.spi.config.view.ConfigNodeConverter;\nimport org.apache.deltaspike.core.spi.config.view.InlineMetaDataTransformer;\nimport org.apache.deltaspike.core.spi.config.view.TargetViewConfigProvider;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigInheritanceStrategy;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigRoot;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.impl.util.ViewConfigUtils;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterDeploymentValidation;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.BeforeShutdown;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Constructor;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\npublic class ViewConfigExtension implements Extension, Deactivatable\n{\n    private boolean isActivated = true;\n\n    private ViewConfigNode rootViewConfigNode;\n\n    private ViewConfigResolver viewConfigResolver;\n    private boolean transformed = false;\n\n    {\n        resetRootNode();\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        this.isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    protected void buildViewConfigMetaDataTree(@Observes final ProcessAnnotatedType pat)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        buildViewConfigMetaDataTreeFor(\n            pat.getAnnotatedType().getJavaClass(), pat.getAnnotatedType().getAnnotations(), new VetoCallback() {\n                    @Override\n                    public void veto()\n                    {\n                        pat.veto();\n                    }\n                });\n    }\n\n    protected void buildViewConfigMetaDataTreeFor(Class beanClass,\n                                                  Set<Annotation> annotations,\n                                                  VetoCallback vetoCallback)\n    {\n        if (ViewConfig.class.isAssignableFrom(beanClass))\n        {\n            addConfigClass(beanClass, annotations);\n            vetoCallback.veto();\n        }\n        else\n        {\n            if (ViewConfigUtils.isFolderConfig(beanClass) && beanClass.isAnnotationPresent(Folder.class))\n            {\n                addConfigClass(beanClass, annotations);\n                vetoCallback.veto();\n            }\n            else\n            {\n                addIndirectlyInheritedMetaData(beanClass, annotations);\n            }\n        }\n    }\n\n    public void addIndirectlyInheritedMetaData(Class configClass)\n    {\n        addIndirectlyInheritedMetaData(\n            configClass, new HashSet<Annotation>(Arrays.asList(configClass.getAnnotations())));\n    }\n\n    protected void addIndirectlyInheritedMetaData(Class configClass, Set<Annotation> annotations)\n    {\n        for (Annotation annotation : annotations)\n        {\n            InlineViewMetaData inlineViewMetaData = annotation.annotationType().getAnnotation(InlineViewMetaData.class);\n            if (inlineViewMetaData != null)\n            {\n                Class<? extends TargetViewConfigProvider> targetViewConfigProviderClass =\n                        inlineViewMetaData.targetViewConfigProvider();\n                TargetViewConfigProvider targetViewConfigProvider =\n                        ClassUtils.tryToInstantiateClass(targetViewConfigProviderClass);\n\n                for (Class<? extends ViewConfig> viewConfigRef : targetViewConfigProvider.getTarget(annotation))\n                {\n                    ViewConfigNode viewConfigNode = findNode(viewConfigRef);\n\n                    if (viewConfigNode == null)\n                    {\n                        addPageDefinition(viewConfigRef);\n                        viewConfigNode = findNode(viewConfigRef);\n\n                        if (viewConfigNode == null)\n                        {\n                            throw new IllegalStateException(\"No node created for: \" + viewConfigRef);\n                        }\n                    }\n\n                    Class<? extends InlineMetaDataTransformer> inlineNodeTransformerClass =\n                            inlineViewMetaData.inlineMetaDataTransformer();\n\n                    if (!InlineMetaDataTransformer.class.equals(inlineNodeTransformerClass))\n                    {\n                        InlineMetaDataTransformer inlineMetaDataTransformer =\n                                ClassUtils.tryToInstantiateClass(inlineNodeTransformerClass);\n\n                        viewConfigNode.getInheritedMetaData().add(\n                                inlineMetaDataTransformer.convertToViewMetaData(annotation, configClass));\n                    }\n                    else //no custom transformer registered -> add the annotation itself\n                    {\n                        viewConfigNode.getInheritedMetaData().add(annotation);\n                    }\n                }\n                break;\n            }\n        }\n    }\n\n    public void addPageDefinition(Class<? extends ViewConfig> viewConfigClass)\n    {\n        addConfigClass(viewConfigClass, new HashSet<Annotation>(Arrays.asList(viewConfigClass.getAnnotations())));\n    }\n\n    public void addFolderDefinition(Class configClass)\n    {\n        if (ViewConfigUtils.isFolderConfig(configClass))\n        {\n            addConfigClass(configClass, new HashSet<Annotation>(Arrays.asList(configClass.getAnnotations())));\n        }\n        else\n        {\n            throw new IllegalArgumentException(configClass != null ? configClass.getName() : \"null\" +\n                \" is an invalid config for folders\");\n        }\n    }\n\n    protected void addConfigClass(Class viewConfigClass, Set<Annotation> viewConfigAnnotations)\n    {\n        if (isInternal(viewConfigClass))\n        {\n            return;\n        }\n\n        String className = viewConfigClass.getName();\n        if (!className.contains(\".\"))\n        {\n            if (className.contains(\"$\"))\n            {\n                className = className.substring(0, className.indexOf(\"$\"));\n            }\n\n            throw new IllegalStateException(\"Please move the class '\" + className + \"' to a package!\");\n        }\n\n        for (Annotation annotation : viewConfigAnnotations)\n        {\n            if (annotation.annotationType().equals(ViewConfigRoot.class))\n            {\n                if (this.rootViewConfigNode.getSource() != null)\n                {\n                    throw new IllegalStateException(\"@\" + ViewConfigRoot.class.getName() + \" has been found at \" +\n                            viewConfigClass.getName() + \" and \" + this.rootViewConfigNode.getSource().getName());\n                }\n                this.rootViewConfigNode.getMetaData().add(annotation);\n                this.rootViewConfigNode = new FolderConfigNode(this.rootViewConfigNode, viewConfigClass);\n\n                //needed for cdi 1.1+ with bean-discovery-mode 'annotated'\n                if (viewConfigClass.getAnnotation(ApplicationScoped.class) != null)\n                {\n                    Set<Class> manuallyDiscoveredViewConfigs = new HashSet<Class>();\n                    findNestedClasses(viewConfigClass, manuallyDiscoveredViewConfigs);\n\n                    for (Class foundClass : manuallyDiscoveredViewConfigs)\n                    {\n                        buildViewConfigMetaDataTreeFor(\n                            foundClass,\n                            new HashSet<Annotation>(Arrays.asList(foundClass.getAnnotations())),\n                            new VetoCallback() {\n                                @Override\n                                public void veto()\n                                {\n\n                                }\n                            });\n                    }\n                }\n                break;\n            }\n        }\n\n        List<Class> treePath = ViewConfigUtils.toNodeList(viewConfigClass);\n\n        ViewConfigNode previousRootNode = null;\n        for (Class currentNode : treePath)\n        {\n            //can only return a node if a folder was added already\n            ViewConfigNode baseNode = findNode(currentNode);\n            if (baseNode == null)\n            {\n                Set<Annotation> metaData = viewConfigAnnotations;\n\n                if (!currentNode.equals(viewConfigClass)) //small tweak\n                {\n                    metaData = new HashSet<Annotation>(Arrays.asList(currentNode.getAnnotations()));\n                }\n\n                previousRootNode = addNode(previousRootNode, currentNode, metaData);\n            }\n            else\n            {\n                previousRootNode = baseNode;\n            }\n        }\n    }\n\n    private void findNestedClasses(Class viewConfigClass, Set<Class> nestedClasses)\n    {\n        for (Class nestedClass : viewConfigClass.getDeclaredClasses())\n        {\n            nestedClasses.add(nestedClass);\n            findNestedClasses(nestedClass, nestedClasses);\n        }\n    }\n\n    private boolean isInternal(Class configClass)\n    {\n        return ViewConfig.class.equals(configClass) ||\n                DefaultErrorView.class.equals(configClass) ||\n                ViewRef.Manual.class.equals(configClass);\n    }\n\n    private ViewConfigNode addNode(ViewConfigNode parentNode, Class idOfNewNode, Set<Annotation> viewConfigAnnotations)\n    {\n        if (parentNode == null)\n        {\n            parentNode = this.rootViewConfigNode;\n        }\n\n        ViewConfigNode viewConfigNode;\n\n        if (ViewConfigUtils.isFolderConfig(idOfNewNode))\n        {\n            viewConfigNode = new FolderConfigNode(idOfNewNode, parentNode, viewConfigAnnotations);\n        }\n        else\n        {\n            viewConfigNode = new PageViewConfigNode(\n                    (Class<? extends ViewConfig>) idOfNewNode, parentNode, viewConfigAnnotations);\n        }\n\n        parentNode.getChildren().add(viewConfigNode);\n        return viewConfigNode;\n    }\n\n    public ViewConfigNode findNode(Class nodeClass)\n    {\n        if (nodeClass == null)\n        {\n            return null;\n        }\n\n        List<Class> path = ViewConfigUtils.toNodeList(nodeClass);\n\n        ViewConfigNode currentNode = this.rootViewConfigNode;\n\n    next:\n        for (int i = 0; i < path.size(); i++)\n        {\n            Class nodeId = path.get(i);\n\n            for (ViewConfigNode node : currentNode.getChildren())\n            {\n                if (node.getSource().equals(nodeId))\n                {\n                    currentNode = node;\n                    if (i == (path.size() - 1))\n                    {\n                        return currentNode;\n                    }\n                    continue next;\n                }\n            }\n            return null;\n        }\n        return null;\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public void buildViewConfig(@Observes AfterDeploymentValidation adv)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        //needed to transform the metadata-tree during the bootstrapping process\n        transformMetaDataTree();\n        this.transformed = true;\n    }\n\n    protected void transformMetaDataTree()\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        if (this.viewConfigResolver == null)\n        {\n            ConfigNodeConverter configNodeConverter = new DefaultConfigNodeConverter();\n            ViewConfigInheritanceStrategy inheritanceStrategy = new DefaultViewConfigInheritanceStrategy();\n            List<ConfigDescriptorValidator> configDescriptorValidators = new ArrayList<ConfigDescriptorValidator>();\n\n            for (Annotation annotation : this.rootViewConfigNode.getMetaData())\n            {\n                if (annotation.annotationType().equals(ViewConfigRoot.class))\n                {\n                    ViewConfigRoot viewConfigRoot = (ViewConfigRoot) annotation;\n\n                    configNodeConverter = createCustomConfigNodeConverter(viewConfigRoot, configNodeConverter);\n                    inheritanceStrategy = createCustomInheritanceStrategy(viewConfigRoot, inheritanceStrategy);\n\n                    configDescriptorValidators = createCustomConfigDescriptorValidators(viewConfigRoot);\n                    this.viewConfigResolver = createCustomViewConfigResolver(\n                            viewConfigRoot, configNodeConverter, inheritanceStrategy, configDescriptorValidators);\n                    break;\n                }\n            }\n\n            if (this.viewConfigResolver == null)\n            {\n                this.viewConfigResolver = new DefaultViewConfigResolver(\n                        this.rootViewConfigNode, configNodeConverter, inheritanceStrategy, configDescriptorValidators);\n            }\n            resetRootNode();\n        }\n    }\n\n    private ViewConfigResolver createCustomViewConfigResolver(ViewConfigRoot viewConfigRoot,\n                                                              ConfigNodeConverter configNodeConverter,\n                                                              ViewConfigInheritanceStrategy inheritanceStrategy,\n                                                              List<ConfigDescriptorValidator> validators)\n    {\n        Class<? extends ViewConfigResolver> viewConfigResolverClass = viewConfigRoot.viewConfigResolver();\n        if (!ViewConfigResolver.class.equals(viewConfigResolverClass))\n        {\n            try\n            {\n                Constructor<? extends ViewConfigResolver> viewConfigResolverConstructor = viewConfigResolverClass\n                        .getConstructor(new Class[]{\n                            ViewConfigNode.class,\n                            ConfigNodeConverter.class,\n                            ViewConfigInheritanceStrategy.class,\n                            List.class});\n\n                return viewConfigResolverConstructor\n                        .newInstance(this.rootViewConfigNode, configNodeConverter, inheritanceStrategy, validators);\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n        return null;\n    }\n\n    private ConfigNodeConverter createCustomConfigNodeConverter(ViewConfigRoot viewConfigRoot,\n                                                                ConfigNodeConverter defaultConverter)\n    {\n        Class<? extends ConfigNodeConverter> converterClass = viewConfigRoot.configNodeConverter();\n\n        if (!ConfigNodeConverter.class.equals(converterClass))\n        {\n            try\n            {\n                return converterClass.newInstance();\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n        return defaultConverter;\n    }\n\n    private ViewConfigInheritanceStrategy createCustomInheritanceStrategy(ViewConfigRoot viewConfigRoot,\n                                                                          ViewConfigInheritanceStrategy defaultStrategy)\n    {\n        Class<? extends ViewConfigInheritanceStrategy> strategyClass = viewConfigRoot.viewConfigInheritanceStrategy();\n\n        if (!ViewConfigInheritanceStrategy.class.equals(strategyClass))\n        {\n            try\n            {\n                return strategyClass.newInstance();\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n        return defaultStrategy;\n    }\n\n    private List<ConfigDescriptorValidator> createCustomConfigDescriptorValidators(ViewConfigRoot viewConfigRoot)\n    {\n        List<ConfigDescriptorValidator> result = new ArrayList<ConfigDescriptorValidator>();\n\n        for (Class<? extends ConfigDescriptorValidator> validatorClass : viewConfigRoot.configDescriptorValidators())\n        {\n            try\n            {\n                ConfigDescriptorValidator validator = validatorClass.newInstance();\n                result.add(validator);\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        return result;\n    }\n\n    public void freeViewConfigCache(@Observes BeforeShutdown bs)\n    {\n        this.viewConfigResolver = null;\n        this.transformed = false;\n    }\n\n    private void resetRootNode()\n    {\n        this.rootViewConfigNode = new FolderConfigNode(null, null, new HashSet<Annotation>());\n    }\n\n    boolean isActivated()\n    {\n        return isActivated;\n    }\n\n    boolean isTransformed()\n    {\n        return transformed;\n    }\n\n    ViewConfigResolver getViewConfigResolver()\n    {\n        return viewConfigResolver;\n    }\n\n    interface VetoCallback\n    {\n        void veto();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/ViewConfigPathValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport jakarta.servlet.ServletContextEvent;\nimport jakarta.servlet.ServletContextListener;\nimport java.net.MalformedURLException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\npublic class ViewConfigPathValidator implements ServletContextListener, Deactivatable\n{\n    private static final Logger LOGGER = Logger.getLogger(ViewConfigPathValidator.class.getName());\n\n    @Override\n    public void contextInitialized(ServletContextEvent sce)\n    {\n        if (ClassDeactivationUtils.isActivated(getClass()))\n        {\n            ViewConfigResolver viewConfigResolver;\n\n            try\n            {\n                viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);\n            }\n            catch (Exception e)\n            {\n                LOGGER.log(Level.WARNING, \"Container issue detected -> can't validate view-configs. \" +\n                    \"This exception is usually the effect (but not the reason) of a failed startup. \" +\n                    \"You can deactivate \" + getClass().getName() + \" via a custom \" +\n                    ClassDeactivator.class.getName() + \" to verify it.\", e);\n                return;\n            }\n\n            List<String> supportedExtensions = new ArrayList<String>();\n            supportedExtensions.add(View.Extension.XHTML);\n            supportedExtensions.add(View.Extension.JSP);\n            validateViewConfigPaths(sce, viewConfigResolver, supportedExtensions);\n        }\n    }\n\n    //allows to test and re-use it in a custom listener\n    // (if a custom listener is needed for supporting custom extensions or\n    // this listener is deactivated e.g. to change the order)\n    protected void validateViewConfigPaths(ServletContextEvent sce,\n                                           ViewConfigResolver viewConfigResolver,\n                                           List<String> supportedExtensions)\n    {\n        for (ConfigDescriptor configDescriptor : viewConfigResolver.getConfigDescriptors())\n        {\n            try\n            {\n                if (configDescriptor instanceof ViewConfigDescriptor)\n                {\n                    //currently other extensions aren't supported\n                    String viewId = ((ViewConfigDescriptor) configDescriptor).getViewId();\n                    String extension = viewId.substring(viewId.lastIndexOf('.') + 1);\n\n                    if (!supportedExtensions.contains(extension))\n                    {\n                        continue;\n                    }\n                }\n\n                if (!isValidPath(sce, configDescriptor))\n                {\n                    if (configDescriptor instanceof DefaultFolderConfigDescriptor &&\n                        !configDescriptor.getConfigClass().isAnnotationPresent(Folder.class))\n                    {\n\n                        LOGGER.fine(configDescriptor.getConfigClass().getName() + \" looks like a marker interface\" +\n                            \" only used for providing meta-data, because the path \" + configDescriptor.getPath() +\n                            \" doesn't exist and the config-class isn't annotated with \" + Folder.class.getName());\n\n                        continue;\n                    }\n\n                    throw new IllegalStateException(\"path '\" + configDescriptor.getPath() +\n                            \"' is missing, but mapped by: \" + configDescriptor.getConfigClass().getName());\n                }\n            }\n            catch (Exception e)\n            {\n                printException(e);\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n    }\n\n    protected boolean isValidPath(ServletContextEvent sce, ConfigDescriptor configDescriptor)\n    {\n        try\n        {\n            return sce.getServletContext().getResource(configDescriptor.getPath()) != null;\n        }\n        catch (MalformedURLException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    protected void printException(Exception e)\n    {\n        //for easier analysis (in combination with several servers)\n        LOGGER.log(Level.SEVERE, \"invalid view-config found\", e);\n    }\n\n    @Override\n    public void contextDestroyed(ServletContextEvent sce)\n    {\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/ViewConfigResolverProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.spi.config.view.ConfigDescriptorValidator;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.inject.Inject;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.logging.Logger;\n\n@ApplicationScoped\npublic class ViewConfigResolverProducer\n{\n    private static final Logger LOG = Logger.getLogger(ViewConfigResolverProducer.class.getName());\n\n    @Inject\n    private ViewConfigExtension viewConfigExtension;\n\n    public ViewConfigResolverProducer()\n    {\n    }\n\n    public ViewConfigResolverProducer(ViewConfigExtension viewConfigExtension)\n    {\n        this.viewConfigExtension = viewConfigExtension;\n    }\n\n    @Produces\n    @ApplicationScoped\n    public ViewConfigResolver createViewConfigResolver()\n    {\n        if (!viewConfigExtension.isActivated())\n        {\n            return createEmptyDefaultViewConfigResolver();\n        }\n\n        if (!viewConfigExtension.isTransformed()) //esp. for easier unit-tests\n        {\n            viewConfigExtension.transformMetaDataTree();\n        }\n        ViewConfigResolver viewConfigResolver = viewConfigExtension.getViewConfigResolver();\n\n        if (viewConfigResolver == null)\n        {\n            LOG.warning(\"It wasn't possible to create a ViewConfigResolver\");\n            viewConfigResolver = createEmptyDefaultViewConfigResolver();\n        }\n\n        return viewConfigResolver;\n    }\n\n    private DefaultViewConfigResolver createEmptyDefaultViewConfigResolver()\n    {\n        return new DefaultViewConfigResolver(\n            new FolderConfigNode(\n                null, null, new HashSet<Annotation>()), null, null, new ArrayList<ConfigDescriptorValidator>());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/ViewControllerActionListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view;\n\nimport org.apache.deltaspike.core.api.config.view.controller.PreViewAction;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.jsf.impl.util.ViewControllerUtils;\n\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.event.ActionEvent;\nimport jakarta.faces.event.ActionListener;\n\n/**\n * ActionListener which invokes {@link PreViewAction} callbacks of page-beans\n */\npublic class ViewControllerActionListener implements ActionListener, Deactivatable\n{\n    private final ActionListener wrapped;\n\n    private final boolean activated;\n\n    /**\n     * Constructor for wrapping the given {@link ActionListener}\n     * @param wrapped action-listener which should be wrapped\n     */\n    public ViewControllerActionListener(ActionListener wrapped)\n    {\n        this.wrapped = wrapped;\n        this.activated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public void processAction(ActionEvent actionEvent)\n    {\n        if (this.activated)\n        {\n            ViewConfigDescriptor viewConfigDescriptor = BeanProvider.getContextualReference(ViewConfigResolver.class)\n                    .getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n            ViewControllerUtils.executeViewControllerCallback(viewConfigDescriptor, PreViewAction.class);\n        }\n\n        this.wrapped.processAction(actionEvent);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/DefaultNavigationParameterContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Request scoped storage for page-parameters.\n * Can be used to add parameters dynamically to the final navigation string\n */\n@RequestScoped\npublic class DefaultNavigationParameterContext implements NavigationParameterContext\n{\n    private static final long serialVersionUID = 6027959542775130265L;\n\n    private Map<String, String> parameters = new HashMap<String, String>();\n\n    protected DefaultNavigationParameterContext()\n    {\n    }\n\n    public Map<String, String> getPageParameters()\n    {\n        return Collections.unmodifiableMap(this.parameters);\n    }\n\n    public void addPageParameter(String key, Object param)\n    {\n        if (param == null)\n        {\n            this.parameters.remove(key);\n            return;\n        }\n\n        String value = param.toString().trim();\n\n        if (value.startsWith(\"#{\") && value.endsWith(\"}\"))\n        {\n            value = JsfUtils.getValueOfExpressionAsString(value);\n        }\n\n        //simple version - we could add multi-ref support, if we really need it\n        //but this method might be called multiple times for the same parameter/s\n        this.parameters.put(key, value);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/DefaultNavigationParameterStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\nimport org.apache.deltaspike.jsf.spi.config.view.navigation.NavigationParameterStrategy;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n@Dependent\npublic class DefaultNavigationParameterStrategy implements NavigationParameterStrategy\n{\n    private static final long serialVersionUID = 198321901578229292L;\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    @Override\n    public Object execute(InvocationContext ic) throws Exception\n    {\n        List<NavigationParameter> parameterList = new ArrayList<NavigationParameter>();\n\n        NavigationParameter navigationParameter = ic.getMethod().getAnnotation(NavigationParameter.class);\n\n        if (navigationParameter != null)\n        {\n            parameterList.add(navigationParameter);\n        }\n\n        NavigationParameter.List navigationParameterList = ic.getMethod().getAnnotation(NavigationParameter.List.class);\n\n        if (navigationParameterList != null)\n        {\n            Collections.addAll(parameterList, navigationParameterList.value());\n        }\n\n        for (NavigationParameter currentParameter : parameterList)\n        {\n            JsfUtils.addStaticNavigationParameter(\n                this.navigationParameterContext, currentParameter.key(), currentParameter.value());\n        }\n\n        return ic.proceed();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/DefaultViewNavigationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.faces.context.FacesContext;\n\n/**\n * Navigation handler for view-configs\n */\n@ApplicationScoped\npublic class DefaultViewNavigationHandler implements ViewNavigationHandler\n{\n    protected DefaultViewNavigationHandler()\n    {\n    }\n\n    @Override\n    public void navigateTo(Class<? extends ViewConfig> targetView)\n    {\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n        facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, targetView.getName());\n        facesContext.renderResponse();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/NavigationCaseMapWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\nimport org.apache.deltaspike.jsf.impl.util.RequestParameter;\n\nimport jakarta.faces.application.ConfigurableNavigationHandler;\nimport jakarta.faces.application.NavigationCase;\nimport jakarta.faces.application.NavigationHandler;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.Map;\nimport java.util.HashSet;\nimport java.util.HashMap;\nimport java.util.Collection;\nimport java.util.logging.Logger;\n\n/**\n * Destructive operations aren't supported (compared to the SubKeyMap used in MyFaces).\n * Reason: It isn't allowed to remove navigation cases\n * (which are based on {@link org.apache.deltaspike.core.api.config.view.ViewConfig})\n */\npublic class NavigationCaseMapWrapper implements Map<String, Set<NavigationCase>>\n{\n    private static final Logger LOG = Logger.getLogger(NavigationCaseMapWrapper.class.getName());\n\n    private Map<String, Set<NavigationCase>> wrappedNavigationCaseMap;\n    private final NavigationHandler wrapped;\n    private final Map<String, Set<NavigationCase>> viewConfigBasedNavigationCaseCache;\n\n    /**\n     * Constructor for wrapping the given navigation-cases\n     *\n     * @param navigationCases current navigation-cases\n     * @param wrapped wrapped navigation-handler\n     */\n    public NavigationCaseMapWrapper(Map<String, Set<NavigationCase>> navigationCases, NavigationHandler wrapped)\n    {\n        this.wrappedNavigationCaseMap = navigationCases;\n        this.wrapped = wrapped;\n        this.viewConfigBasedNavigationCaseCache = createViewConfigBasedNavigationCases(false);\n    }\n\n    private Map<String, Set<NavigationCase>> createViewConfigBasedNavigationCases(boolean allowParameters)\n    {\n        Map<String, Set<NavigationCase>> result;\n\n        if (this.wrapped instanceof ConfigurableNavigationHandler)\n        {\n            result = new DelegatingMap((ConfigurableNavigationHandler)this.wrapped);\n        }\n        else\n        {\n            LOG.warning(\"the wrapped navigation-handler doesn't extend \" +\n                ConfigurableNavigationHandler.class.getName() +\n                    \". therefore std. navigation-rules might not work correctly with mojarra\");\n            result = new HashMap<String, Set<NavigationCase>>();\n        }\n\n        Collection<ViewConfigDescriptor> viewConfigDescriptors =\n                BeanProvider.getContextualReference(ViewConfigResolver.class).getViewConfigDescriptors();\n\n        if (!viewConfigDescriptors.isEmpty())\n        {\n            Set<NavigationCase> navigationCase = new HashSet<NavigationCase>();\n\n            Map<String, List<String>> parameters = null;\n\n            if (allowParameters)\n            {\n                parameters = resolveParameters();\n            }\n\n            boolean includeParameters;\n\n            for (ViewConfigDescriptor entry : viewConfigDescriptors)\n            {\n                View viewMetaData = entry.getMetaData(View.class).iterator().next();\n                includeParameters = View.ViewParameterMode.INCLUDE\n                        .equals(viewMetaData.viewParams());\n\n                navigationCase.add(new NavigationCase(\"*\",\n                        null,\n                        null,\n                        null,\n                        entry.getViewId(),\n                        includeParameters ? parameters : null,\n                        View.NavigationMode.REDIRECT.equals(viewMetaData.navigation()),\n                        includeParameters));\n\n                result.put(entry.getViewId(), navigationCase);\n            }\n        }\n        return result;\n    }\n\n    private Map<String, List<String>> resolveParameters()\n    {\n        Map<String, List<String>> parameters = new HashMap<String, List<String>>();\n\n        for (RequestParameter parameter : JsfUtils.getViewConfigPageParameters())\n        {\n            parameters.put(parameter.getKey(), parameter.getValueList());\n        }\n\n        return parameters;\n    }\n\n    /**\n     * @return the final size (might be a combination of the configured navigation cases (via XML) and the\n     *         {@link org.apache.deltaspike.core.api.config.view.ViewConfig}s\n     */\n    @Override\n    public int size()\n    {\n        return this.wrappedNavigationCaseMap.size() + this.viewConfigBasedNavigationCaseCache.size();\n    }\n\n    @Override\n    public boolean isEmpty()\n    {\n        return this.wrappedNavigationCaseMap.isEmpty() &&\n                this.viewConfigBasedNavigationCaseCache.isEmpty();\n    }\n\n    @Override\n    public boolean containsKey(Object key)\n    {\n        return this.wrappedNavigationCaseMap.containsKey(key) ||\n                this.viewConfigBasedNavigationCaseCache.containsKey(key);\n    }\n\n    @Override\n    public boolean containsValue(Object value)\n    {\n        return this.wrappedNavigationCaseMap.containsValue(value) ||\n                this.viewConfigBasedNavigationCaseCache.containsValue(value);\n    }\n\n    /**\n     * XML configuration overrules {@link org.apache.deltaspike.core.api.config.view.ViewConfig}s\n     */\n    @Override\n    public Set<NavigationCase> get(Object key)\n    {\n        Set<NavigationCase> result = this.wrappedNavigationCaseMap.get(key);\n\n        if (result == null)\n        {\n            return createViewConfigBasedNavigationCases(true).get(key);\n        }\n        return result;\n    }\n\n    @Override\n    public Set<NavigationCase> put(String key, Set<NavigationCase> value)\n    {\n        return this.wrappedNavigationCaseMap.put(key, value);\n    }\n\n    @Override\n    public Set<NavigationCase> remove(Object key)\n    {\n        return this.wrappedNavigationCaseMap.remove(key);\n    }\n\n    @Override\n    public void putAll(Map<? extends String, ? extends Set<NavigationCase>> m)\n    {\n        this.wrappedNavigationCaseMap.putAll(m);\n    }\n\n    @Override\n    public void clear()\n    {\n        this.wrappedNavigationCaseMap.clear();\n    }\n\n    /**\n     * @return a combination of navigation-cases configured via XML and\n     *         {@link org.apache.deltaspike.core.api.config.view.ViewConfig}s\n     */\n    @Override\n    public Set<String> keySet()\n    {\n        Set<String> result = new HashSet<String>();\n        result.addAll(this.wrappedNavigationCaseMap.keySet());\n        result.addAll(this.viewConfigBasedNavigationCaseCache.keySet());\n        return result;\n    }\n\n    /**\n     * @return a combination of navigation-cases configured via XML and\n     *         {@link org.apache.deltaspike.core.api.config.view.ViewConfig}s\n     */\n    @Override\n    public Collection<Set<NavigationCase>> values()\n    {\n        Collection<Set<NavigationCase>> result = new HashSet<Set<NavigationCase>>();\n\n        result.addAll(this.wrappedNavigationCaseMap.values());\n        result.addAll(createViewConfigBasedNavigationCases(true).values());\n        return result;\n    }\n\n    /**\n     * @return a combination of navigation-cases configured via XML and\n     *         {@link org.apache.deltaspike.core.api.config.view.ViewConfig}s\n     */\n    @Override\n    public Set<Entry<String, Set<NavigationCase>>> entrySet()\n    {\n        Set<Entry<String, Set<NavigationCase>>> result = new HashSet<Entry<String, Set<NavigationCase>>>();\n\n        result.addAll(this.wrappedNavigationCaseMap.entrySet());\n        result.addAll(createViewConfigBasedNavigationCases(true).entrySet());\n        return result;\n    }\n\n    //currently not a complete handling, but enough to fix the issues with mojarra\n    private class DelegatingMap extends HashMap<String, Set<NavigationCase>>\n    {\n        private static final long serialVersionUID = -955468874397821639L;\n        private final ConfigurableNavigationHandler wrapped;\n\n        private DelegatingMap(ConfigurableNavigationHandler wrapped)\n        {\n            this.wrapped = wrapped;\n        }\n\n        @Override\n        public Set<NavigationCase> put(String key, Set<NavigationCase> value)\n        {\n            if (value == null)\n            {\n                return null;\n            }\n\n            Set<NavigationCase> result = new HashSet<NavigationCase>();\n\n            //filter entries created by createViewConfigBasedNavigationCases\n            for (NavigationCase navigationCase : value)\n            {\n                if (!(navigationCase.getFromOutcome() == null && navigationCase.getFromAction() == null))\n                {\n                    result.add(navigationCase);\n                }\n            }\n\n            //delegate to the wrapped instance -> the innermost handler needs to receive it\n            //(because mojarra uses ConfigurableNavigationHandler#getNavigationCases\n            // to add cases for std. nav.rules from the outside)\n            return this.wrapped.getNavigationCases().put(key, result);\n        }\n\n        @Override\n        public Set<NavigationCase> get(Object key)\n        {\n            Set<NavigationCase> navigationCases = super.get(key);\n            if (navigationCases == null)\n            {\n                navigationCases = new HashSet<NavigationCase>();\n                put((String)key, navigationCases);\n            }\n\n            return new DelegatingSet(navigationCases, this.wrapped, (String)key);\n        }\n    }\n\n    //currently not a complete handling, but enough to fix the issues with mojarra\n    private class DelegatingSet extends HashSet<NavigationCase>\n    {\n        private static final long serialVersionUID = -7040572530963900394L;\n\n        private final ConfigurableNavigationHandler wrapped;\n        private String navigationCaseKey;\n\n        private DelegatingSet(Collection<? extends NavigationCase> c,\n                              ConfigurableNavigationHandler wrapped,\n                              String navigationCaseKey)\n        {\n            super(c);\n            this.wrapped = wrapped;\n            this.navigationCaseKey = navigationCaseKey;\n        }\n\n        @Override\n        public boolean add(NavigationCase navigationCase)\n        {\n            Set<NavigationCase> navigationCases = this.wrapped.getNavigationCases().get(this.navigationCaseKey);\n\n            if (navigationCases == null)\n            {\n                navigationCases = new HashSet<NavigationCase>();\n                this.wrapped.getNavigationCases().put(this.navigationCaseKey, navigationCases);\n            }\n\n            return navigationCases.add(navigationCase);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/NavigationParameterInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.jsf.spi.config.view.navigation.NavigationParameterStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@NavigationParameter(key = \"\", value = \"\")\n@Interceptor\n@Priority(1000)\npublic class NavigationParameterInterceptor implements Serializable\n{\n    private static final long serialVersionUID = 1762625956958428994L;\n\n    @Inject\n    private NavigationParameterStrategy navigationParameterStrategy;\n\n    @AroundInvoke\n    public Object addParameter(InvocationContext invocationContext) throws Exception\n    {\n        return this.navigationParameterStrategy.execute(invocationContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/NavigationParameterListInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.jsf.spi.config.view.navigation.NavigationParameterStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@NavigationParameter.List( { } )\n@Interceptor\n@Priority(1000)\npublic class NavigationParameterListInterceptor implements Serializable\n{\n    private static final long serialVersionUID = 2762625956958428994L;\n\n    @Inject\n    private NavigationParameterStrategy navigationParameterStrategy;\n\n    @AroundInvoke\n    public Object addParameterList(InvocationContext invocationContext) throws Exception\n    {\n        return this.navigationParameterStrategy.execute(invocationContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/navigation/ViewConfigAwareNavigationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.config.view.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.ViewRef;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.core.api.config.view.navigation.event.PreViewConfigNavigateEvent;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.faces.application.NavigationHandler;\nimport jakarta.faces.context.ExternalContext;\nimport jakarta.faces.context.FacesContext;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.CopyOnWriteArraySet;\n\npublic class ViewConfigAwareNavigationHandler extends NavigationHandler\n{\n    private Set<String> otherOutcomes = new CopyOnWriteArraySet<String>();\n    private Map<String, ViewConfigDescriptor> viewConfigs = new ConcurrentHashMap<String, ViewConfigDescriptor>();\n\n    private final NavigationHandler navigationHandler;\n\n    private volatile BeanManager beanManager;\n\n    private NavigationParameterContext navigationParameterContext;\n\n    private ViewConfigResolver viewConfigResolver;\n\n    /**\n     * Constructor which allows to use the given {@link NavigationHandler}\n     *\n     * @param navigationHandler navigation-handler of jsf\n     */\n    public ViewConfigAwareNavigationHandler(NavigationHandler navigationHandler)\n    {\n        this.navigationHandler = navigationHandler;\n    }\n\n    //Security checks will be performed by the view-handler provided by ds\n    @Override\n    public void handleNavigation(FacesContext facesContext, String fromAction, String outcome)\n    {\n        lazyInit();\n        if (outcome != null && outcome.contains(\".\"))\n        {\n            String originalOutcome = outcome;\n\n            if (!this.otherOutcomes.contains(outcome))\n            {\n                //it isn't possible to support interfaces due to cdi restrictions\n                if (outcome.startsWith(\"class \"))\n                {\n                    outcome = outcome.substring(6);\n                }\n                ViewConfigDescriptor entry = this.viewConfigs.get(outcome);\n\n                if (entry == null)\n                {\n                    if (DefaultErrorView.class.getName().equals(originalOutcome))\n                    {\n                        entry = this.viewConfigResolver.getDefaultErrorViewConfigDescriptor();\n                    }\n                }\n\n                boolean allowCaching = true;\n                if (entry == null)\n                {\n                    Class<?> loadedClass = ClassUtils.tryToLoadClassForName(outcome);\n\n                    if (loadedClass == null)\n                    {\n                        this.otherOutcomes.add(originalOutcome);\n                    }\n                    else if (ViewConfig.class.isAssignableFrom(loadedClass))\n                    {\n                        //a sub-classed page-config for annotating it with different view params\n                        if (loadedClass.getAnnotation(View.class) == null &&\n                                loadedClass.getSuperclass().getAnnotation(View.class) != null)\n                        {\n                            allowCaching = false;\n                            addConfiguredViewParameters(loadedClass);\n\n                            loadedClass = loadedClass.getSuperclass();\n                        }\n                        entry = this.viewConfigResolver\n                                .getViewConfigDescriptor((Class<? extends ViewConfig>) loadedClass);\n                    }\n                }\n\n                if (entry != null)\n                {\n                    //in case of false it has been added already\n                    if (allowCaching)\n                    {\n                        this.viewConfigs.put(outcome, entry);\n                        addConfiguredViewParameters(entry.getConfigClass());\n                    }\n\n                    String oldViewId = null;\n\n                    if (facesContext.getViewRoot() != null)\n                    {\n                        oldViewId = facesContext.getViewRoot().getViewId();\n                    }\n\n                    PreViewConfigNavigateEvent navigateEvent = firePreViewConfigNavigateEvent(oldViewId, entry);\n\n                    entry = tryToUpdateEntry(entry, navigateEvent);\n\n                    if (entry != null)\n                    {\n                        outcome = convertEntryToOutcome(facesContext.getExternalContext(), entry);\n                    }\n                }\n            }\n        }\n\n        this.navigationHandler.handleNavigation(facesContext, fromAction, outcome);\n    }\n\n    private void addConfiguredViewParameters(Class<?> viewConfigClass)\n    {\n        if (this.navigationParameterContext != null)\n        {\n            NavigationParameter navigationParameter = viewConfigClass.getAnnotation(NavigationParameter.class);\n\n            if (navigationParameter != null)\n            {\n                addConfiguredPageParameter(navigationParameter);\n            }\n            else\n            {\n                NavigationParameter.List pageParameterList =\n                        viewConfigClass.getAnnotation(NavigationParameter.List.class);\n\n                if (pageParameterList != null)\n                {\n                    for (NavigationParameter currentNavigationParameter : pageParameterList.value())\n                    {\n                        addConfiguredPageParameter(currentNavigationParameter);\n                    }\n                }\n            }\n        }\n    }\n\n    private void addConfiguredPageParameter(NavigationParameter viewParameter)\n    {\n        JsfUtils.addStaticNavigationParameter(\n            this.navigationParameterContext, viewParameter.key(), viewParameter.value());\n    }\n\n    private String convertEntryToOutcome(ExternalContext externalContext, ViewConfigDescriptor entry)\n    {\n        View viewMetaData = entry.getMetaData(View.class).iterator().next();\n\n        boolean performRedirect = View.NavigationMode.REDIRECT.equals(viewMetaData.navigation());\n        boolean includeViewParameters = View.ViewParameterMode.INCLUDE.equals(viewMetaData.viewParams());\n\n        StringBuilder result = new StringBuilder(entry.getViewId());\n\n        if (performRedirect)\n        {\n            result.append(\"?faces-redirect=true\");\n        }\n        if (includeViewParameters)\n        {\n            if (performRedirect)\n            {\n                result.append(\"&\");\n            }\n            else\n            {\n                result.append(\"?\");\n            }\n            result.append(\"includeViewParams=true\");\n\n            return JsfUtils.addPageParameters(externalContext, result.toString(), false);\n        }\n\n        return result.toString();\n    }\n\n    private ViewConfigDescriptor tryToUpdateEntry(ViewConfigDescriptor viewConfigDescriptor,\n                                                  PreViewConfigNavigateEvent navigateEvent)\n    {\n        if (navigateEvent.getToView() == null)\n        {\n            return null;\n        }\n\n        if (navigateEvent.getToView().equals(viewConfigDescriptor.getConfigClass()))\n        {\n            return viewConfigDescriptor;\n        }\n\n        return this.viewConfigResolver.getViewConfigDescriptor(navigateEvent.getToView());\n    }\n\n    private PreViewConfigNavigateEvent firePreViewConfigNavigateEvent(String oldViewId,\n                                                                      ViewConfigDescriptor newViewConfigDescriptor)\n    {\n        ViewConfigDescriptor oldViewConfigDescriptor = this.viewConfigResolver.getViewConfigDescriptor(oldViewId);\n\n        PreViewConfigNavigateEvent navigateEvent;\n\n        if (oldViewConfigDescriptor != null)\n        {\n            navigateEvent = new PreViewConfigNavigateEvent(\n                    oldViewConfigDescriptor.getConfigClass(), newViewConfigDescriptor.getConfigClass());\n        }\n        else\n        {\n            navigateEvent = new PreViewConfigNavigateEvent(\n                    ViewRef.Manual.class, newViewConfigDescriptor.getConfigClass());\n        }\n\n        this.beanManager.getEvent().fire(navigateEvent);\n        return navigateEvent;\n    }\n\n    private void lazyInit()\n    {\n        if (this.beanManager == null)\n        {\n            init();\n        }\n    }\n\n    private synchronized void init()\n    {\n        if (this.beanManager == null)\n        {\n            this.navigationParameterContext =\n                    BeanProvider.getContextualReference(NavigationParameterContext.class);\n            this.viewConfigResolver =\n                    BeanProvider.getContextualReference(ViewConfigResolver.class);\n\n            this.beanManager = BeanManagerProvider.getInstance().getBeanManager();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/exception/control/BridgeExceptionHandlerWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.exception.control;\n\nimport java.util.Iterator;\nimport jakarta.faces.FacesException;\nimport jakarta.faces.context.ExceptionHandler;\nimport jakarta.faces.context.ExceptionHandlerWrapper;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.event.AbortProcessingException;\nimport jakarta.faces.event.ExceptionQueuedEvent;\nimport jakarta.faces.event.PhaseId;\nimport jakarta.faces.event.SystemEvent;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\nimport org.apache.deltaspike.jsf.impl.util.SecurityUtils;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.security.api.authorization.ErrorViewAwareAccessDeniedException;\n\npublic class BridgeExceptionHandlerWrapper extends ExceptionHandlerWrapper implements Deactivatable\n{\n    private final ExceptionHandler wrapped;\n\n    public BridgeExceptionHandlerWrapper(ExceptionHandler wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    @Override\n    public ExceptionHandler getWrapped()\n    {\n        return wrapped;\n    }\n\n    @Override\n    public void handle() throws FacesException\n    {\n        FacesContext context = FacesContext.getCurrentInstance();\n\n        if (context == null || context.getResponseComplete())\n        {\n            return;\n        }\n\n        Iterable<ExceptionQueuedEvent> exceptionQueuedEvents = getUnhandledExceptionQueuedEvents();\n        if (exceptionQueuedEvents != null && exceptionQueuedEvents.iterator() != null)\n        {\n            Iterator<ExceptionQueuedEvent> iterator = exceptionQueuedEvents.iterator();\n\n            while (iterator.hasNext())\n            {\n                Throwable throwable = iterator.next().getContext().getException();\n                Throwable rootCause = getRootCause(throwable);\n\n                if (rootCause instanceof AccessDeniedException)\n                {\n                    processAccessDeniedException(rootCause);\n                    iterator.remove();\n                    continue;\n                }\n\n                // a handle method might redirect and set responseComplete\n                if (context.getResponseComplete())\n                {\n                    break;\n                }\n            }\n        }\n\n        super.handle();\n    }\n\n    @Override\n    public Throwable getRootCause(Throwable throwable)\n    {\n        return JsfUtils.getRootCause(throwable);\n    }\n\n    @Override\n    public void processEvent(SystemEvent event) throws AbortProcessingException\n    {\n        //handle exceptions which occur in a phase-listener (beforePhase) for PhaseId.RENDER_RESPONSE\n        //needed because #handle gets called too late in this case\n        if (event instanceof ExceptionQueuedEvent)\n        {\n            ExceptionQueuedEvent exceptionQueuedEvent = (ExceptionQueuedEvent)event;\n            FacesContext facesContext = exceptionQueuedEvent.getContext().getContext();\n\n            if (facesContext.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE &&\n                exceptionQueuedEvent.getContext().inBeforePhase())\n            {\n                Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException());\n\n                if (exception instanceof AccessDeniedException)\n                {\n                    processAccessDeniedException(exception);\n                }\n            }\n        }\n        super.processEvent(event);\n    }\n\n    private void processAccessDeniedException(Throwable throwable)\n    {\n        if (throwable instanceof ErrorViewAwareAccessDeniedException)\n        {\n            SecurityUtils.handleSecurityViolationWithoutNavigation((AccessDeniedException) throwable);\n        }\n        else\n        {\n            ErrorViewAwareAccessDeniedException securityException =\n                new ErrorViewAwareAccessDeniedException(\n                    ((AccessDeniedException)throwable).getViolations(), DefaultErrorView.class);\n            SecurityUtils.handleSecurityViolationWithoutNavigation(securityException);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/action/DeltaSpikeActionListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.action;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewControllerActionListener;\n\nimport jakarta.faces.event.ActionEvent;\nimport jakarta.faces.event.ActionListener;\n\n/**\n * Aggregates {@link ActionListener} implementations provided by DeltaSpike to ensure a deterministic behaviour\n */\npublic class DeltaSpikeActionListener implements ActionListener, Deactivatable\n{\n    private final ActionListener wrapped;\n    private final boolean activated;\n\n    /**\n     * Constructor for wrapping the given {@link ActionListener}\n     * @param wrapped action-listener which should be wrapped\n     */\n    public DeltaSpikeActionListener(ActionListener wrapped)\n    {\n        this.wrapped = wrapped;\n        this.activated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public void processAction(ActionEvent actionEvent)\n    {\n        if (this.activated)\n        {\n            getWrappedActionListener().processAction(actionEvent);\n        }\n        else\n        {\n            this.wrapped.processAction(actionEvent);\n        }\n    }\n\n    private ActionListener getWrappedActionListener()\n    {\n        //TODO re-visit it\n        //was:\n        //SecurityViolationAwareActionListener securityViolationAwareActionListener =\n        //        new SecurityViolationAwareActionListener(this.wrapped);\n\n        return new ViewControllerActionListener(this.wrapped);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/AfterPhaseBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.phase;\n\nimport org.apache.deltaspike.jsf.api.listener.phase.AfterPhase;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Helper which allows to create instances of {@link AfterPhase}\n */\nabstract class AfterPhaseBinding extends AnnotationLiteral<AfterPhase> implements AfterPhase\n{\n}"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/BeforePhaseBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.phase;\n\nimport org.apache.deltaspike.jsf.api.listener.phase.BeforePhase;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n/**\n * Helper which allows to create instances of {@link BeforePhase}\n */\nabstract class BeforePhaseBinding extends AnnotationLiteral<BeforePhase> implements BeforePhase\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/DeltaSpikePhaseListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.phase;\n\nimport org.apache.deltaspike.core.api.config.view.controller.InitView;\nimport org.apache.deltaspike.core.api.config.view.controller.PostRenderView;\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.jsf.impl.security.ViewRootAccessHandler;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\nimport org.apache.deltaspike.jsf.impl.util.SecurityUtils;\nimport org.apache.deltaspike.jsf.impl.util.ViewControllerUtils;\nimport org.apache.deltaspike.security.api.authorization.ErrorViewAwareAccessDeniedException;\nimport org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;\n\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.event.PhaseEvent;\nimport jakarta.faces.event.PhaseId;\nimport jakarta.faces.event.PhaseListener;\nimport java.util.logging.Logger;\n\n@Vetoed //don't use PhaseListener as type - JsfRequestLifecyclePhaseListener would fire to this listener as well\npublic class DeltaSpikePhaseListener implements PhaseListener, Deactivatable\n{\n    private static final long serialVersionUID = -4458288760053069922L;\n\n    private final boolean activated;\n    private Boolean securityModuleActivated;\n\n    private final PhaseListener jsfRequestLifecyclePhaseListener = new JsfRequestLifecyclePhaseListener();\n\n    private volatile ViewConfigResolver viewConfigResolver;\n\n    public DeltaSpikePhaseListener()\n    {\n        this.activated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public void beforePhase(PhaseEvent phaseEvent)\n    {\n        if (!this.activated)\n        {\n            return;\n        }\n\n        if (this.viewConfigResolver == null)\n        {\n            lazyInit();\n        }\n\n        processInitView(phaseEvent);\n\n        //delegate to JsfRequestLifecyclePhaseListener as a last step\n        this.jsfRequestLifecyclePhaseListener.beforePhase(phaseEvent);\n\n        if (PhaseId.RENDER_RESPONSE.equals(phaseEvent.getPhaseId()))\n        {\n            onBeforeRenderResponse(phaseEvent.getFacesContext());\n        }\n    }\n\n    private void onBeforeRenderResponse(FacesContext facesContext)\n    {\n        checkSecuredView(facesContext);\n        processPreRenderView(facesContext);\n    }\n\n    @Override\n    public void afterPhase(PhaseEvent phaseEvent)\n    {\n        if (!this.activated)\n        {\n            return;\n        }\n\n        if (this.viewConfigResolver == null)\n        {\n            lazyInit();\n        }\n\n        processInitView(phaseEvent);\n\n        if (PhaseId.RESTORE_VIEW.equals(phaseEvent.getPhaseId()))\n        {\n            onAfterRestoreView(phaseEvent.getFacesContext());\n\n        }\n        else if (PhaseId.RENDER_RESPONSE.equals(phaseEvent.getPhaseId()))\n        {\n            onAfterRenderResponse(phaseEvent.getFacesContext());\n        }\n\n        //delegate to JsfRequestLifecyclePhaseListener as a last step\n        this.jsfRequestLifecyclePhaseListener.afterPhase(phaseEvent);\n    }\n\n    private void onAfterRestoreView(FacesContext facesContext)\n    {\n        JsfUtils.tryToRestoreMessages(facesContext);\n    }\n\n    private void onAfterRenderResponse(FacesContext facesContext)\n    {\n        processPostRenderView(facesContext);\n    }\n\n    @Override\n    public PhaseId getPhaseId()\n    {\n        return PhaseId.ANY_PHASE;\n    }\n\n    private void checkSecuredView(FacesContext facesContext)\n    {\n        if (!this.securityModuleActivated)\n        {\n            return;\n        }\n\n        try\n        {\n            BeanProvider.getContextualReference(ViewRootAccessHandler.class).checkAccessTo(facesContext.getViewRoot());\n        }\n        catch (ErrorViewAwareAccessDeniedException accessDeniedException)\n        {\n            SecurityUtils.tryToHandleSecurityViolation(accessDeniedException);\n            facesContext.renderResponse();\n        }\n    }\n\n    private synchronized void lazyInit()\n    {\n        if (this.viewConfigResolver != null)\n        {\n            return;\n        }\n\n        this.securityModuleActivated =\n            BeanProvider.getContextualReference(EditableAccessDecisionVoterContext.class, true) != null;\n\n        this.viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);\n\n        if (!this.securityModuleActivated)\n        {\n            Logger.getLogger(getClass().getName()) //it's the only case for which a logger is needed in this class\n                    .info(\"security-module-impl isn't used -> \" + getClass().getName() +\n                            \"#checkSecuredView gets deactivated\");\n        }\n    }\n\n    private void processInitView(PhaseEvent event)\n    {\n        if (event.getPhaseId().equals(PhaseId.RESTORE_VIEW) && !isRedirectRequest(event.getFacesContext()))\n        {\n            return;\n        }\n\n        //TODO check if we have to restrict the other callbacks as well\n        //leads to a call of @BeforePhase but not the corresponding @AfterPhase call of the corresponding callbacks\n\n        //TODO don't call the callbacks in case of an initial redirct\n        //was:\n        /*\n        if(Boolean.TRUE.equals(event.getFacesContext().getExternalContext().getRequestMap()\n                .get(WindowContextManagerObserver.INITIAL_REDIRECT_PERFORMED_KEY)))\n        {\n            return;\n        }\n        */\n\n        FacesContext facesContext = event.getFacesContext();\n        if (facesContext.getViewRoot() != null && facesContext.getViewRoot().getViewId() != null)\n        {\n            processInitView(event.getFacesContext().getViewRoot().getViewId());\n        }\n    }\n\n    private void processInitView(String viewId)\n    {\n        try\n        {\n            WindowMetaData windowMetaData = BeanProvider.getContextualReference(WindowMetaData.class);\n\n            //view already initialized in this or any prev. request\n            if (viewId.equals(windowMetaData.getInitializedViewId()))\n            {\n                return;\n            }\n\n            //override the view-id if we have a new view\n            windowMetaData.setInitializedViewId(viewId);\n\n            ViewConfigDescriptor viewDefinitionEntry = this.viewConfigResolver.getViewConfigDescriptor(viewId);\n\n            if (viewDefinitionEntry == null)\n            {\n                return;\n            }\n\n            ViewControllerUtils.executeViewControllerCallback(viewDefinitionEntry, InitView.class);\n        }\n        catch (ContextNotActiveException e)\n        {\n            //TODO discuss how we handle it\n        }\n    }\n\n    private void processPreRenderView(FacesContext facesContext)\n    {\n        UIViewRoot uiViewRoot = facesContext.getViewRoot();\n\n        if (uiViewRoot != null)\n        {\n            ViewConfigDescriptor viewDefinitionEntry =\n                    this.viewConfigResolver.getViewConfigDescriptor(uiViewRoot.getViewId());\n\n            ViewControllerUtils.executeViewControllerCallback(viewDefinitionEntry, PreRenderView.class);\n        }\n    }\n\n    private void processPostRenderView(FacesContext facesContext)\n    {\n        UIViewRoot uiViewRoot = facesContext.getViewRoot();\n\n        if (uiViewRoot != null)\n        {\n            ViewConfigDescriptor viewDefinitionEntry =\n                    this.viewConfigResolver.getViewConfigDescriptor(uiViewRoot.getViewId());\n\n            ViewControllerUtils.executeViewControllerCallback(viewDefinitionEntry, PostRenderView.class);\n        }\n    }\n\n    private boolean isRedirectRequest(FacesContext facesContext)\n    {\n        return facesContext.getResponseComplete();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/JsfRequestLifecycleBroadcaster.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.phase;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.jsf.api.listener.phase.AfterPhase;\nimport org.apache.deltaspike.jsf.api.listener.phase.BeforePhase;\nimport org.apache.deltaspike.jsf.api.listener.phase.JsfPhaseId;\nimport org.apache.deltaspike.jsf.api.listener.phase.JsfPhaseListener;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.event.Event;\nimport jakarta.enterprise.inject.Instance;\nimport jakarta.faces.event.PhaseEvent;\nimport jakarta.faces.event.PhaseId;\nimport jakarta.faces.event.PhaseListener;\nimport jakarta.inject.Inject;\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.ListIterator;\n\n@ApplicationScoped\npublic class JsfRequestLifecycleBroadcaster\n{\n    @Inject\n    private Event<PhaseEvent> phaseEvent;\n\n    @Inject\n    @BeforePhase(JsfPhaseId.ANY_PHASE)\n    private Event<PhaseEvent> beforeAnyPhaseEvent;\n\n    @Inject\n    @AfterPhase(JsfPhaseId.ANY_PHASE)\n    private Event<PhaseEvent> afterAnyPhaseEvent;\n\n    private List<PhaseListener> phaseListeners = new ArrayList<PhaseListener>();\n\n    /**\n     * Constructor used by proxy libs\n     */\n    protected JsfRequestLifecycleBroadcaster()\n    {\n    }\n\n    @Inject\n    protected JsfRequestLifecycleBroadcaster(Instance<PhaseListener> phaseListenerInstance)\n    {\n        Class phaseListenerClass;\n        for (PhaseListener currentPhaseListener : phaseListenerInstance)\n        {\n            phaseListenerClass = ProxyUtils.getUnproxiedClass(currentPhaseListener.getClass());\n\n            if (phaseListenerClass.isAnnotationPresent(JsfPhaseListener.class))\n            {\n                if (Deactivatable.class.isAssignableFrom(phaseListenerClass) &&\n                    !ClassDeactivationUtils.isActivated(phaseListenerClass))\n                {\n                    continue;\n                }\n                this.phaseListeners.add(currentPhaseListener);\n            }\n        }\n\n        //higher ordinals first\n        sortDescending(this.phaseListeners);\n    }\n\n    private static void sortDescending(List<PhaseListener> phaseListeners)\n    {\n        Collections.sort(phaseListeners, new Comparator<PhaseListener>()\n        {\n            @Override\n            public int compare(PhaseListener phaseListener1, PhaseListener phaseListener2)\n            {\n                return (phaseListener1.getClass().getAnnotation(JsfPhaseListener.class).ordinal() >\n                        phaseListener2.getClass().getAnnotation(JsfPhaseListener.class).ordinal()) ? -1 : 1;\n            }\n        });\n    }\n\n    protected void broadcastBeforeEvent(PhaseEvent phaseEvent)\n    {\n        //TODO discuss exception handling\n\n        //fire to phase-observer methods\n        this.phaseEvent.select(createAnnotationLiteral(phaseEvent.getPhaseId(), true)).fire(phaseEvent);\n        this.beforeAnyPhaseEvent.fire(phaseEvent);\n\n        //fire to ds-phase-listeners\n        for (PhaseListener phaseListener : this.phaseListeners)\n        {\n            PhaseId targetPhase = phaseListener.getPhaseId();\n\n            if (targetPhase == PhaseId.ANY_PHASE || targetPhase == phaseEvent.getPhaseId())\n            {\n                phaseListener.beforePhase(phaseEvent);\n            }\n        }\n    }\n\n    protected void broadcastAfterEvent(PhaseEvent phaseEvent)\n    {\n        //TODO discuss exception handling\n\n        //fire to phase-observer methods\n        this.phaseEvent.select(createAnnotationLiteral(phaseEvent.getPhaseId(), false)).fire(phaseEvent);\n        this.afterAnyPhaseEvent.fire(phaseEvent);\n\n        //fire to ds-phase-listeners\n        //call the listeners in reverse-order (like jsf)\n        ListIterator<PhaseListener> phaseListenerIterator = this.phaseListeners.listIterator(phaseListeners.size());\n\n        while (phaseListenerIterator.hasPrevious())\n        {\n            PhaseListener phaseListener = phaseListenerIterator.previous();\n            PhaseId targetPhase = phaseListener.getPhaseId();\n\n            if (targetPhase == PhaseId.ANY_PHASE || targetPhase == phaseEvent.getPhaseId())\n            {\n                phaseListener.afterPhase(phaseEvent);\n            }\n        }\n    }\n\n    protected Annotation createAnnotationLiteral(jakarta.faces.event.PhaseId phaseId, boolean isBeforeEvent)\n    {\n        if (isBeforeEvent)\n        {\n            return createBeforeLiteral(phaseId);\n        }\n        return createAfterLiteral(phaseId);\n    }\n\n    protected Annotation createBeforeLiteral(final jakarta.faces.event.PhaseId phaseId)\n    {\n        return new BeforePhaseBinding()\n        {\n            private static final long serialVersionUID = 749645435335842723L;\n\n            @Override\n            public JsfPhaseId value()\n            {\n                return JsfPhaseId.convertFromFacesClass(phaseId);\n            }\n        };\n    }\n\n    protected Annotation createAfterLiteral(final jakarta.faces.event.PhaseId phaseId)\n    {\n        return new AfterPhaseBinding()\n        {\n            private static final long serialVersionUID = 390037768660184656L;\n\n            @Override\n            public JsfPhaseId value()\n            {\n                return JsfPhaseId.convertFromFacesClass(phaseId);\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/JsfRequestLifecyclePhaseListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.phase;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.faces.event.PhaseEvent;\nimport jakarta.faces.event.PhaseId;\nimport jakarta.faces.event.PhaseListener;\n\n/**\n * PhaseListener for triggering {@link JsfRequestLifecycleBroadcaster}\n */\n\n@Typed(Deactivatable.class) //don't use PhaseListener - the broadcaster would fire to this listener as well\npublic class JsfRequestLifecyclePhaseListener implements PhaseListener, Deactivatable\n{\n    private static final long serialVersionUID = -3351903831660165998L;\n\n    private final boolean activated;\n\n    public JsfRequestLifecyclePhaseListener()\n    {\n        this.activated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public void beforePhase(PhaseEvent phaseEvent)\n    {\n        if (this.activated)\n        {\n            resolveBroadcaster().broadcastBeforeEvent(phaseEvent);\n        }\n    }\n\n    @Override\n    public void afterPhase(PhaseEvent phaseEvent)\n    {\n        if (this.activated)\n        {\n            resolveBroadcaster().broadcastAfterEvent(phaseEvent);\n        }\n    }\n\n    @Override\n    public PhaseId getPhaseId()\n    {\n        return PhaseId.ANY_PHASE;\n    }\n\n    private JsfRequestLifecycleBroadcaster resolveBroadcaster()\n    {\n        //cdi has to inject the events,...\n        return BeanProvider.getContextualReference(JsfRequestLifecycleBroadcaster.class);\n    }\n}"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/WindowMetaData.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.phase;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\nimport org.apache.deltaspike.jsf.impl.message.FacesMessageEntry;\n\nimport java.io.Serializable;\nimport java.util.List;\n\n@WindowScoped\npublic class WindowMetaData implements Serializable\n{\n    private static final long serialVersionUID = -413165700186583037L;\n\n    private String initializedViewId;\n\n    /**\n     * used per default instead of Flash#setKeepMessages,\n     * because there are less issues in view of multi-window support esp. before jsf v2.2 and\n     * a custom window-handler might have special requirements.\n     */\n    private List<FacesMessageEntry> facesMessageEntryList;\n\n    public String getInitializedViewId()\n    {\n        return initializedViewId;\n    }\n\n    public void setInitializedViewId(String initializedViewId)\n    {\n        this.initializedViewId = initializedViewId;\n    }\n\n    public void setFacesMessageEntryList(List<FacesMessageEntry> facesMessageEntryList)\n    {\n        this.facesMessageEntryList = facesMessageEntryList;\n    }\n\n    public List<FacesMessageEntry> getFacesMessageEntryList()\n    {\n        return facesMessageEntryList;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeApplicationWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\nimport org.apache.deltaspike.jsf.impl.security.SecurityAwareViewHandler;\n\nimport jakarta.faces.application.Application;\nimport jakarta.faces.application.ApplicationWrapper;\nimport jakarta.faces.application.ProjectStage;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.event.PreDestroyViewMapEvent;\nimport jakarta.faces.event.SystemEvent;\n\npublic class DeltaSpikeApplicationWrapper extends ApplicationWrapper\n{\n    private final Application wrapped;\n    private final boolean preDestroyViewMapEventFilterMode;\n    private final ProjectStage projectStage;\n\n    public DeltaSpikeApplicationWrapper(\n            Application wrapped, JsfModuleConfig jsfModuleConfig, boolean preDestroyViewMapEventFilterMode,\n            ProjectStage projectStage)\n    {\n        this.wrapped = wrapped;\n        this.preDestroyViewMapEventFilterMode = preDestroyViewMapEventFilterMode;\n        this.projectStage = projectStage;\n    }\n\n    @Override\n    public ProjectStage getProjectStage()\n    {\n        if (this.projectStage == null)\n        {\n            return getWrapped().getProjectStage();\n        }\n        return this.projectStage;\n    }\n\n    @Override\n    public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> systemEventClass, Object source)\n    {\n        if (!PreDestroyViewMapEvent.class.isAssignableFrom(systemEventClass) ||\n                isPreDestroyViewMapEventAllowed(facesContext))\n        {\n            super.publishEvent(facesContext, systemEventClass, source);\n        }\n    }\n\n    private boolean isPreDestroyViewMapEventAllowed(FacesContext facesContext)\n    {\n        return !this.preDestroyViewMapEventFilterMode ||\n                    !Boolean.TRUE.equals(facesContext.getExternalContext().getRequestMap().get(\n                            SecurityAwareViewHandler.PRE_DESTROY_VIEW_MAP_EVENT_FILTER_ENABLED));\n    }\n\n    @Override\n    public Application getWrapped()\n    {\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeExternalContextWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\n\nimport jakarta.faces.context.ExternalContext;\nimport jakarta.faces.context.ExternalContextWrapper;\nimport java.io.IOException;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.lifecycle.ClientWindow;\nimport org.apache.deltaspike.jsf.impl.clientwindow.DeltaSpikeClientWindow;\nimport org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;\n\npublic class DeltaSpikeExternalContextWrapper extends ExternalContextWrapper implements Deactivatable\n{\n    private final ExternalContext wrapped;\n\n    DeltaSpikeExternalContextWrapper(ExternalContext wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    @Override\n    public void redirect(String url) throws IOException\n    {\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n\n        // skip if we are in initialRedirect mode because\n        // save messages via flash scope will fail because the JSF lifecycle isn't initialized\n        if (!ClientWindowHelper.isInitialRedirect(facesContext))\n        {\n            JsfUtils.saveFacesMessages(this.wrapped);\n        }\n\n        ClientWindow clientWindow = getClientWindow();\n        if (clientWindow != null && clientWindow instanceof DeltaSpikeClientWindow)\n        {\n            url = ((DeltaSpikeClientWindow) clientWindow).interceptRedirect(facesContext, url);\n        }\n\n        this.wrapped.redirect(url);\n    }\n\n    @Override\n    public ExternalContext getWrapped()\n    {\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.context.FacesContextFactory;\nimport jakarta.faces.lifecycle.Lifecycle;\n\npublic class DeltaSpikeFacesContextFactory extends FacesContextFactory implements Deactivatable\n{\n    private final FacesContextFactory wrappedFacesContextFactory;\n\n    private final boolean deactivated;\n\n    /**\n     * Constructor for wrapping the given {@link FacesContextFactory}\n     *\n     * @param wrappedFacesContextFactory wrapped faces-context-factory which should be used\n     */\n    public DeltaSpikeFacesContextFactory(FacesContextFactory wrappedFacesContextFactory)\n    {\n        this.wrappedFacesContextFactory = wrappedFacesContextFactory;\n        this.deactivated = !ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    /**\n     * Wrapps the created {@link jakarta.faces.context.FacesContext} with {@link DeltaSpikeFacesContextWrapper}\n     * <p/>\n     * {@inheritDoc}\n     */\n    @Override\n    public FacesContext getFacesContext(Object context,\n                                        Object request,\n                                        Object response,\n                                        Lifecycle lifecycle)\n    {\n        FacesContext facesContext =\n                this.wrappedFacesContextFactory.getFacesContext(context, request, response, lifecycle);\n\n        if (facesContext == null || this.deactivated || facesContext instanceof DeltaSpikeFacesContextWrapper)\n        {\n            return facesContext;\n        }\n        \n        return new DeltaSpikeFacesContextWrapper(facesContext);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public FacesContextFactory getWrapped()\n    {\n        return wrappedFacesContextFactory;\n    }\n}"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport java.lang.annotation.Annotation;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.projectstage.TestStage;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\nimport org.apache.deltaspike.jsf.impl.config.view.DefaultErrorViewAwareExceptionHandlerWrapper;\nimport org.apache.deltaspike.jsf.impl.message.FacesMessageEntry;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.faces.application.Application;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.application.ProjectStage;\nimport jakarta.faces.context.ExceptionHandler;\nimport jakarta.faces.context.ExternalContext;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.context.FacesContextWrapper;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.CopyOnWriteArrayList;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.jsf.impl.exception.control.BridgeExceptionHandlerWrapper;\n\nimport org.apache.deltaspike.jsf.impl.navigation.NavigationHandlerAwareApplication;\nimport org.apache.deltaspike.jsf.impl.security.SecurityAwareViewHandler;\n\nclass DeltaSpikeFacesContextWrapper extends FacesContextWrapper\n{\n    private final FacesContext wrappedFacesContext;\n\n    private BeanManager beanManager;\n\n    private JsfRequestBroadcaster jsfRequestBroadcaster;\n\n    private boolean defaultErrorViewExceptionHandlerActivated;\n\n    private boolean bridgeExceptionHandlerActivated;\n    private Annotation bridgeExceptionQualifier;\n\n    private ExternalContext wrappedExternalContext;\n\n    private JsfModuleConfig jsfModuleConfig;\n\n    private volatile Boolean initialized;\n    private volatile Boolean isNavigationAwareApplicationWrapperActivated;\n\n    private boolean preDestroyViewMapEventFilterMode;\n    private ProjectStage projectStage;\n\n    DeltaSpikeFacesContextWrapper(FacesContext wrappedFacesContext)\n    {\n        this.wrappedFacesContext = wrappedFacesContext;\n\n        if (ClassDeactivationUtils.isActivated(DeltaSpikeExternalContextWrapper.class))\n        {\n            this.wrappedExternalContext =\n                    new DeltaSpikeExternalContextWrapper(wrappedFacesContext.getExternalContext());\n        }\n        else\n        {\n            this.wrappedExternalContext = wrappedFacesContext.getExternalContext();\n        }\n        \n        setCurrentInstance(this);\n    }\n\n    /**\n     * Broadcasts the {@link org.apache.deltaspike.core.api.lifecycle.Destroyed} event\n     * {@inheritDoc}\n     */\n    @Override\n    public void release()\n    {\n        // try/finally shouldn't be required...\n        try\n        {\n            if (!this.wrappedFacesContext.getApplication().getResourceHandler()\n                    .isResourceRequest(this.wrappedFacesContext))\n            {\n                broadcastDestroyedJsfRequestEvent();\n            }\n        }\n        finally\n        {\n            super.release();\n        }\n    }\n    \n    @Override\n    public ExceptionHandler getExceptionHandler()\n    {\n        lazyInit();\n\n        ExceptionHandler exceptionHandler = this.wrappedFacesContext.getExceptionHandler();\n\n        if (this.bridgeExceptionHandlerActivated)\n        {\n            exceptionHandler = new BridgeExceptionHandlerWrapper(exceptionHandler);\n        }\n        \n        if (this.defaultErrorViewExceptionHandlerActivated)\n        {\n            exceptionHandler = new DefaultErrorViewAwareExceptionHandlerWrapper(exceptionHandler);\n        }\n\n        return exceptionHandler;\n    }\n\n    private void broadcastDestroyedJsfRequestEvent()\n    {\n        lazyInit();\n        if (this.jsfRequestBroadcaster != null)\n        {\n            this.jsfRequestBroadcaster.broadcastDestroyedJsfRequestEvent(this);\n        }\n    }\n\n    private void lazyInit()\n    {\n        if (this.initialized == null)\n        {\n            init();\n        }\n    }\n\n    private synchronized void init()\n    {\n        // switch into paranoia mode\n        if (this.initialized == null)\n        {\n            this.beanManager = BeanManagerProvider.getInstance().getBeanManager();\n            this.jsfModuleConfig = BeanProvider.getContextualReference(this.beanManager, JsfModuleConfig.class, false);\n\n            if (ClassDeactivationUtils.isActivated(JsfRequestBroadcaster.class))\n            {\n                this.jsfRequestBroadcaster =\n                        BeanProvider.getContextualReference(JsfRequestBroadcaster.class, true);\n            }\n\n            ViewConfigResolver viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);\n\n            //deactivate it, if there is no default-error-view available\n            this.defaultErrorViewExceptionHandlerActivated =\n                    viewConfigResolver.getDefaultErrorViewConfigDescriptor() != null &&\n                            ClassDeactivationUtils.isActivated(DefaultErrorViewAwareExceptionHandlerWrapper.class);\n            \n            this.bridgeExceptionHandlerActivated =\n                    ClassDeactivationUtils.isActivated(BridgeExceptionHandlerWrapper.class);\n            \n            this.bridgeExceptionQualifier = AnnotationInstanceProvider.of(jsfModuleConfig.getExceptionQualifier());\n\n            this.preDestroyViewMapEventFilterMode = ClassDeactivationUtils.isActivated(SecurityAwareViewHandler.class);\n            this.isNavigationAwareApplicationWrapperActivated =\n                ClassDeactivationUtils.isActivated(NavigationHandlerAwareApplication.class);\n            org.apache.deltaspike.core.api.projectstage.ProjectStage dsProjectStage =\n                ProjectStageProducer.getInstance().getProjectStage();\n\n            for (ProjectStage ps : ProjectStage.values())\n            {\n                if (ps.name().equals(dsProjectStage.getClass().getSimpleName()))\n                {\n                    this.projectStage = ps;\n                    break;\n                }\n            }\n\n            if (this.projectStage == null && dsProjectStage instanceof TestStage)\n            {\n                this.projectStage = ProjectStage.Development;\n            }\n\n            if (this.projectStage == ProjectStage.Production)\n            {\n                this.projectStage = null; //reset it to force the delegation to the default handling\n            }\n\n            this.initialized = true;\n        }\n    }\n\n    /**\n     * Adds the {@link FacesMessage} also to a request scoped list to allow to preserve them later on\n     * (in case of redirects)\n     *\n     * {@inheritDoc}\n     */\n    @Override\n    public void addMessage(String componentId, FacesMessage facesMessage)\n    {\n        this.wrappedFacesContext.addMessage(componentId, facesMessage);\n\n        //don't store it directly in the window context - it would trigger a too early restore (in some cases)\n        Map<String, Object> requestMap = getExternalContext().getRequestMap();\n\n        @SuppressWarnings({ \"unchecked\" })\n        List<FacesMessageEntry> facesMessageEntryList =\n                (List<FacesMessageEntry>)requestMap.get(FacesMessageEntry.class.getName());\n\n        if (facesMessageEntryList == null)\n        {\n            facesMessageEntryList = new CopyOnWriteArrayList<FacesMessageEntry>();\n            requestMap.put(FacesMessageEntry.class.getName(), facesMessageEntryList);\n        }\n\n        facesMessageEntryList.add(new FacesMessageEntry(componentId, facesMessage));\n    }\n\n    @Override\n    public ExternalContext getExternalContext()\n    {\n        return this.wrappedExternalContext;\n    }\n\n    @Override\n    public Application getApplication()\n    {\n        lazyInit();\n\n        Application wrappedApplication = this.wrappedFacesContext.getApplication();\n        if (this.isNavigationAwareApplicationWrapperActivated)\n        {\n            wrappedApplication = new NavigationHandlerAwareApplication(wrappedApplication);\n        }\n        return new DeltaSpikeApplicationWrapper(\n            wrappedApplication, this.jsfModuleConfig, this.preDestroyViewMapEventFilterMode, this.projectStage);\n    }\n\n    @Override\n    public FacesContext getWrapped()\n    {\n        return this.wrappedFacesContext;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleFactoryWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.faces.lifecycle.Lifecycle;\nimport jakarta.faces.lifecycle.LifecycleFactory;\nimport java.util.Iterator;\n\npublic class DeltaSpikeLifecycleFactoryWrapper extends LifecycleFactory implements Deactivatable\n{\n    private final LifecycleFactory wrapped;\n\n    private final boolean deactivated;\n\n    /**\n     * Constructor for wrapping the given {@link LifecycleFactory}\n     *\n     * @param wrapped lifecycle-factory which should be wrapped\n     */\n    public DeltaSpikeLifecycleFactoryWrapper(LifecycleFactory wrapped)\n    {\n        this.wrapped = wrapped;\n        this.deactivated = !ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public void addLifecycle(String s, Lifecycle lifecycle)\n    {\n        wrapped.addLifecycle(s, lifecycle);\n    }\n\n    @Override\n    public Lifecycle getLifecycle(String s)\n    {\n        Lifecycle result = this.wrapped.getLifecycle(s);\n\n        if (this.deactivated)\n        {\n            return result;\n        }\n\n        return new DeltaSpikeLifecycleWrapper(result);\n    }\n\n    @Override\n    public Iterator<String> getLifecycleIds()\n    {\n        return wrapped.getLifecycleIds();\n    }\n\n    @Override\n    public LifecycleFactory getWrapped()\n    {\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.event.PhaseListener;\nimport jakarta.faces.lifecycle.ClientWindow;\nimport jakarta.faces.lifecycle.Lifecycle;\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext;\nimport org.apache.deltaspike.jsf.impl.clientwindow.ClientSideClientWindow;\nimport org.apache.deltaspike.jsf.impl.clientwindow.LazyClientWindow;\nimport org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;\n\nclass DeltaSpikeLifecycleWrapper extends Lifecycle\n{\n    private final Lifecycle wrapped;\n\n    private JsfRequestBroadcaster jsfRequestBroadcaster;\n    private ClientWindowConfig clientWindowConfig;\n\n    private WindowContext windowContext;\n    private DeltaSpikeContextExtension contextExtension;\n\n    private volatile Boolean initialized;\n\n    DeltaSpikeLifecycleWrapper(Lifecycle wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    Lifecycle getWrapped()\n    {\n        return wrapped;\n    }\n\n    @Override\n    public void addPhaseListener(PhaseListener phaseListener)\n    {\n        this.wrapped.addPhaseListener(phaseListener);\n    }\n\n    /**\n     * Broadcasts\n     * {@link org.apache.deltaspike.core.api.lifecycle.Initialized} and\n     * {@link org.apache.deltaspike.core.api.lifecycle.Destroyed}\n     * //TODO StartupEvent\n     */\n    @Override\n    public void execute(FacesContext facesContext)\n    {\n        //can happen due to the window-handling of deltaspike\n        if (facesContext.getResponseComplete())\n        {\n            return;\n        }\n\n        lazyInit();\n\n        //TODO broadcastApplicationStartupBroadcaster();\n        broadcastInitializedJsfRequestEvent(facesContext);\n\n        // ClientWindow handling\n        ClientWindow clientWindow = facesContext.getExternalContext().getClientWindow();\n        if (clientWindow != null)\n        {\n            String windowId = clientWindow.getId();\n            if (windowId != null)\n            {\n                windowContext.activateWindow(windowId);\n            }\n        }\n\n        if (!FacesContext.getCurrentInstance().getResponseComplete())\n        {\n            this.wrapped.execute(facesContext);\n        }\n    }\n\n    @Override\n    public PhaseListener[] getPhaseListeners()\n    {\n        return this.wrapped.getPhaseListeners();\n    }\n\n    @Override\n    public void removePhaseListener(PhaseListener phaseListener)\n    {\n        this.wrapped.removePhaseListener(phaseListener);\n    }\n\n    /**\n     * Performs cleanup tasks after the rendering process\n     */\n    @Override\n    public void render(FacesContext facesContext)\n    {\n        this.wrapped.render(facesContext);\n        \n        if (facesContext.getViewRoot() != null && facesContext.getViewRoot().getViewId() != null)\n        {\n            ViewAccessContext viewAccessContext = contextExtension.getViewAccessScopedContext();\n            if (viewAccessContext != null)\n            {\n                viewAccessContext.onProcessingViewFinished(facesContext.getViewRoot().getViewId());\n            }\n        }\n    }\n\n    @Override\n    public void attachWindow(FacesContext facesContext)\n    {\n        lazyInit();\n\n        ClientWindowConfig.ClientWindowRenderMode clientWindowRenderMode =\n                clientWindowConfig.getClientWindowRenderMode(facesContext);\n\n        if (clientWindowRenderMode == ClientWindowConfig.ClientWindowRenderMode.DELEGATED)\n        {\n            this.wrapped.attachWindow(facesContext);\n        }\n        else\n        {\n            if (!facesContext.getResponseComplete())\n            {\n                if (clientWindowRenderMode == ClientWindowConfig.ClientWindowRenderMode.LAZY)\n                {\n                    facesContext.getExternalContext().setClientWindow(new LazyClientWindow());\n                    facesContext.getExternalContext().getClientWindow().decode(facesContext);\n                }\n                else if (clientWindowRenderMode == ClientWindowConfig.ClientWindowRenderMode.CLIENTWINDOW)\n                {\n                    facesContext.getExternalContext().setClientWindow(new ClientSideClientWindow());\n                    facesContext.getExternalContext().getClientWindow().decode(facesContext);\n                }\n                else if (clientWindowRenderMode == ClientWindowConfig.ClientWindowRenderMode.NONE)\n                {\n                    // do nothing\n                }\n            }\n        }\n    }\n\n    private void broadcastInitializedJsfRequestEvent(FacesContext facesContext)\n    {\n        if (this.jsfRequestBroadcaster != null)\n        {\n            this.jsfRequestBroadcaster.broadcastInitializedJsfRequestEvent(facesContext);\n        }\n    }\n\n    private void lazyInit()\n    {\n        if (this.initialized == null)\n        {\n            init();\n        }\n    }\n\n    private synchronized void init()\n    {\n        // switch into paranoia mode\n        if (this.initialized == null)\n        {\n            if (ClassDeactivationUtils.isActivated(JsfRequestBroadcaster.class))\n            {\n                this.jsfRequestBroadcaster =\n                        BeanProvider.getContextualReference(JsfRequestBroadcaster.class, true);\n            }\n\n            this.windowContext = BeanProvider.getContextualReference(WindowContext.class, true);\n            this.contextExtension = BeanProvider.getContextualReference(DeltaSpikeContextExtension.class, true);\n            this.clientWindowConfig = BeanProvider.getContextualReference(ClientWindowConfig.class);\n            \n            this.initialized = true;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.request;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Destroyed;\nimport jakarta.enterprise.context.Initialized;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.event.Event;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.inject.Inject;\n\n/**\n * Broadcaster for\n * {@link jakarta.enterprise.context.Initialized}\n * {@link jakarta.enterprise.context.Destroyed}\n * with\n * {@link jakarta.faces.bean.RequestScoped} as annotation-parameter and\n * {@link FacesContext} as event-payload\n */\n@ApplicationScoped\npublic class JsfRequestBroadcaster implements Deactivatable\n{\n    @Inject @Initialized(RequestScoped.class) private Event<FacesContext> initEvent;\n    @Inject @Destroyed(RequestScoped.class) private Event<FacesContext> destroyedEvent;\n\n    /**\n     * Broadcasts @Initialized-event(s)\n     *\n     * @param facesContext current faces-context\n     */\n    public void broadcastInitializedJsfRequestEvent(FacesContext facesContext)\n    {\n        this.initEvent.fire(facesContext);\n    }\n\n    /**\n     * Broadcasts @Destroyed-event(s)\n     *\n     * @param facesContext current faces-context\n     */\n    public void broadcastDestroyedJsfRequestEvent(FacesContext facesContext)\n    {\n        this.destroyedEvent.fire(facesContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/system/JsfSystemEventBroadcaster.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.listener.system;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.faces.event.AbortProcessingException;\nimport jakarta.faces.event.SystemEvent;\nimport jakarta.faces.event.SystemEventListener;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\n\n/**\n * Broadcasts JSF events to CDI observers.\n */\npublic class JsfSystemEventBroadcaster implements SystemEventListener, Deactivatable\n{\n    private boolean isActivated = true;\n\n    public JsfSystemEventBroadcaster()\n    {\n        this.isActivated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public boolean isListenerForSource(Object source)\n    {\n        return true;\n    }\n\n    @Override\n    public void processEvent(SystemEvent e) throws AbortProcessingException\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n        beanManager.getEvent().fire(e);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/DefaultJsfMessage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.message;\n\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\n\nimport java.lang.reflect.Proxy;\n\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.impl.message.MessageBundleInvocationHandler;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.jsf.api.message.JsfMessage;\n\n/**\n * Default implementation of JsfMessage.\n * The complexity of setting the FacesMessage is\n * done in the {@link JsfMessageBundleInvocationHandler}.\n */\n@Vetoed\npublic class DefaultJsfMessage<T> implements JsfMessage<T>\n{\n    private final String clientId;\n    private final Class<T> type;\n    private final MessageBundleInvocationHandler invocationHandler;\n\n    /**\n     * The Message type\n     * @param type\n     * @param clientId\n     */\n    public DefaultJsfMessage(Class<T> type, String clientId, MessageBundleInvocationHandler invocationHandler)\n    {\n        this.type = type;\n        this.clientId = clientId;\n        this.invocationHandler = invocationHandler;\n\n        if (! type.isInterface() || type.getAnnotation(MessageBundle.class) == null)\n        {\n            throw new IllegalArgumentException(\"JsfMessage must only be used for interfaces \" +\n                \"annotated with @MessageBundle!\");\n        }\n    }\n\n    @Override\n    public JsfMessage<T> forClientId(String clientId)\n    {\n        return new DefaultJsfMessage<>(type, clientId, invocationHandler);\n    }\n\n    @Override\n    public JsfMessage<T> forComponent(UIComponent uiComponent)\n    {\n        return forClientId(uiComponent.getClientId());\n    }\n\n    @Override\n    public T addError()\n    {\n        return getMessage(FacesMessage.SEVERITY_ERROR);\n    }\n\n    @Override\n    public T addFatal()\n    {\n        return getMessage(FacesMessage.SEVERITY_FATAL);\n    }\n\n    @Override\n    public T addInfo()\n    {\n        return getMessage(FacesMessage.SEVERITY_INFO);\n    }\n\n    @Override\n    public T addWarn()\n    {\n        return getMessage(FacesMessage.SEVERITY_WARN);\n    }\n\n    @Override\n    public T get()\n    {\n        return getMessage(null);\n    }\n\n    private T getMessage(FacesMessage.Severity severity)\n    {\n        return type.cast(Proxy.newProxyInstance(ClassUtils.getClassLoader(null),\n                new Class<?>[]{type}, new JsfMessageBundleInvocationHandler(severity, clientId, invocationHandler)));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/FacesMessageEntry.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.message;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.application.FacesMessage;\nimport java.io.Serializable;\n\n/**\n * Entry for {@link FacesMessage} which have to be stored longer than a request\n */\n@Vetoed\npublic class FacesMessageEntry implements Serializable\n{\n    private static final long serialVersionUID = 6831499672107426470L;\n    private String componentId;\n    private FacesMessage facesMessage;\n\n    protected FacesMessageEntry()\n    {\n    }\n\n    /**\n     * Constructor for creating the entry for the given component-id and {@link FacesMessage}\n     * @param componentId current component-id\n     * @param facesMessage current faces-message\n     */\n    public FacesMessageEntry(String componentId, FacesMessage facesMessage)\n    {\n        this.componentId = componentId;\n        this.facesMessage = facesMessage;\n    }\n\n    /**\n     * Returns the current component-id\n     * @return component-id of the entry\n     */\n    public String getComponentId()\n    {\n        return componentId;\n    }\n\n    /**\n     * Returns the current {@link FacesMessage}\n     * @return faces-message of the entry\n     */\n    public FacesMessage getFacesMessage()\n    {\n        return facesMessage;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/JsfAwareLocaleResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.message;\n\nimport org.apache.deltaspike.core.impl.message.DefaultLocaleResolver;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.FacesContext;\nimport java.util.Iterator;\nimport java.util.Locale;\n\n@ApplicationScoped\n@Specializes\npublic class JsfAwareLocaleResolver extends DefaultLocaleResolver\n{\n    private static final long serialVersionUID = -8776583393262804931L;\n\n    @Override\n    public Locale getLocale()\n    {\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n        if (facesContext != null && facesContext.getCurrentPhaseId() != null)\n        {\n            UIViewRoot viewRoot = facesContext.getViewRoot();\n            Locale result = null;\n            if (viewRoot != null)\n            {\n                // if a ViewRoot is present we return the Locale from there\n                result = viewRoot.getLocale();\n            }\n\n            if (result != null)\n            {\n                Iterator<Locale> supportedLocale = facesContext.getApplication().getSupportedLocales();\n\n                boolean supportedLocaleConfigured = false;\n                while (supportedLocale.hasNext())\n                {\n                    supportedLocaleConfigured = true;\n                    if (result.equals(supportedLocale.next()))\n                    {\n                        return result;\n                    }\n                }\n\n                if (!supportedLocaleConfigured)\n                {\n                    return result;\n                }\n            }\n\n            result = facesContext.getApplication().getDefaultLocale();\n\n            if (result != null)\n            {\n                return result;\n            }\n        }\n\n        // return the default Locale, if no Locale was found\n        return super.getLocale();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/JsfMessageBundleInvocationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.message;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.impl.message.MessageBundleInvocationHandler;\nimport org.apache.deltaspike.jsf.api.message.JsfMessage;\n\n/**\n * This Proxy InvocationHandler automatically registers the\n * returned messages in the FacesContext if a severity is set.\n */\n@Vetoed\npublic class JsfMessageBundleInvocationHandler implements InvocationHandler\n{\n    private final FacesMessage.Severity severity;\n    private final String clientId;\n    private final MessageBundleInvocationHandler invocationHandler;\n\n    public JsfMessageBundleInvocationHandler(FacesMessage.Severity severity, String clientId,\n                                             MessageBundleInvocationHandler invocationHandler)\n    {\n        this.severity = severity;\n        this.clientId = clientId;\n        this.invocationHandler = invocationHandler;\n    }\n\n    @Override\n    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable\n    {\n        Object message = invocationHandler.invoke(proxy, method, args);\n\n        if (severity == null)\n        {\n            if (message instanceof Message)\n            {\n                return message;\n            }\n\n            return getMessageCategory(message, JsfMessage.CATEGORY_SUMMARY);\n        }\n        else\n        {\n            String summary = getMessageCategory(message, JsfMessage.CATEGORY_SUMMARY);\n            String detail = getMessageCategory(message, JsfMessage.CATEGORY_DETAIL);\n\n            FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(severity, summary, detail));\n\n            return message;\n        }\n    }\n\n    private String getMessageCategory(Object message, String category)\n    {\n        if (message == null)\n        {\n            return null;\n        }\n\n        if (message instanceof String)\n        {\n            return (String) message;\n        }\n        else if (message instanceof Message)\n        {\n            return ((Message) message).toString(category);\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"message must be of either type String or Message but was: \" +\n                message.getClass() + \" value: \" + message);\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/JsfMessageProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.message;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\n\nimport org.apache.deltaspike.core.impl.message.MessageBundleInvocationHandler;\nimport org.apache.deltaspike.jsf.api.message.JsfMessage;\n\n/**\n * Produces a dependent JsfMessage\n */\n@ApplicationScoped\npublic class JsfMessageProducer\n{\n    @Produces\n    @Dependent\n    public <M> JsfMessage<M> createJsfMessage(InjectionPoint injectionPoint,\n                                       MessageBundleInvocationHandler invocationHandler)\n    {\n        if (!(injectionPoint.getType() instanceof ParameterizedType))\n        {\n            throw new IllegalArgumentException(\"JsfMessage must be used as generic type\");\n        }\n        ParameterizedType paramType = (ParameterizedType) injectionPoint.getType();\n        Type[] actualTypes = paramType.getActualTypeArguments();\n        if (actualTypes.length != 1)\n        {\n            throw new IllegalArgumentException(\"JsfMessage must have the MessageBundle as generic type parameter\");\n        }\n        try\n        {\n            @SuppressWarnings(\"unchecked\")\n            Class<M> type = (Class<M>) actualTypes[0];\n            return createJsfMessageFor(injectionPoint, type, invocationHandler);\n        }\n        catch (ClassCastException e)\n        {\n            throw new IllegalArgumentException(\"Incorrect class found when trying to convert to parameterized type\",e);\n        }\n    }\n\n    private <M> JsfMessage<M> createJsfMessageFor(InjectionPoint injectionPoint, Class<M> rawType,\n                                                  MessageBundleInvocationHandler invocationHandler)\n    {\n        // X TODO check if the JsfMessage should get injected into a UIComponent and use #getClientId()\n        return new DefaultJsfMessage<>(rawType, null, invocationHandler);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/JsfMessageResolver.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.message;\n\nimport org.apache.deltaspike.core.api.message.MessageContext;\nimport org.apache.deltaspike.core.impl.message.DefaultMessageResolver;\n\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\nimport java.util.ArrayList;\nimport java.util.List;\n\n@Specializes\npublic class JsfMessageResolver extends DefaultMessageResolver\n{\n    @Override\n    protected List<String> getMessageSources(MessageContext messageContext)\n    {\n        List<String> result = new ArrayList<>(super.getMessageSources(messageContext) /*unmodifiable-list*/);\n\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n\n        if (facesContext == null || facesContext.getCurrentPhaseId() == null)\n        {\n            return result;\n        }\n\n        String bundleName = facesContext.getApplication().getMessageBundle();\n\n        if (bundleName != null)\n        {\n            result.add(bundleName);\n        }\n        result.add(FacesMessage.FACES_MESSAGES); //default messages from jsf\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/DeltaSpikeNavigationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.navigation;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.navigation.NavigationCaseMapWrapper;\nimport org.apache.deltaspike.jsf.impl.config.view.navigation.ViewConfigAwareNavigationHandler;\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\n\nimport jakarta.faces.application.ConfigurableNavigationHandler;\nimport jakarta.faces.application.NavigationCase;\nimport jakarta.faces.application.NavigationHandler;\nimport jakarta.faces.context.FacesContext;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.CopyOnWriteArraySet;\nimport org.apache.deltaspike.jsf.impl.scope.viewaccess.ViewAccessScopedAwareNavigationHandler;\n\npublic class DeltaSpikeNavigationHandler extends ConfigurableNavigationHandler implements Deactivatable\n{\n    private Set<String> otherOutcomes = new CopyOnWriteArraySet<>();\n\n    private Map<String, NavigationCase> viewConfigBasedNavigationCaseCache\n        = new ConcurrentHashMap<>();\n\n    private final NavigationHandler wrapped;\n    private final boolean activated;\n    private final boolean vasnhActivated;\n\n    /**\n     * Constructor for wrapping the given {@link NavigationHandler}\n     *\n     * @param navigationHandler navigation-handler which should be wrapped\n     */\n    public DeltaSpikeNavigationHandler(NavigationHandler navigationHandler)\n    {\n        this.wrapped = navigationHandler;\n        this.activated = ClassDeactivationUtils.isActivated(getClass());\n        this.vasnhActivated = ClassDeactivationUtils.isActivated(ViewAccessScopedAwareNavigationHandler.class);\n    }\n\n    @Override\n    public void handleNavigation(FacesContext context, String fromAction, String outcome)\n    {\n        if (!this.activated || isUnhandledExceptionQueued(context))\n        {\n            this.wrapped.handleNavigation(context, fromAction, outcome);\n        }\n        else\n        {\n            //don't refactor it - currently we need the lazy wrapping due to special jsf2 constellations\n            getWrappedNavigationHandler().handleNavigation(context, fromAction, outcome);\n        }\n    }\n\n    private boolean isUnhandledExceptionQueued(FacesContext context)\n    {\n        return context.getExceptionHandler().getUnhandledExceptionQueuedEvents() != null &&\n                context.getExceptionHandler().getUnhandledExceptionQueuedEvents().iterator().hasNext();\n    }\n\n    private NavigationHandler getWrappedNavigationHandler()\n    {\n        NavigationHandler navigationHandler = new ViewConfigAwareNavigationHandler(this.wrapped);\n\n        if (vasnhActivated)\n        {\n            navigationHandler = new ViewAccessScopedAwareNavigationHandler(navigationHandler);\n        }\n\n        return navigationHandler;\n    }\n\n    @Override\n    public NavigationCase getNavigationCase(FacesContext context, String action, String outcome)\n    {\n        if (this.wrapped instanceof ConfigurableNavigationHandler)\n        {\n            if (!this.activated)\n            {\n                return ((ConfigurableNavigationHandler)this.wrapped).getNavigationCase(context, action, outcome);\n            }\n\n            if (action == null && outcome != null && outcome.contains(\".\") && outcome.startsWith(\"class \") &&\n                    !otherOutcomes.contains(outcome))\n            {\n                String originalOutcome = outcome;\n\n                NavigationCase navigationCase = this.viewConfigBasedNavigationCaseCache.get(originalOutcome);\n\n                if (navigationCase != null)\n                {\n                    return navigationCase;\n                }\n\n                outcome = outcome.substring(6);\n\n                ViewConfigDescriptor entry = null;\n\n                if (DefaultErrorView.class.getName().equals(originalOutcome))\n                {\n                    ViewConfigResolver viewConfigResolver = JsfUtils.getViewConfigResolver();\n                    entry = viewConfigResolver.getDefaultErrorViewConfigDescriptor();\n                }\n\n                if (entry == null)\n                {\n                    Object loadedClass = ClassUtils.tryToLoadClassForName(outcome);\n\n                    if (loadedClass == null)\n                    {\n                        this.otherOutcomes.add(originalOutcome);\n                    }\n                    else if (ViewConfig.class.isAssignableFrom((Class) loadedClass))\n                    {\n                        entry = JsfUtils.getViewConfigResolver()\n                                .getViewConfigDescriptor((Class<? extends ViewConfig>) loadedClass);\n                    }\n                }\n\n                if (entry != null)\n                {\n                    View.NavigationMode navigationMode = entry.getMetaData(View.class).iterator().next().navigation();\n\n                    navigationCase = new NavigationCase(\"*\",\n                            null,\n                            null,\n                            null,\n                            entry.getViewId(),\n                            null,\n                            View.NavigationMode.REDIRECT.equals(navigationMode),\n                            false);\n                    this.viewConfigBasedNavigationCaseCache.put(originalOutcome, navigationCase);\n                    return navigationCase;\n                }\n            }\n            return ((ConfigurableNavigationHandler) this.wrapped).getNavigationCase(context, action, outcome);\n        }\n        return null;\n    }\n\n    @Override\n    public Map<String, Set<NavigationCase>> getNavigationCases()\n    {\n        Map<String, Set<NavigationCase>> result = null;\n\n        if (this.wrapped instanceof ConfigurableNavigationHandler)\n        {\n            result = ((ConfigurableNavigationHandler) this.wrapped).getNavigationCases();\n        }\n\n        if (result == null)\n        {\n            result = new HashMap<>();\n        }\n\n        if (!this.activated)\n        {\n            return result;\n        }\n\n        return new NavigationCaseMapWrapper(result, this.wrapped);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/DeltaSpikeNavigationHandlerWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.navigation;\n\nimport jakarta.faces.application.ConfigurableNavigationHandler;\nimport jakarta.faces.application.ConfigurableNavigationHandlerWrapper;\nimport jakarta.faces.application.NavigationCase;\nimport jakarta.faces.context.FacesContext;\nimport java.util.Map;\nimport java.util.Set;\n\n//ATTENTION: don't rename/move this class as long as we need the workaround in impl-ee6\n//(further details are available at: DELTASPIKE-655 and DELTASPIKE-659)\n\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class DeltaSpikeNavigationHandlerWrapper extends ConfigurableNavigationHandlerWrapper\n{\n    private final ConfigurableNavigationHandler wrapped;\n    private final DeltaSpikeNavigationHandler deltaSpikeNavigationHandler;\n\n    public DeltaSpikeNavigationHandlerWrapper(ConfigurableNavigationHandler wrapped)\n    {\n        this.wrapped = wrapped;\n        //only for delegating the methods implemented by DeltaSpikeNavigationHandler\n        this.deltaSpikeNavigationHandler = new DeltaSpikeNavigationHandler(wrapped);\n    }\n\n    @Override\n    public void handleNavigation(FacesContext context, String fromAction, String outcome)\n    {\n        this.deltaSpikeNavigationHandler.handleNavigation(context, fromAction, outcome);\n    }\n\n    @Override\n    public Map<String, Set<NavigationCase>> getNavigationCases()\n    {\n        return this.deltaSpikeNavigationHandler.getNavigationCases();\n    }\n\n    @Override\n    public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome)\n    {\n        return this.deltaSpikeNavigationHandler.getNavigationCase(context, fromAction, outcome);\n    }\n\n    @Override\n    public ConfigurableNavigationHandler getWrapped()\n    {\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.navigation;\n\nimport jakarta.faces.application.ConfigurableNavigationHandler;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport jakarta.faces.application.Application;\nimport jakarta.faces.application.ApplicationWrapper;\nimport jakarta.faces.application.NavigationHandler;\n\npublic class NavigationHandlerAwareApplication extends ApplicationWrapper implements Deactivatable\n{\n    private final Application wrapped;\n\n    public NavigationHandlerAwareApplication(Application wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    @Override\n    public NavigationHandler getNavigationHandler()\n    {\n        NavigationHandler wrappedNavigationHandler = this.wrapped.getNavigationHandler();\n        return new DeltaSpikeNavigationHandlerWrapper((ConfigurableNavigationHandler) wrappedNavigationHandler);\n    }\n\n    @Override\n    public Application getWrapped()\n    {\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.resource;\n\nimport jakarta.faces.application.Resource;\nimport jakarta.faces.application.ResourceWrapper;\n\n/**\n * {@link ResourceWrapper} which appends the version of DeltaSpike to the URL.\n */\npublic class DeltaSpikeResource extends ResourceWrapper\n{\n\n    private final Resource wrapped;\n    private final String version;\n\n    public DeltaSpikeResource(Resource resource, String version)\n    {\n        super();\n        this.wrapped = resource;\n        this.version = version;\n    }\n\n    @Override\n    public Resource getWrapped()\n    {\n        return wrapped;\n    }\n\n    @Override\n    public String getRequestPath()\n    {\n        return super.getRequestPath() + \"&v=\" + version;\n    }\n\n    @Override\n    public String getContentType()\n    {\n        return getWrapped().getContentType();\n    }\n\n    @Override\n    public String getLibraryName()\n    {\n        return getWrapped().getLibraryName();\n    }\n\n    @Override\n    public String getResourceName()\n    {\n        return getWrapped().getResourceName();\n    }\n\n    @Override\n    public void setContentType(String contentType)\n    {\n        getWrapped().setContentType(contentType);\n    }\n\n    @Override\n    public void setLibraryName(String libraryName)\n    {\n        getWrapped().setLibraryName(libraryName);\n    }\n\n    @Override\n    public void setResourceName(String resourceName)\n    {\n        getWrapped().setResourceName(resourceName);\n    }\n\n    @Override\n    public String toString()\n    {\n        return getWrapped().toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResourceHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.resource;\n\nimport jakarta.faces.application.Resource;\nimport jakarta.faces.application.ResourceHandler;\nimport jakarta.faces.application.ResourceHandlerWrapper;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\n\n/**\n * {@link ResourceHandlerWrapper} to deliver uncompressed resources in {@link ProjectStage#Development}.\n */\npublic class DeltaSpikeResourceHandler extends ResourceHandlerWrapper implements Deactivatable\n{\n    private static final String LIBRARY = \"deltaspike\";\n    private static final String LIBRARY_UNCOMPRESSED = \"deltaspike-uncompressed\";\n    \n    private final ResourceHandler wrapped;\n    private final String version;\n    private final boolean activated;\n\n    public DeltaSpikeResourceHandler(ResourceHandler resourceHandler)\n    {\n        super();\n\n        wrapped = resourceHandler;\n        version = ClassUtils.getJarVersion(this.getClass());\n        activated = ClassDeactivationUtils.isActivated(this.getClass());\n    }\n\n    @Override\n    public Resource createResource(String resourceName, String libraryName)\n    {\n        Resource resource = wrapped.createResource(resourceName, libraryName);\n\n        if (activated && resource != null && libraryName != null && LIBRARY.equals(libraryName))\n        {\n            if (ProjectStageProducer.getInstance().getProjectStage() == ProjectStage.Development)\n            {\n                resource = wrapped.createResource(resourceName, LIBRARY_UNCOMPRESSED);\n            }\n            \n            resource = new DeltaSpikeResource(resource, version);\n        }\n\n        return resource;\n    }\n\n    @Override\n    public ResourceHandler getWrapped()\n    {\n        return wrapped;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/viewaccess/ViewAccessScopedAwareNavigationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.scope.viewaccess;\n\nimport jakarta.faces.application.NavigationHandler;\nimport jakarta.faces.context.FacesContext;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension;\nimport org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\npublic class ViewAccessScopedAwareNavigationHandler extends NavigationHandler implements Deactivatable\n{\n    private final NavigationHandler navigationHandler;\n\n    private volatile Boolean initialized;\n    \n    private DeltaSpikeContextExtension contextExtension;\n    \n    public ViewAccessScopedAwareNavigationHandler(NavigationHandler navigationHandler)\n    {\n        this.navigationHandler = navigationHandler;\n    }\n\n    @Override\n    public void handleNavigation(FacesContext context, String fromAction, String outcome)\n    {\n        // remember viewId before navigation\n        String viewId = null;\n        if (context.getViewRoot() != null)\n        {\n            viewId = context.getViewRoot().getViewId();\n        }\n\n        this.navigationHandler.handleNavigation(context, fromAction, outcome);\n        \n        if (viewId != null && context.isPostback() /*need for supporting view-actions correctly - see DELTASPIKE-795*/)\n        {\n            lazyInit();\n\n            ViewAccessContext viewAccessContext = contextExtension.getViewAccessScopedContext();\n            if (viewAccessContext != null)\n            {\n                viewAccessContext.onProcessingViewFinished(viewId);\n            }\n        }\n    }\n\n    private void lazyInit()\n    {\n        if (this.initialized == null)\n        {\n            init();\n        }\n    }\n\n    private synchronized void init()\n    {\n        // switch into paranoia mode\n        if (this.initialized == null)\n        {\n            contextExtension = BeanProvider.getContextualReference(DeltaSpikeContextExtension.class, true);\n            \n            this.initialized = true;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/JsfWindowContextQuotaHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.scope.window;\n\nimport org.apache.deltaspike.core.impl.scope.window.DefaultWindowContextQuotaHandler;\nimport org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.inject.Specializes;\nimport jakarta.inject.Inject;\n\n@Specializes\npublic class JsfWindowContextQuotaHandler extends DefaultWindowContextQuotaHandler\n{\n    @Inject\n    private ClientWindowConfig clientWindowConfig;\n\n    @Override\n    @PostConstruct\n    protected void init()\n    {\n        this.maxWindowContextCount = this.clientWindowConfig.getMaxWindowContextCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/SecurityAwareViewHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.security;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.util.SecurityUtils;\nimport org.apache.deltaspike.security.api.authorization.ErrorViewAwareAccessDeniedException;\nimport org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;\n\nimport jakarta.faces.application.ViewHandler;\nimport jakarta.faces.application.ViewHandlerWrapper;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.FacesContext;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.logging.Logger;\n\npublic class SecurityAwareViewHandler extends ViewHandlerWrapper implements Deactivatable\n{\n    public  static final String PRE_DESTROY_VIEW_MAP_EVENT_FILTER_ENABLED =\n            SecurityAwareViewHandler.class.getName() + \"#PRE_DESTROY_VIEW_MAP_EVENT_FILTER_ENABLED\";\n\n    protected final ViewHandler wrapped;\n\n    private final boolean activated;\n    private volatile Boolean securityModuleActivated;\n\n    /**\n     * Constructor for wrapping the given {@link ViewHandler}\n     *\n     * @param wrapped view-handler which should be wrapped\n     */\n    public SecurityAwareViewHandler(ViewHandler wrapped)\n    {\n        this.wrapped = wrapped;\n\n        this.activated = ClassDeactivationUtils.isActivated(getClass());\n    }\n\n    @Override\n    public ViewHandler getWrapped()\n    {\n        return this.wrapped;\n    }\n\n    @Override\n    public UIViewRoot createView(FacesContext context, String viewId)\n    {\n        UIViewRoot result = this.wrapped.createView(context, viewId);\n\n        if (!this.activated)\n        {\n            return result;\n        }\n\n        if (this.securityModuleActivated == null)\n        {\n            lazyInit();\n        }\n        if (!this.securityModuleActivated)\n        {\n            return result;\n        }\n\n        UIViewRoot originalViewRoot = context.getViewRoot();\n\n        Map<String, Object> viewMap = null;\n        if (originalViewRoot != null)\n        {\n            Map<String, Object> originalViewMap = originalViewRoot.getViewMap(false);\n\n            if (originalViewMap != null && !originalViewMap.isEmpty())\n            {\n                viewMap = new HashMap<String, Object>();\n                viewMap.putAll(originalViewMap);\n            }\n        }\n\n        //workaround for PreDestroyViewMapEvent which would be caused by the security check\n        deactivatePreDestroyViewMapEvent(context);\n\n        //we have to use it as current view if an AccessDecisionVoter uses the JSF API to check access to the view-id\n        context.setViewRoot(result);\n\n        try\n        {\n            ViewRootAccessHandler viewRootAccessHandler =\n                    BeanProvider.getContextualReference(ViewRootAccessHandler.class);\n\n            viewRootAccessHandler.checkAccessTo(result);\n        }\n        catch (ErrorViewAwareAccessDeniedException accessDeniedException)\n        {\n            ViewConfigResolver viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);\n\n            ViewConfigDescriptor errorViewDescriptor = viewConfigResolver\n                    .getViewConfigDescriptor(accessDeniedException.getErrorView());\n\n            if (errorViewDescriptor != null && View.NavigationMode.REDIRECT ==\n                errorViewDescriptor.getMetaData(View.class).iterator().next().navigation() /*always available*/ &&\n                BeanProvider.getContextualReference(JsfModuleConfig.class)\n                    .isAlwaysUseNavigationHandlerOnSecurityViolation())\n            {\n                SecurityUtils.tryToHandleSecurityViolation(accessDeniedException);\n            }\n            else\n            {\n                SecurityUtils.handleSecurityViolationWithoutNavigation(accessDeniedException);\n            }\n\n            if (errorViewDescriptor != null)\n            {\n                return this.wrapped.createView(context, errorViewDescriptor.getViewId());\n            }\n            else\n            {\n                //only in case of GET requests, because an exception during POST requests leads to re-rendering\n                //the previous page (including the error message)\n                if (!context.isPostback() && context.getViewRoot() != null)\n                {\n                    context.getViewRoot().setViewId(null);\n                }\n            }\n            throw accessDeniedException; //security exception without error-view\n        }\n        finally\n        {\n            activatePreDestroyViewMapEvent(context);\n            if (originalViewRoot != null)\n            {\n                context.setViewRoot(originalViewRoot);\n                if (viewMap != null)\n                {\n                    originalViewRoot.getViewMap().putAll(viewMap);\n                }\n            }\n        }\n\n        return result;\n    }\n\n    private synchronized void lazyInit()\n    {\n        if (this.securityModuleActivated != null)\n        {\n            return;\n        }\n\n        this.securityModuleActivated =\n            BeanProvider.getContextualReference(EditableAccessDecisionVoterContext.class, true) != null;\n\n        if (!this.securityModuleActivated)\n        {\n            Logger.getLogger(getClass().getName()) //it's the only case for which a logger is needed in this class\n                    .info(\"security-module-impl isn't used -> \" + getClass().getName() + \" gets deactivated\");\n        }\n    }\n\n    private void deactivatePreDestroyViewMapEvent(FacesContext facesContext)\n    {\n        facesContext.getExternalContext().getRequestMap().put(PRE_DESTROY_VIEW_MAP_EVENT_FILTER_ENABLED, Boolean.TRUE);\n    }\n\n    private void activatePreDestroyViewMapEvent(FacesContext facesContext)\n    {\n        facesContext.getExternalContext().getRequestMap().put(PRE_DESTROY_VIEW_MAP_EVENT_FILTER_ENABLED, Boolean.FALSE);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/ViewRootAccessHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.security;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.jsf.impl.util.SecurityUtils;\nimport org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.inject.Inject;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Stack;\n\n@RequestScoped\npublic class ViewRootAccessHandler\n{\n    @Inject\n    private ViewConfigResolver viewConfigResolver;\n\n    private List<String> checkedViewIds = new ArrayList<String>();\n\n    public void checkAccessTo(UIViewRoot uiViewRoot)\n    {\n        if (uiViewRoot == null)\n        {\n            return;\n        }\n\n        String viewId = uiViewRoot.getViewId();\n\n        if (!checkView(viewId))\n        {\n            return;\n        }\n\n        this.checkedViewIds.add(viewId);\n\n        ConfigDescriptor configDescriptor = this.viewConfigResolver.getViewConfigDescriptor(viewId);\n\n        //topmost nodes get checked first\n        Stack<ConfigDescriptor> configDescriptorStack = new Stack<ConfigDescriptor>();\n\n        if (configDescriptor != null)\n        {\n            configDescriptorStack.push(configDescriptor);\n        }\n\n        List<String> parentPathList = new ArrayList<String>();\n        createPathList(viewId, parentPathList);\n\n        ConfigDescriptor pathDescriptor;\n        for (String path : parentPathList)\n        {\n            pathDescriptor = this.viewConfigResolver.getConfigDescriptor(path);\n\n            if (pathDescriptor != null)\n            {\n                configDescriptorStack.push(pathDescriptor);\n            }\n        }\n\n        EditableAccessDecisionVoterContext accessDecisionVoterContext =\n                BeanProvider.getContextualReference(EditableAccessDecisionVoterContext.class, false);\n\n        for (ConfigDescriptor currentConfigDescriptor : configDescriptorStack)\n        {\n            SecurityUtils.invokeVoters(accessDecisionVoterContext, currentConfigDescriptor);\n        }\n    }\n\n    private void createPathList(String currentPath, List<String> pathList)\n    {\n        if (!currentPath.contains(\"/\"))\n        {\n            return;\n        }\n\n        String parentFolder = currentPath.substring(0, currentPath.lastIndexOf(\"/\"));\n        pathList.add(parentFolder + \"/\");\n        createPathList(parentFolder, pathList);\n    }\n\n    private boolean checkView(String viewId)\n    {\n        return viewId != null && !this.checkedViewIds.contains(viewId);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/token/DoubleSubmitAwarePhaseListener.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.token;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.jsf.api.listener.phase.JsfPhaseListener;\n\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.event.PhaseEvent;\nimport jakarta.faces.event.PhaseId;\nimport jakarta.faces.event.PhaseListener;\nimport jakarta.inject.Inject;\nimport java.util.Map;\n\n//ignore jsf-ajax requests since they have to be queued according to the spec.\n//ignore get-requests since they >shouldn't< change the state (we couldn't support them at all)\n//post-requests don't get pipelined -> no need to sync. them per session\n//browser-window-handling is done implicitly (PostRequestTokenManager is window-scoped)\n@JsfPhaseListener(ordinal = 9000)\npublic class DoubleSubmitAwarePhaseListener implements PhaseListener, Deactivatable\n{\n    private static final long serialVersionUID = -4247051429332418226L;\n\n    @Inject\n    private PostRequestTokenManager postRequestTokenManager;\n\n    @Override\n    public void afterPhase(PhaseEvent event)\n    {\n        FacesContext facesContext = event.getFacesContext();\n\n        //only check full POST requests\n        if (facesContext.isPostback() && !facesContext.getPartialViewContext().isAjaxRequest())\n        {\n            String receivedPostRequestToken = facesContext.getExternalContext()\n                .getRequestParameterMap().get(PostRequestTokenMarker.POST_REQUEST_TOKEN_KEY);\n\n            if (receivedPostRequestToken == null)\n            {\n                receivedPostRequestToken = findPostRequestTokenWithPrefix(facesContext);\n            }\n\n            if (!this.postRequestTokenManager.isValidRequest(receivedPostRequestToken))\n            {\n                facesContext.renderResponse();\n            }\n        }\n    }\n\n    @Override\n    public void beforePhase(PhaseEvent event)\n    {\n        //refresh the token in case of GET-requests to avoid that the token is re-used on the next page\n        if (!event.getFacesContext().isPostback())\n        {\n            this.postRequestTokenManager.createNewToken();\n        }\n    }\n\n    @Override\n    public PhaseId getPhaseId()\n    {\n        return PhaseId.RESTORE_VIEW;\n    }\n\n    protected String findPostRequestTokenWithPrefix(FacesContext facesContext)\n    {\n        for (Map.Entry<String, String> parameterEntry :\n            facesContext.getExternalContext().getRequestParameterMap().entrySet())\n        {\n            if (parameterEntry.getKey().endsWith(PostRequestTokenMarker.POST_REQUEST_TOKEN_WITH_PREFIX_KEY) ||\n                parameterEntry.getKey().endsWith(PostRequestTokenMarker.POST_REQUEST_TOKEN_WITH_MANUAL_PREFIX_KEY))\n            {\n                return parameterEntry.getValue();\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/token/PostRequestTokenManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.token;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\n\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\nimport java.util.UUID;\n\n@WindowScoped\n@Named(\"dsPostRequestToken\")\npublic class PostRequestTokenManager implements Serializable\n{\n    private static final long serialVersionUID = 5387627547198129897L;\n\n    private volatile String currentToken;\n\n    private boolean allowPostRequestWithoutDoubleSubmitPrevention = true;\n\n    protected PostRequestTokenManager()\n    {\n    }\n\n    @Inject\n    public PostRequestTokenManager(JsfModuleConfig config)\n    {\n        this.allowPostRequestWithoutDoubleSubmitPrevention = config.isAllowPostRequestWithoutDoubleSubmitPrevention();\n    }\n\n    public void createNewToken()\n    {\n        this.currentToken = UUID.randomUUID().toString().replace(\"-\", \"\");\n    }\n\n    public synchronized boolean isValidRequest(String token)\n    {\n        if (token == null)\n        {\n            return this.allowPostRequestWithoutDoubleSubmitPrevention;\n        }\n        String previousToken = this.currentToken;\n        createNewToken();\n\n        return token.equals(previousToken);\n    }\n\n    public String getCurrentToken()\n    {\n        return this.currentToken;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/token/PostRequestTokenMarker.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.token;\n\npublic interface PostRequestTokenMarker\n{\n    String POST_REQUEST_TOKEN_KEY = \"dsprt\";\n\n    String POST_REQUEST_TOKEN_WITH_PREFIX_KEY = \":\" + POST_REQUEST_TOKEN_KEY;\n    String POST_REQUEST_TOKEN_WITH_MANUAL_PREFIX_KEY = \"_\" + POST_REQUEST_TOKEN_KEY;\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.FacesException;\nimport jakarta.faces.context.ExternalContext;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.lifecycle.ClientWindow;\nimport jakarta.faces.render.ResponseStateManager;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;\n\nimport java.io.IOException;\nimport java.io.UnsupportedEncodingException;\nimport java.net.URLDecoder;\nimport java.net.URLEncoder;\nimport java.util.*;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n@Vetoed\npublic abstract class ClientWindowHelper\n{\n    private static final Logger LOG = Logger.getLogger(ClientWindowHelper.class.getName());\n\n    private static final String INITIAL_REDIRECT_WINDOW_ID = ClientWindowHelper.class.getName()\n            + \".INITIAL_REDIRECT_WINDOW_ID\";\n\n    public abstract class RequestParameters\n    {\n        public static final String REQUEST_TOKEN = \"dsrid\";\n    }\n\n    public abstract class Cookies\n    {\n        public static final String REQUEST_WINDOW_ID_PREFIX = \"dsrwid-\";\n    }\n\n    public static String constructRequestUrl(FacesContext facesContext, ExternalContext externalContext)\n    {\n        String url = externalContext.getRequestContextPath()\n                + externalContext.getRequestServletPath();\n\n        if (externalContext.getRequestPathInfo() != null)\n        {\n            url += externalContext.getRequestPathInfo();\n        }\n\n        url = JsfUtils.addRequestParameters(externalContext, url, true);\n        // always remove jfwid to force adding new jfwid as JSF impl otherwise just ignores it\n        url = JsfUtils.removeUrlParameter(url, ResponseStateManager.CLIENT_WINDOW_URL_PARAM);\n\n        // TODO currently this is broken in Mojarra and will be fixed in 4.0.6\n        // url = externalContext.encodeRedirectURL(url, null);\n\n        // let's reuse the logic from MyFaces instead\n        HttpServletResponse servletResponse = (HttpServletResponse) externalContext.getResponse();\n        url = servletResponse.encodeRedirectURL(encodeURL(url, facesContext, servletResponse.getCharacterEncoding()));\n\n        return url;\n    }\n\n    // copied from MyFaces\n    private static String encodeURL(String baseUrl, FacesContext facesContext, String encoding)\n    {\n        if (baseUrl == null)\n        {\n            throw new NullPointerException(\"baseUrl is null\");\n        }\n\n        String fragment = null;\n        String queryString = null;\n        Map<String, List<String>> paramMap = null;\n\n        //extract any URL fragment\n        int index = baseUrl.indexOf('#');\n        if (index != -1)\n        {\n            fragment = baseUrl.substring(index + 1);\n            baseUrl = baseUrl.substring(0, index);\n        }\n\n        //extract the current query string and add the params to the paramMap\n        index = baseUrl.indexOf('?');\n        if (index != -1)\n        {\n            queryString = baseUrl.substring(index + 1);\n            baseUrl = baseUrl.substring(0, index);\n            String[] nameValuePairs = queryString.split(\"&\");\n            for (int i = 0; i < nameValuePairs.length; i++)\n            {\n                String[] currentPair = nameValuePairs[i].split(\"=\");\n                String currentName = currentPair[0];\n\n                if (paramMap == null)\n                {\n                    paramMap = new HashMap<>(5, 1f);\n                }\n\n                List<String> values = paramMap.get(currentName);\n                if (values == null)\n                {\n                    values = new ArrayList<>(1);\n                    paramMap.put(currentName, values);\n                }\n\n                try\n                {\n                    values.add(currentPair.length > 1\n                            ? URLDecoder.decode(currentPair[1], encoding)\n                            : \"\");\n                }\n                catch (UnsupportedEncodingException e)\n                {\n                    //shouldn't ever get here\n                    throw new UnsupportedOperationException(\"Encoding type=\" + encoding\n                            + \" not supported\", e);\n                }\n            }\n        }\n\n        ClientWindow window = facesContext.getExternalContext().getClientWindow();\n        if (window != null && window.isClientWindowRenderModeEnabled(facesContext))\n        {\n            if (paramMap == null)\n            {\n                paramMap = new HashMap<>(5, 1f);\n            }\n\n            if (!paramMap.containsKey(ResponseStateManager.CLIENT_WINDOW_URL_PARAM))\n            {\n                paramMap.put(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, Arrays.asList(window.getId()));\n            }\n\n            Map<String, String> additionalQueryURLParameters = window.getQueryURLParameters(facesContext);\n            if (additionalQueryURLParameters != null)\n            {\n                for (Map.Entry<String , String> entry : additionalQueryURLParameters.entrySet())\n                {\n                    paramMap.put(entry.getKey(), Arrays.asList(entry.getValue()));\n                }\n            }\n        }\n\n        boolean hasParams = paramMap != null && !paramMap.isEmpty();\n\n        if (!hasParams && fragment == null)\n        {\n            return baseUrl;\n        }\n\n        // start building the new URL\n        StringBuilder newUrl = new StringBuilder(baseUrl.length() + 10);\n        newUrl.append(baseUrl);\n\n        //now add the updated param list onto the url\n        if (hasParams)\n        {\n            boolean isFirstPair = true;\n            for (Map.Entry<String, List<String>> pair : paramMap.entrySet())\n            {\n                for (int i = 0; i < pair.getValue().size(); i++)\n                {\n                    String value = pair.getValue().get(i);\n\n                    if (!isFirstPair)\n                    {\n                        newUrl.append('&');\n                    }\n                    else\n                    {\n                        newUrl.append('?');\n                        isFirstPair = false;\n                    }\n\n                    newUrl.append(pair.getKey());\n                    newUrl.append('=');\n                    if (value != null)\n                    {\n                        try\n                        {\n                            newUrl.append(URLEncoder.encode(value, encoding));\n                        }\n                        catch (UnsupportedEncodingException e)\n                        {\n                            //shouldn't ever get here\n                            throw new UnsupportedOperationException(\"Encoding type=\" + encoding\n                                    + \" not supported\", e);\n                        }\n                    }\n                }\n            }\n        }\n\n        //add the fragment back on (if any)\n        if (fragment != null)\n        {\n            newUrl.append('#');\n            newUrl.append(fragment);\n        }\n\n        return newUrl.toString();\n    }\n\n    /**\n     * Handles the initial redirect for the LAZY mode, if no windowId is available in the current request URL.\n     *\n     * @param facesContext the {@link FacesContext}\n     * @param newWindowId the new windowId\n     */\n    public static void handleInitialRedirect(FacesContext facesContext, String newWindowId)\n    {        \n        // store the new windowId as context attribute to prevent infinite loops\n        // #sendRedirect will append the windowId (from ClientWindow#getWindowId again) to the redirectUrl\n        facesContext.getAttributes().put(INITIAL_REDIRECT_WINDOW_ID, newWindowId);\n\n        ExternalContext externalContext = facesContext.getExternalContext();\n\n        String url = constructRequestUrl(facesContext, externalContext);\n\n        // remember the initial redirect windowId till the next request - see #729\n        addRequestWindowIdCookie(facesContext, newWindowId, newWindowId);\n\n        try\n        {\n            externalContext.redirect(url);\n        }\n        catch (IOException e)\n        {\n            throw new FacesException(\"Could not send initial redirect!\", e);\n        }\n    }\n\n    public static boolean isInitialRedirect(FacesContext facesContext)\n    {\n        return facesContext.getAttributes().containsKey(INITIAL_REDIRECT_WINDOW_ID);\n    }\n\n    public static String getInitialRedirectWindowId(FacesContext facesContext)\n    {\n        return (String) facesContext.getAttributes().get(INITIAL_REDIRECT_WINDOW_ID);\n    }\n\n    public static void addRequestWindowIdCookie(FacesContext context, String requestToken, String windowId)\n    {\n        /* Sadly doesn't work due to SameSite is not allowed on Java cookies ^^\n            Map<String, Object> properties = new HashMap();\n            properties.put(\"path\", \"/\");\n            properties.put(\"maxAge\", 30);\n            context.getExternalContext().addResponseCookie(\n                Cookies.REQUEST_WINDOW_ID_PREFIX + requestToken, windowId, properties);\n        */\n        context.getExternalContext().addResponseHeader(\"Set-Cookie\",\n            Cookies.REQUEST_WINDOW_ID_PREFIX + requestToken + \"=\" + windowId +\n                \"; path=/; maxAge=30; SameSite=Strict\");\n    }\n\n    public static Object getRequestWindowIdCookie(FacesContext context, String requestToken)\n    {\n        Map<String, Object> cookieMap = context.getExternalContext().getRequestCookieMap();\n\n        if (cookieMap.containsKey(Cookies.REQUEST_WINDOW_ID_PREFIX + requestToken))\n        {\n            return cookieMap.get(Cookies.REQUEST_WINDOW_ID_PREFIX + requestToken);\n        }\n\n        return null;\n    }\n\n    public static int getMaxWindowIdLength()\n    {\n        int result = JsfBaseConfig.ScopeCustomization.WindowRestriction.ID_MAX_LENGTH;\n\n        if (result > JsfBaseConfig.ScopeCustomization.WindowRestriction.ID_MAX_LENGTH_DEFAULT)\n        {\n            if (LOG.isLoggable(Level.WARNING))\n            {\n                LOG.warning(\"ATTENTION: if you change this value to be significant longer than 10, \" +\n                    \"you can introduce a security issue in WindowIdHtmlRenderer. \" +\n                    \"If you increase it because window.name contains a value already, \" +\n                    \"please revisit that usage or \" +\n                    \"create shorter unique ids since they just need to be unique within the user-session.\");\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\nimport org.apache.deltaspike.jsf.impl.listener.phase.WindowMetaData;\nimport org.apache.deltaspike.jsf.impl.message.FacesMessageEntry;\n\nimport jakarta.el.ELException;\nimport jakarta.enterprise.context.ContextNotActiveException;\nimport jakarta.faces.FacesException;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.ExternalContext;\nimport jakarta.faces.context.FacesContext;\nimport java.io.UnsupportedEncodingException;\nimport java.lang.reflect.InvocationTargetException;\nimport java.net.URLEncoder;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.CopyOnWriteArrayList;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\nimport org.apache.deltaspike.core.util.StringUtils;\n\npublic abstract class JsfUtils\n{\n    private static final String SB_ADD_PARAMETER = \"SB:\" + JsfUtils.class + \"#addParameter\";\n\n    public static <T> T getValueOfExpression(String expression, Class<T> targetType)\n    {\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n        return facesContext.getApplication().evaluateExpressionGet(facesContext, expression, targetType);\n    }\n\n    public static String getValueOfExpressionAsString(String expression)\n    {\n        Object result = getValueOfExpression(expression, Object.class);\n\n        return result != null ? result.toString() : \"null\";\n    }\n\n    public static Set<RequestParameter> getViewConfigPageParameters()\n    {\n        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();\n\n        Set<RequestParameter> result = new HashSet<>();\n\n        if (externalContext == null || //detection of early config for different mojarra versions\n                externalContext.getRequestParameterValuesMap() == null || externalContext.getRequest() == null)\n        {\n            return result;\n        }\n\n        NavigationParameterContext navigationParameterContext =\n                BeanProvider.getContextualReference(NavigationParameterContext.class);\n\n        for (Map.Entry<String, String> entry : navigationParameterContext.getPageParameters().entrySet())\n        {\n            //TODO add multi-value support\n            result.add(new RequestParameter(entry.getKey(), new String[]{entry.getValue()}));\n        }\n\n        return result;\n    }\n\n    /**\n     * Adds the current page-parameters to the given url\n     *\n     * @param externalContext current external-context\n     * @param url             current url\n     * @param encodeValues    flag which indicates if parameter values should be encoded or not\n     * @return url with request-parameters\n     */\n    public static String addPageParameters(ExternalContext externalContext, String url, boolean encodeValues)\n    {\n        StringBuilder finalUrl = new StringBuilder(url);\n        boolean existingParameters = url.contains(\"?\");\n\n        for (RequestParameter requestParam : getViewConfigPageParameters())\n        {\n            String key = requestParam.getKey();\n\n            for (String parameterValue : requestParam.getValues())\n            {\n                if (!url.contains(key + \"=\" + parameterValue) &&\n                        !url.contains(key + \"=\" + encodeUrlParameterValue(parameterValue, externalContext)))\n                {\n                    if (!existingParameters)\n                    {\n                        finalUrl.append(\"?\");\n                        existingParameters = true;\n                    }\n                    else\n                    {\n                        finalUrl.append(\"&\");\n                    }\n\n                    appendUrlParameter(finalUrl, key, parameterValue, encodeValues, externalContext);\n                }\n            }\n        }\n        return finalUrl.toString();\n    }\n\n    /**\n     * Adds a paramter to the given url.\n     *\n     * @param externalContext   current external-context\n     * @param url               current url\n     * @param encodeValues      flag which indicates if parameter values should be encoded or not\n     * @param name              the paramter name\n     * @param value             the paramter value\n     * @return url with appended parameter\n     */\n    public static String addParameter(ExternalContext externalContext, String url, boolean encodeValues,\n            String name, String value)\n    {\n        // don't append if already available\n        if (url.contains(name + \"=\" + value)\n                || url.contains(name + \"=\" + encodeUrlParameterValue(value, externalContext)))\n        {\n            return url;\n        }\n\n        StringBuilder finalUrl = SharedStringBuilder.get(SB_ADD_PARAMETER);\n        finalUrl.append(url);\n\n        if (url.contains(\"?\"))\n        {\n            finalUrl.append(\"&\");\n        }\n        else\n        {\n            finalUrl.append(\"?\");\n        }\n\n        appendUrlParameter(finalUrl, name, value, encodeValues, externalContext);\n\n        return finalUrl.toString();\n    }\n\n    /**\n     * Adds the current request-parameters to the given url\n     *\n     * @param externalContext current external-context\n     * @param url             current url\n     * @param encodeValues    flag which indicates if parameter values should be encoded or not\n     * @return url with request-parameters\n     */\n    public static String addRequestParameters(ExternalContext externalContext, String url, boolean encodeValues)\n    {\n        if (externalContext.getRequestParameterValuesMap().isEmpty())\n        {\n            return url;\n        }\n\n        StringBuilder finalUrl = new StringBuilder(url);\n        boolean existingParameters = url.contains(\"?\");\n\n        for (Map.Entry<String, String[]> entry : externalContext.getRequestParameterValuesMap().entrySet())\n        {\n            for (String value : entry.getValue())\n            {\n                if (!url.contains(entry.getKey() + \"=\" + value) &&\n                        !url.contains(entry.getKey() + \"=\" + encodeUrlParameterValue(value, externalContext)))\n                {\n                    if (StringUtils.isEmpty(entry.getKey()) && StringUtils.isEmpty(value))\n                    {\n                        continue;\n                    }\n\n                    if (!existingParameters)\n                    {\n                        finalUrl.append(\"?\");\n                        existingParameters = true;\n                    }\n                    else\n                    {\n                        finalUrl.append(\"&\");\n                    }\n\n                    appendUrlParameter(finalUrl, entry.getKey(), value, encodeValues, externalContext);\n                }\n            }\n        }\n\n        return finalUrl.toString();\n    }\n\n    protected static void appendUrlParameter(StringBuilder url, String name, String value, boolean encode,\n            ExternalContext externalContext)\n    {\n        if (encode)\n        {\n            url.append(encodeUrlParameterValue(name, externalContext));\n        }\n        else\n        {\n            url.append(name);\n        }\n\n        url.append(\"=\");\n\n        if (encode)\n        {\n            url.append(encodeUrlParameterValue(value, externalContext));\n        }\n        else\n        {\n            url.append(value);\n        }\n    }\n\n    public static String removeUrlParameter(String url, String name)\n    {\n        if (url == null || !url.contains(name) || (!url.contains(\"?\") && !url.contains(\"&\")))\n        {\n            return url;\n        }\n\n        String[] array = url.split(\"\\\\?\");\n        String params = Arrays.asList(array[1].split(\"&\"))\n                .stream()\n                .filter(item -> !item.split(\"=\")[0].equalsIgnoreCase(name) && !\"\".equals(item.split(\"=\")[1]))\n                .collect(Collectors.joining(\"&\"));\n        if (params == null || params.isBlank())\n        {\n            return array[0];\n        }\n        return String.join(\"?\", array[0], params);\n    }\n\n    /**\n     * Encodes the given value using URLEncoder.encode() with the charset returned\n     * from ExternalContext.getResponseCharacterEncoding().\n     * This is exactly how the ExternalContext impl encodes URL parameter values.\n     *\n     * @param value           value which should be encoded\n     * @param externalContext current external-context\n     * @return encoded value\n     */\n    public static String encodeUrlParameterValue(String value, ExternalContext externalContext)\n    {\n        // copied from MyFaces ServletExternalContextImpl.encodeURL()\n        try\n        {\n            return URLEncoder.encode(value, externalContext.getResponseCharacterEncoding());\n        }\n        catch (UnsupportedEncodingException e)\n        {\n            throw new UnsupportedOperationException(\"Encoding type=\"\n                    + externalContext.getResponseCharacterEncoding() + \" not supported\", e);\n        }\n    }\n\n    public static ViewConfigResolver getViewConfigResolver()\n    {\n        return BeanProvider.getContextualReference(ViewConfigResolver.class);\n    }\n\n    public static void saveFacesMessages(ExternalContext externalContext)\n    {\n        JsfModuleConfig jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class);\n\n        if (!jsfModuleConfig.isAlwaysKeepMessages())\n        {\n            return;\n        }\n\n        try\n        {\n            WindowMetaData windowMetaData = BeanProvider.getContextualReference(WindowMetaData.class);\n\n            Map<String, Object> requestMap = externalContext.getRequestMap();\n\n            @SuppressWarnings({ \"unchecked\" })\n            List<FacesMessageEntry> facesMessageEntryList =\n                    (List<FacesMessageEntry>)requestMap.get(FacesMessageEntry.class.getName());\n\n            if (facesMessageEntryList == null)\n            {\n                facesMessageEntryList = new CopyOnWriteArrayList<FacesMessageEntry>();\n            }\n            windowMetaData.setFacesMessageEntryList(facesMessageEntryList);\n        }\n        catch (ContextNotActiveException e)\n        {\n            //TODO log it in case of project-stage development\n            //we can't handle it correctly -> delegate to the jsf-api (which has some restrictions esp. before v2.2)\n            FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);\n        }\n    }\n\n    public static void tryToRestoreMessages(FacesContext facesContext)\n    {\n        JsfModuleConfig jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class);\n\n        if (!jsfModuleConfig.isAlwaysKeepMessages())\n        {\n            return;\n        }\n\n        try\n        {\n            WindowMetaData windowMetaData = BeanProvider.getContextualReference(WindowMetaData.class);\n\n            @SuppressWarnings({ \"unchecked\" })\n            List<FacesMessageEntry> facesMessageEntryList = windowMetaData.getFacesMessageEntryList();\n            List<FacesMessage> originalMessageList = new ArrayList<>(facesContext.getMessageList());\n\n            if (facesMessageEntryList != null)\n            {\n                for (FacesMessageEntry messageEntry : facesMessageEntryList)\n                {\n                    if (isNewMessage(originalMessageList, messageEntry.getFacesMessage()))\n                    {\n                        facesContext.addMessage(messageEntry.getComponentId(), messageEntry.getFacesMessage());\n                    }\n                }\n                facesMessageEntryList.clear();\n            }\n        }\n        catch (ContextNotActiveException e)\n        {\n            //TODO discuss how we handle it\n        }\n    }\n\n    public static Throwable getRootCause(Throwable throwable)\n    {\n        while ((ELException.class.isInstance(throwable) || FacesException.class.isInstance(throwable) ||\n                InvocationTargetException.class.isInstance(throwable)) && throwable.getCause() != null)\n        {\n            throwable = throwable.getCause();\n        }\n\n        return throwable;\n    }\n\n    public static boolean isNewMessage(List<FacesMessage> facesMessages, FacesMessage messageToCheck)\n    {\n        for (FacesMessage facesMessage : facesMessages)\n        {\n            if ((facesMessage.getSummary() != null && facesMessage.getSummary().equals(messageToCheck.getSummary()) ||\n                    facesMessage.getSummary() == null && messageToCheck.getSummary() == null) &&\n                    (facesMessage.getDetail() != null && facesMessage.getDetail().equals(messageToCheck.getDetail()) ||\n                        facesMessage.getDetail() == null && messageToCheck.getDetail() == null))\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    public static void logWrongModuleUsage(String name)\n    {\n        Logger.getLogger(name).log(\n            Level.WARNING, \"You are using the JSF module for JSF 2.0/2.1 with JSF 2.2+ which \" +\n                \"might cause issues in your application in different areas. Please upgrade \" +\n                    \"org.apache.deltaspike.modules:deltaspike-jsf-module-impl-ee6 to \" +\n                        \"org.apache.deltaspike.modules:deltaspike-jsf-module-impl\");\n    }\n\n    public static void addStaticNavigationParameter(\n        NavigationParameterContext navigationParameterContext, String key, String value)\n    {\n        Map<String, String> existingParameters = navigationParameterContext.getPageParameters();\n\n        String existingValue = existingParameters.get(key);\n\n        if (existingValue != null && value != null) //support null for special cases to reset an entry\n        {\n            return;\n        }\n        navigationParameterContext.addPageParameter(key, value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/RequestParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class RequestParameter\n{\n    private final String key;\n    private final String[] values;\n\n    /**\n     * Constructor for creating a parameter for the given key and values\n     * @param key current key\n     * @param values current values\n     */\n    RequestParameter(String key, String[] values)\n    {\n        this.key = key;\n        this.values = values;\n    }\n\n    /**\n     * Key of the parameter\n     * @return current key\n     */\n    public String getKey()\n    {\n        return key;\n    }\n\n    /**\n     * Exposes the values of the parameter as list\n     * @return values of the parameter\n     */\n    public List<String> getValueList()\n    {\n        return Arrays.asList(this.values);\n    }\n\n    /**\n     * Exposes the values of the parameter as array\n     * @return values of the parameter\n     */\n    public String[] getValues()\n    {\n        return values;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SecurityUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionState;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.security.api.authorization.ErrorViewAwareAccessDeniedException;\nimport org.apache.deltaspike.security.api.authorization.Secured;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\nimport org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;\nimport org.apache.deltaspike.security.spi.authorization.SecurityViolationHandler;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\nimport java.lang.annotation.Annotation;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\n@Vetoed\npublic abstract class SecurityUtils\n{\n    public static void invokeVoters(EditableAccessDecisionVoterContext accessDecisionVoterContext,\n                                    ConfigDescriptor<?> viewConfigDescriptor)\n    {\n        if (viewConfigDescriptor == null)\n        {\n            return;\n        }\n\n        List<Secured> securedMetaData = viewConfigDescriptor.getMetaData(Secured.class);\n\n        if (securedMetaData.isEmpty())\n        {\n            return;\n        }\n\n        accessDecisionVoterContext.addMetaData(ViewConfig.class.getName(), viewConfigDescriptor.getConfigClass());\n        for (Annotation viewMetaData : viewConfigDescriptor.getMetaData())\n        {\n            if (!viewMetaData.annotationType().equals(Secured.class))\n            {\n                accessDecisionVoterContext.addMetaData(viewMetaData.annotationType().getName(), viewMetaData);\n            }\n        }\n\n        Secured.Descriptor securedDescriptor = viewConfigDescriptor\n                .getExecutableCallbackDescriptor(Secured.class, Secured.Descriptor.class);\n\n        AccessDecisionState voterState = AccessDecisionState.VOTE_IN_PROGRESS;\n        try\n        {\n            accessDecisionVoterContext.setState(voterState);\n\n            List<Set<SecurityViolation>> violations = securedDescriptor.execute(accessDecisionVoterContext);\n            Set<SecurityViolation> allViolations = createViolationResult(violations);\n\n            if (!allViolations.isEmpty())\n            {\n                voterState = AccessDecisionState.VIOLATION_FOUND;\n                for (SecurityViolation violation : allViolations)\n                {\n                    accessDecisionVoterContext.addViolation(violation);\n                }\n\n                Class<? extends ViewConfig> errorView = securedMetaData.iterator().next().errorView();\n                throw new ErrorViewAwareAccessDeniedException(allViolations, errorView);\n            }\n        }\n        finally\n        {\n            if (AccessDecisionState.VOTE_IN_PROGRESS.equals(voterState))\n            {\n                voterState = AccessDecisionState.NO_VIOLATION_FOUND;\n            }\n\n            accessDecisionVoterContext.setState(voterState);\n        }\n    }\n\n    private static Set<SecurityViolation> createViolationResult(List<Set<SecurityViolation>> violations)\n    {\n        if (violations == null || violations.isEmpty())\n        {\n            return Collections.emptySet();\n        }\n\n        Set<SecurityViolation> result = new HashSet<SecurityViolation>();\n\n        for (Set<SecurityViolation> securityViolationSet : violations)\n        {\n            result.addAll(securityViolationSet);\n        }\n        return result;\n    }\n\n    /**\n     * Processes a security violation without triggering the navigation to the error page\n     *\n     * @param exception current exception\n     */\n    public static void handleSecurityViolationWithoutNavigation(RuntimeException exception)\n    {\n        tryToHandleSecurityViolation(exception, false);\n    }\n\n    /**\n     * Processes a security violation including the navigation to the error page\n     *\n     * @param exception current exception\n     */\n    public static void tryToHandleSecurityViolation(RuntimeException exception)\n    {\n        tryToHandleSecurityViolation(exception, true);\n    }\n\n    private static void tryToHandleSecurityViolation(RuntimeException runtimeException,\n                                                     boolean allowNavigation)\n    {\n        ErrorViewAwareAccessDeniedException exception = extractException(runtimeException);\n\n        if (exception == null)\n        {\n            throw runtimeException;\n        }\n\n        Class<? extends ViewConfig> errorView = null;\n\n        Class<? extends ViewConfig> inlineErrorView = exception.getErrorView();\n\n        if (inlineErrorView != null && !DefaultErrorView.class.getName().equals(inlineErrorView.getName()))\n        {\n            errorView = inlineErrorView;\n        }\n\n        if (errorView == null)\n        {\n            ViewConfigResolver viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);\n            ViewConfigDescriptor errorPageDescriptor = viewConfigResolver.getDefaultErrorViewConfigDescriptor();\n\n            if (errorPageDescriptor != null)\n            {\n                errorView = errorPageDescriptor.getConfigClass();\n            }\n        }\n\n        if (errorView == null && allowNavigation)\n        {\n            throw exception;\n        }\n\n        processApplicationSecurityException(exception, errorView, allowNavigation);\n    }\n\n    private static ErrorViewAwareAccessDeniedException extractException(Throwable exception)\n    {\n        if (exception == null)\n        {\n            return null;\n        }\n\n        if (exception instanceof ErrorViewAwareAccessDeniedException)\n        {\n            return (ErrorViewAwareAccessDeniedException) exception;\n        }\n\n        return extractException(exception.getCause());\n    }\n\n    private static void processApplicationSecurityException(AccessDeniedException exception,\n                                                            Class<? extends ViewConfig> errorView,\n                                                            boolean allowNavigation)\n    {\n        SecurityViolationHandler securityViolationHandler =\n                BeanProvider.getContextualReference(SecurityViolationHandler.class, true);\n\n        if (securityViolationHandler != null)\n        {\n            //optional (custom handler) - allows to handle custom implementations of SecurityViolation\n            securityViolationHandler.processSecurityViolations(exception.getViolations());\n        }\n        else\n        {\n            addViolationsAsMessage(exception.getViolations());\n        }\n\n        if (allowNavigation)\n        {\n            BeanProvider.getContextualReference(ViewNavigationHandler.class).navigateTo(errorView);\n        }\n    }\n\n    private static void addViolationsAsMessage(Set<SecurityViolation> violations)\n    {\n        String message;\n        for (SecurityViolation violation : violations)\n        {\n            //TODO discuss it (with CODI handling such messages was easier)\n            message = violation.getReason();\n\n            if (!isMessageAddedAlready(message))\n            {\n                FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message);\n                FacesContext.getCurrentInstance().addMessage(null, facesMessage);\n            }\n        }\n    }\n\n    private static boolean isMessageAddedAlready(String message)\n    {\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n\n        if (facesContext == null || message == null)\n        {\n            return false;\n        }\n\n        List<FacesMessage> existingMessages = facesContext.getMessageList();\n\n        if (existingMessages == null)\n        {\n            return false;\n        }\n\n        for (FacesMessage facesMessage : existingMessages)\n        {\n            if (message.equals(facesMessage.getSummary()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SharedStringBuilder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.faces.context.FacesContext;\n\n@Vetoed\npublic abstract class SharedStringBuilder\n{\n    /**\n     * Get a shared {@link StringBuilder} instance.\n     *\n     * @param context The {@link FacesContext}\n     * @param key The unique key per use case.\n     * @return The shared {@link StringBuilder} instance\n     */\n    public static StringBuilder get(FacesContext context, String key)\n    {\n        StringBuilder builder = (StringBuilder) context.getAttributes().get(key);\n\n        if (builder == null)\n        {\n            builder = new StringBuilder();\n            context.getAttributes().put(key, builder);\n        }\n        else\n        {\n            builder.setLength(0);\n        }\n\n        return builder;\n    }\n\n    /**\n     * Get a shared {@link StringBuilder} instance.\n     *\n     * @param key The unique key per use case.\n     * @return The shared {@link StringBuilder} instance\n     */\n    public static StringBuilder get(String key)\n    {\n        return get(FacesContext.getCurrentInstance(), key);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ViewConfigUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\n\nimport java.lang.reflect.Modifier;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic abstract class ViewConfigUtils\n{\n    public static boolean isFolderConfig(Class configClass)\n    {\n        return configClass != null && (\n                (ViewConfig.class.isAssignableFrom(configClass) &&\n                        Modifier.isAbstract(configClass.getModifiers()) ||\n                        Modifier.isInterface(configClass.getModifiers())\n                ) ||\n                configClass.isAnnotationPresent(Folder.class));\n    }\n\n    //TODO\n    public static List<Class> toNodeList(Class nodeClass)\n    {\n        List<Class> treePath = new ArrayList<Class>();\n        while (nodeClass != null)\n        {\n            treePath.add(0, nodeClass);\n            nodeClass = nodeClass.getEnclosingClass();\n        }\n        return treePath;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ViewControllerUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.util;\n\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\nimport org.apache.deltaspike.core.api.config.view.metadata.SimpleCallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\n\nimport java.lang.annotation.Annotation;\n\npublic abstract class ViewControllerUtils\n{\n    public static void executeViewControllerCallback(ViewConfigDescriptor viewDefinitionEntry,\n                                                     Class<? extends Annotation> callbackType)\n    {\n        if (viewDefinitionEntry == null)\n        {\n            return;\n        }\n\n        SimpleCallbackDescriptor initViewCallbackDescriptor = viewDefinitionEntry.getExecutableCallbackDescriptor(\n                ViewControllerRef.class, callbackType, SimpleCallbackDescriptor.class);\n\n        if (initViewCallbackDescriptor != null)\n        {\n            initViewCallbackDescriptor.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/view/DeltaSpikeViewHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.jsf.impl.view;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.jsf.impl.security.SecurityAwareViewHandler;\n\nimport jakarta.faces.application.ViewHandler;\nimport jakarta.faces.application.ViewHandlerWrapper;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.FacesContext;\n\n/**\n * Aggregates all {@link ViewHandler} implementations provided by DeltaSpike\n */\npublic class DeltaSpikeViewHandler extends ViewHandlerWrapper implements Deactivatable\n{\n    protected final ViewHandler wrapped;\n\n    private volatile Boolean initialized;\n    \n    private ViewHandler securityAwareViewHandler;\n\n    /**\n     * Constructor for wrapping the given {@link ViewHandler}\n     *\n     * @param wrapped view-handler which should be wrapped\n     */\n    public DeltaSpikeViewHandler(ViewHandler wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    //allows custom implementations to override the SecurityAwareViewHandler\n    protected ViewHandler createSecurityAwareViewHandler()\n    {\n        return new SecurityAwareViewHandler(this.wrapped);\n    }\n\n    @Override\n    public UIViewRoot createView(FacesContext facesContext, String viewId)\n    {\n        lazyInit();\n        \n        if (this.securityAwareViewHandler == null)\n        {\n            return this.wrapped.createView(facesContext, viewId);\n        }\n        return this.securityAwareViewHandler.createView(facesContext, viewId);\n    }\n\n    @Override\n    public ViewHandler getWrapped()\n    {\n        return this.wrapped;\n    }\n    \n    private void lazyInit()\n    {\n        if (this.initialized == null)\n        {\n            init();\n        }\n    }\n\n    private synchronized void init()\n    {\n        // switch into paranoia mode\n        if (this.initialized == null)\n        {\n            if (ClassDeactivationUtils.isActivated(getClass()))\n            {\n                this.securityAwareViewHandler = createSecurityAwareViewHandler();\n            }\n            else\n            {\n                this.securityAwareViewHandler = null;\n            }\n\n            this.initialized = true;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/META-INF/deltaspike.taglib.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<facelet-taglib xmlns=\"http://java.sun.com/xml/ns/javaee\"\n                xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n                xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd\"\n                version=\"2.0\">\n    <namespace>http://deltaspike.apache.org/jsf</namespace>\n\n    <tag>\n        <tag-name>windowId</tag-name>\n        <component>\n            <component-type>org.apache.deltaspike.WindowIdHolder</component-type>\n            <renderer-type>org.apache.deltaspike.WindowIdHolder</renderer-type>\n        </component>\n    </tag>\n    <tag>\n        <tag-name>preventDoubleSubmit</tag-name>\n        <component>\n            <component-type>org.apache.deltaspike.PostRequestTokenHolder</component-type>\n            <renderer-type>org.apache.deltaspike.PostRequestTokenHolder</renderer-type>\n        </component>\n    </tag>\n</facelet-taglib>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/META-INF/faces-config.xml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n\n    <name>apache_deltaspike</name>\n\n    <lifecycle>\n        <phase-listener>org.apache.deltaspike.jsf.impl.listener.phase.DeltaSpikePhaseListener</phase-listener>\n    </lifecycle>\n\n    <application>\n        <view-handler>org.apache.deltaspike.jsf.impl.view.DeltaSpikeViewHandler</view-handler>\n        <action-listener>org.apache.deltaspike.jsf.impl.listener.action.DeltaSpikeActionListener</action-listener>\n        <resource-handler>org.apache.deltaspike.jsf.impl.resource.DeltaSpikeResourceHandler</resource-handler>\n\n        <system-event-listener>\n            <system-event-listener-class>org.apache.deltaspike.jsf.impl.listener.system.JsfSystemEventBroadcaster</system-event-listener-class>\n            <system-event-class>jakarta.faces.event.ExceptionQueuedEvent</system-event-class>\n        </system-event-listener>\n        <system-event-listener>\n            <system-event-listener-class>org.apache.deltaspike.jsf.impl.listener.system.JsfSystemEventBroadcaster</system-event-listener-class>\n            <system-event-class>jakarta.faces.event.PostConstructApplicationEvent</system-event-class>\n        </system-event-listener>\n        <system-event-listener>\n            <system-event-listener-class>org.apache.deltaspike.jsf.impl.listener.system.JsfSystemEventBroadcaster</system-event-listener-class>\n            <system-event-class>jakarta.faces.event.PreDestroyApplicationEvent</system-event-class>\n        </system-event-listener>\n    </application>\n\n    <factory>\n        <lifecycle-factory>org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleFactoryWrapper</lifecycle-factory>\n        <faces-context-factory>org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeFacesContextFactory</faces-context-factory>\n    </factory>\n\n</faces-config>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nwindow.dswh = window.dswh || {\n\n    DEBUG_MODE : false,\n    TEMP_WINDOW_NAME : 'tempWindowId',\n    MANAGED_WINDOW_NAME_PREFIX : 'ds-',\n\n    initialized: false,\n    windowId : null,\n    clientWindowRenderMode : null,\n    maxWindowIdLength : 10,\n    cfg : null,\n\n    init : function(windowId, clientWindowRenderMode, maxWindowIdLength, cfg) {\n\n        if (dswh.initialized === true)\n        {\n            return;\n        }\n\n        dswh.initialized = true;\n\n        dswh.utils.log('------- DeltaSpike windowhandler.js -------');\n        dswh.utils.log('--- #init(\\'' + windowId + '\\', \\'' + clientWindowRenderMode + '\\',' + maxWindowIdLength + ',' + dswh.utils.stringify(cfg) + ')');\n        dswh.utils.log('window.name: ' + window.name);\n\n        this.windowId = windowId;\n        this.clientWindowRenderMode = clientWindowRenderMode;\n        this.maxWindowIdLength = maxWindowIdLength;\n        if (cfg) {\n            this.cfg = cfg;\n        } else {\n            this.cfg = {};\n        }\n\n        var targetStrategy = this.strategy[clientWindowRenderMode];\n        if (targetStrategy) {\n            dswh.utils.log('--- #validate');\n\n            targetStrategy.validate();\n\n            // early init\n            // this is required if e.g. the onload attr is defined on the body tag and our onload handler won't be called\n            // ATTENTION: the ds:windowId component must be placed as last body tag\n            dswh.utils.log('--- #init(false)');\n            targetStrategy.init(false);\n\n            // JSF ajax callback\n            if (window.faces) {\n                faces.ajax.addOnEvent(function(event) {\n                    if (event.status === \"success\") {\n                        dswh.utils.log('--- #init(true)');\n                        targetStrategy.init(true);\n                    }\n                });\n            }\n\n            // PF ajax callback\n            if (window.$ && window.PrimeFaces) {\n                $(document).on('pfAjaxComplete', function () {\n                    dswh.utils.log('--- #init(true)');\n                    targetStrategy.init(true);\n                });\n            }\n\n            // init via onload\n            // just as fallback if ds:windowId is not placed at last body tag\n            var oldWindowOnLoad = window.onload;\n            window.onload = function(evt) {\n                try {\n                    (oldWindowOnLoad) ? oldWindowOnLoad(evt) : null;\n                } finally {\n                    dswh.utils.log('--- #init(false)');\n                    targetStrategy.init(false);\n                }\n            };\n        }\n    },\n\n    strategy : {\n\n        'CLIENTWINDOW' : {\n\n            validate : function() {\n                this.cleanupCookies();\n                this.assertWindowId();\n            },\n\n            init : function(ajax) {\n                this.overwriteLinkOnClickEvents();\n                this.overwriteButtonOnClickEvents();\n            },\n\n            assertWindowId : function() {\n                dswh.utils.log('--- #assertWindowId');\n\n                // ensure that windowIds get checked even if no windowhandler.html is used\n                if (!dswh.utils.isWindowNameDefined() || !dswh.utils.isManagedWindowName()) {\n                    dswh.utils.log('window name not defined or unmanaged - request new windowId');\n                    dswh.utils.requestNewWindowId();\n                }\n            },\n\n            overwriteLinkOnClickEvents : function() {\n\n                var tokenizedRedirectEnabled = dswh.cfg.tokenizedRedirect;\n                var storeWindowTreeEnabled = dswh.utils.isHtml5() && dswh.cfg.storeWindowTreeOnLinkClick;\n\n                dswh.utils.log('--- #overwriteLinkOnClickEvents');\n                dswh.utils.log('tokenizedRedirect: ' + dswh.cfg.tokenizedRedirect);\n                dswh.utils.log('storeWindowTreeOnLinkClick: ' + dswh.cfg.storeWindowTreeOnLinkClick);\n\n                if (tokenizedRedirectEnabled || storeWindowTreeEnabled) {\n                    var links = document.getElementsByTagName(\"a\");\n                    for (var i = 0; i < links.length; i++) {\n                        var link = links[i];\n\n                        var target = link.getAttribute('target');\n\n                        if (dswh.strategy.CLIENTWINDOW.isHrefDefined(link) === true && (!target || target === '_self')) {\n                            if (!link.onclick) {\n                                link.onclick = function(evt) {\n                                    // IE handling added\n                                    evt = evt || window.event;\n\n                                    // skip open in new tab\n                                    if (!evt.ctrlKey) {\n                                        if (storeWindowTreeEnabled) {\n                                            dswh.strategy.CLIENTWINDOW.storeWindowTree();\n                                        }\n                                        if (tokenizedRedirectEnabled) {\n                                            dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);\n                                            return false;\n                                        }\n\n                                        return true;\n                                    }\n                                };\n                            } else {\n                                // prevent double decoration\n                                if (!(\"\" + link.onclick).match(\".*storeWindowTree().*\")) {\n                                    //the function wrapper is important otherwise the\n                                    //last onclick handler would be assigned to oldonclick\n                                    (function storeEvent() {\n                                        var oldonclick = link.onclick;\n                                        link.onclick = function(evt) {\n                                            // IE handling added\n                                            evt = evt || window.event;\n\n                                            var proceed = oldonclick.bind(this)(evt);\n                                            if (typeof proceed === 'undefined' || proceed === true) {\n\n                                                // skip open in new tab\n                                                if (!evt.ctrlKey) {\n                                                    if (storeWindowTreeEnabled) {\n                                                        dswh.strategy.CLIENTWINDOW.storeWindowTree();\n                                                    }\n\n                                                    if (tokenizedRedirectEnabled) {\n                                                        dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);\n                                                        return false;\n                                                    }\n                                                }\n                                            }\n                                            return proceed;\n                                        };\n                                    })();\n                                }\n                            }\n                        }\n                    }\n                }\n            },\n\n            overwriteButtonOnClickEvents : function() {\n\n                var storeWindowTreeEnabled = dswh.utils.isHtml5() && dswh.cfg.storeWindowTreeOnButtonClick;\n\n                dswh.utils.log('--- #overwriteButtonOnClickEvents');\n                dswh.utils.log('storeWindowTreeOnButtonClick: ' + dswh.cfg.storeWindowTreeOnButtonClick);\n\n                if (storeWindowTreeEnabled) {\n                    var inputs = document.getElementsByTagName(\"input\");\n                    for (var i = 0; i < inputs.length; i++) {\n                        var input = inputs[i];\n                        if (input.getAttribute(\"type\") === \"submit\" || input.getAttribute(\"type\") === \"button\") {\n                            if (!input.onclick) {\n                                input.onclick = function() {\n                                    dswh.strategy.CLIENTWINDOW.storeWindowTree();\n                                    return true;\n                                };\n                            } else {\n                                // prevent double decoration\n                                if (!(\"\" + input.onclick).match(\".*storeWindowTree().*\")) {\n                                    //the function wrapper is important otherwise the\n                                    //last onclick handler would be assigned to oldonclick\n                                    (function storeEvent() {\n                                        var oldonclick = input.onclick;\n                                        input.onclick = function(evt) {\n                                            //ie handling added\n                                            evt = evt || window.event;\n\n                                            dswh.strategy.CLIENTWINDOW.storeWindowTree();\n\n                                            return oldonclick.bind(this)(evt);\n                                        };\n                                    })();\n                                }\n                            }\n                        }\n                    }\n                }\n            },\n\n            isHrefDefined : function(link) {\n\n                var href = link.getAttribute(\"href\");\n\n                if (!href || href === null) {\n                    return false;\n                }\n\n                // trim\n                href = href.replace(/^\\s+|\\s+$/g, '');\n\n                if (href === '') {\n                    return false;\n                }\n\n                if (href.indexOf('#') === 0) {\n                    return false;\n                }\n\n                if (href.lastIndexOf('javascript:', 0) === 0) {\n                    return false;\n                }\n\n                return true;\n            },\n\n            tokenizedRedirect : function(link) {\n\n                dswh.utils.log('--- #tokenizedRedirect');\n\n                var requestToken = dswh.utils.generateNewRequestToken();\n                dswh.utils.storeCookie('dsrwid-' + requestToken, dswh.windowId, 3);\n                window.location = dswh.utils.setUrlParam(link.href, 'dsrid', requestToken);\n            },\n\n            /**\n             * store the current body in the html5 localstorage\n             */\n            storeWindowTree : function() {\n\n                dswh.utils.log('--- #storeWindowTree');\n\n                // first we store all CSS we also need on the intermediate page\n                var headNodes = document.getElementsByTagName(\"head\")[0].childNodes;\n                var oldSS = new Array();\n                var j = 0;\n                for (var i = 0; i < headNodes.length; i++) {\n                    var tagName = headNodes[i].tagName;\n                    if (tagName\n                            && dswh.utils.equalsIgnoreCase(tagName, \"link\")\n                            && dswh.utils.equalsIgnoreCase(headNodes[i].getAttribute(\"type\"), \"text/css\")) {\n\n                        // sort out media=\"print\" and stuff\n                        var media = headNodes[i].getAttribute(\"media\");\n                        if (!media\n                                || dswh.utils.equalsIgnoreCase(media, \"all\")\n                                || dswh.utils.equalsIgnoreCase(media, 'screen')) {\n                            oldSS[j++] = headNodes[i].getAttribute(\"href\");\n                        }\n                    }\n                }\n                localStorage.setItem(window.name + '_css', dswh.utils.stringify(oldSS));\n\n                var body = document.getElementsByTagName(\"body\")[0];\n                localStorage.setItem(window.name + '_body', body.innerHTML);\n\n                var attributes = {};\n                for (var i = 0; i < body.attributes.length; i++) {\n                    var attribute = body.attributes[i];\n                    attributes[attribute.name] = attribute.value;\n                }\n                localStorage.setItem(window.name + '_bodyAttributes', dswh.utils.stringify(attributes));\n\n                var scrollTop = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0);\n                localStorage.setItem(window.name + '_scrollTop', scrollTop);\n\n                var scrollLeft = (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0);\n                localStorage.setItem(window.name + '_scrollLeft', scrollLeft);\n            },\n\n            cleanupCookies : function() {\n                dswh.utils.log('--- #cleanupCookies');\n\n                var dsrid = dswh.utils.getUrlParameter(window.location.href, 'dsrid');\n                if (dsrid) {\n                    dswh.utils.expireCookie('dsrwid-' + dsrid);\n                }\n            }\n        },\n\n        'LAZY' : {\n\n            validate : function() {\n                this.cleanupCookies();\n                this.assertWindowId();\n            },\n\n            init : function(ajax) {\n\n            },\n\n            assertWindowId : function() {\n                var jfwid = dswh.utils.getUrlParameter(window.location.href, 'jfwid');\n\n                dswh.utils.log('--- #assertWindowId');\n                dswh.utils.log('jfwid: ' + jfwid);\n\n                // window name is defined -> existing tab\n                if (dswh.utils.isWindowNameDefined()) {\n\n                    // is the current window name a already managed by DS?\n                    if (dswh.utils.isManagedWindowName()) {\n\n                        var windowId = dswh.utils.getWindowIdFromWindowName();\n\n                        // we triggered the windowId recreation last request\n                        if (windowId === dswh.TEMP_WINDOW_NAME) {\n                            // enabled initial redirect\n                            // -> use the new windowId from the url\n                            if (jfwid) {\n                                dswh.utils.log('assign window name from request parameter');\n\n                                dswh.utils.setWindowIdAsWindowName(jfwid);\n                            }\n                            // disabled initial redirect\n                            // -> use the new windowId from the rendered config as no url param is available\n                            else {\n                                dswh.utils.log('assign window name from server windowId');\n\n                                dswh.utils.setWindowIdAsWindowName(dswh.windowId);\n                            }\n                        }\n                        // security check like on the server side\n                        else if (windowId.length > dswh.maxWindowIdLength) {\n                            dswh.utils.log('window id from window name exeeds maxWindowIdLength - request new windowId');\n\n                            dswh.utils.requestNewWindowId();\n                        }\n                        // window name doesn't match requested windowId\n                        // -> redirect to the same view with current windowId from the window name\n                        else if (windowId !== jfwid) {\n                            dswh.utils.log('reload url with window name');\n\n                            window.location = dswh.utils.setUrlParam(window.location.href, 'jfwid', windowId);\n                        }\n                    }\n                    else {\n                        dswh.utils.log('window name is unmanaged - request new windowId');\n\n                        dswh.utils.requestNewWindowId();\n                    }\n                }\n                // window name is undefined -> \"open in new tab/window\" was used\n                else {\n                    // url param available?\n                    if (jfwid) {\n                        // initial redirect\n                        // -> the windowId is valid - we don't need to a second request\n                        if (dswh.cfg.initialRedirectWindowId && jfwid === dswh.cfg.initialRedirectWindowId) {\n                            dswh.utils.log('assign window name from initialRedirectWindowId');\n\n                            dswh.utils.setWindowIdAsWindowName(dswh.cfg.initialRedirectWindowId);\n                        }\n                        // != initial redirect\n                        // -> request a new windowId to avoid multiple tabs with the same windowId\n                        else {\n                            dswh.utils.log('request new windowId');\n\n                            dswh.utils.requestNewWindowId();\n                        }\n                    }\n                    // as no url parameter is available, the request is a new tab with disabled initial redirect\n                    // -> just use the windowId from the renderer\n                    else if (dswh.windowId) {\n                        dswh.utils.log('assign window name from server windowId');\n\n                        dswh.utils.setWindowIdAsWindowName(dswh.windowId);\n                    }\n                }\n            },\n\n            cleanupCookies : function() {\n                dswh.utils.log('--- #cleanupCookies');\n\n                var jfwid = dswh.utils.getUrlParameter(window.location.href, 'jfwid');\n                if (jfwid) {\n                    dswh.utils.expireCookie('dsrwid-' + jfwid);\n                }\n            }\n        }\n    },\n\n    utils : {\n\n        findRootWindow: function() {\n            var w = window;\n            while(w.frameElement) {\n                var parent = w.parent;\n                if (parent === undefined) {\n                    break;\n                }\n                w = parent;\n            };\n\n            return w;\n        },\n\n        isWindowNameDefined : function() {\n            var w = dswh.utils.findRootWindow();\n            return w.name && w.name.length > 0;\n        },\n\n        isManagedWindowName : function() {\n            var w = dswh.utils.findRootWindow();\n            if (!w.name) {\n                return false;\n            }\n\n            return w.name.indexOf(dswh.MANAGED_WINDOW_NAME_PREFIX) === 0;\n        },\n\n        getWindowIdFromWindowName : function() {\n            return dswh.utils.findRootWindow().name.substring(dswh.MANAGED_WINDOW_NAME_PREFIX.length);\n        },\n\n        setWindowIdAsWindowName : function(windowId) {\n            dswh.utils.findRootWindow().name = dswh.MANAGED_WINDOW_NAME_PREFIX + windowId;\n        },\n\n        requestNewWindowId : function() {\n            // set temp window name to remember the current state\n            dswh.utils.setWindowIdAsWindowName(dswh.TEMP_WINDOW_NAME);\n\n            // we remove the jfwid if available and redirect to the same url again to create a new windowId\n            window.location = dswh.utils.setUrlParam(window.location.href, 'jfwid', null);\n\n            // set temp window name to remember the current state (again - sometimes required for IE!?)\n            dswh.utils.setWindowIdAsWindowName(dswh.TEMP_WINDOW_NAME);\n        },\n\n        isHtml5 : function() {\n            try {\n                return !!localStorage.getItem;\n            } catch(e) {\n                return false;\n            }\n        },\n\n        stringify : function(someArray) {\n            // some browsers don't understand JSON - guess which one ... :(\n            if (JSON) {\n                return JSON.stringify(someArray);\n            }\n            return someArray.join(\"|||\");\n        },\n\n        unstringify : function(serialized) {\n            if (JSON) {\n                return JSON.parse(serialized);\n            }\n\n            return serialized.split(\"|||\");\n        },\n\n        equalsIgnoreCase : function(source, destination) {\n            //either both are not set or null\n            if (!source && !destination) {\n                return true;\n            }\n            //source or dest is set while the other is not\n            if (!source || !destination) return false;\n\n            //in any other case we do a strong string comparison\n            return source.toLowerCase() === destination.toLowerCase();\n        },\n\n        getUrlParameter : function(uri, name) {\n            // create an anchor object with the uri and let the browser parse it\n            var a = document.createElement('a');\n            a.href = uri;\n\n            // check if a query string is available\n            var queryString = a.search;\n            if (queryString && queryString.length > 0) {\n                // create an array of query parameters - substring(1) removes the ? at the beginning of the query\n                var queryParameters = queryString.substring(1).split(\"&\");\n                for (var i = 0; i < queryParameters.length; i++) {\n                    var queryParameter = queryParameters[i].split(\"=\");\n                    if (queryParameter[0] === name) {\n                        return queryParameter.length > 1 ? decodeURIComponent(queryParameter[1]) : \"\";\n                    }\n                }\n            }\n\n            return null;\n        },\n\n        setUrlParam : function(uri, parameterName, parameterValue) {\n            var a = document.createElement('a');\n            a.href = uri;\n\n            // set empty string as value if not defined or empty\n            if (!parameterValue || parameterValue.replace(/^\\s+|\\s+$/g, '').length === 0) {\n                parameterValue = '';\n            }\n\n            // check if value is empty\n            if (parameterValue.length === 0) {\n\n                // both value and query string is empty (or doesn't contain the param), don't touch the url\n                if (a.search.length === 0 || a.search.indexOf(parameterName + \"=\") === -1) {\n                    return a.href;\n                }\n            }\n\n            // query string is empty, just append our new parameter\n            if (a.search.length === 0) {\n                a.search = '?' + encodeURIComponent(parameterName) + \"=\" + encodeURIComponent(parameterValue);\n\n                return a.href;\n            }\n\n            var oldParameters = a.search.substring(1).split('&');\n            var newParameters = [];\n            newParameters.push(parameterName + \"=\" + encodeURIComponent(parameterValue));\n\n            // loop old parameters, remove empty ones and remove the parameter with the same name as the new one\n            for (var i = 0; i < oldParameters.length; i++) {\n                var oldParameterPair = oldParameters[i];\n\n                if (oldParameterPair.length > 0) {\n                    var oldParameterName = oldParameterPair.split('=')[0];\n                    var oldParameterValue = oldParameterPair.split('=')[1];\n\n                    // don't add empty parameters again\n                    if (oldParameterValue && oldParameterValue.replace(/^\\s+|\\s+$/g, '').length > 0) {\n                        // skip the the old parameter if it's the same as the new parameter\n                        if (oldParameterName !== parameterName) {\n                            newParameters.push(oldParameterName + \"=\" + oldParameterValue);\n                        }\n                    }\n                }\n            }\n\n            // join new parameters\n            a.search = '?' + newParameters.join('&');\n\n            return a.href;\n        },\n\n        expireCookie : function(cookieName) {\n            var date = new Date();\n            date.setTime(date.getTime()-(10*24*60*60*1000)); // - 10 day\n            var expires = \";max-age=0;expires=\" + date.toGMTString();\n\n            document.cookie = cookieName + \"=\" + expires + \"; path=/; SameSite=Strict\";\n        },\n\n        generateNewRequestToken : function() {\n            return \"\" + Math.floor(Math.random() * 999);\n        },\n\n        generateNewWindowId : function() {\n            return \"\" + Math.floor((Math.random() * (9999 - 1000)) + 1000);\n        },\n\n        storeCookie : function(name, value, seconds) {\n            var expiresDate = new Date();\n            expiresDate.setTime(expiresDate.getTime() + (seconds * 1000));\n            var expires = \"; expires=\" + expiresDate.toGMTString();\n\n            document.cookie = name + '=' + value + expires + \"; path=/; SameSite=Strict\";\n        },\n\n        log : function(message) {\n            if (dswh.DEBUG_MODE === true) {\n                console.log(message);\n            }\n        }\n    }\n};\n\n// required for IE8\nif (!Function.prototype.bind) {\n    Function.prototype.bind = function (oThis) {\n        if (typeof this !== 'function') {\n            // closest thing possible to the ECMAScript 5\n            // internal IsCallable function\n            throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');\n        }\n\n        var aArgs = Array.prototype.slice.call(arguments, 1),\n                fToBind = this,\n                fNOP = function () {\n                },\n                fBound = function () {\n                    return fToBind.apply(this instanceof fNOP && oThis\n                            ? this\n                            : oThis,\n                            aArgs.concat(Array.prototype.slice.call(arguments)));\n                };\n\n        fNOP.prototype = this.prototype;\n        fBound.prototype = new fNOP();\n\n        return fBound;\n    };\n}"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/META-INF/web-fragment.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<web-fragment version=\"3.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd\">\n\n    <name>deltaspike_jsf_module</name>\n\n    <distributable/>\n\n    <listener>\n        <listener-class>org.apache.deltaspike.jsf.impl.config.view.ViewConfigPathValidator</listener-class>\n    </listener>\n\n    <ordering>\n        <after>\n            <others/>\n        </after>\n    </ordering>\n</web-fragment>"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/main/resources/static/windowhandler.html",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n    <head>\n        <title>Loading...</title>\n        <meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />\n        <script type=\"text/javascript\" src=\"#{resource['deltaspike/windowhandler.js']}\"></script>\n        <style type=\"text/css\">\n            #message {\n                width: 350px;\n                height: 50px;\n                margin: -25px 0 0 -175px;\n                position: absolute;\n                left: 50%;\n                top: 50%;\n                font-family: arial,sans-serif;\n                font-size: 16px;\n                text-align: center;\n            }\n        </style>\n    </head>\n    <body>\n        <div id=\"message\" style=\"\">\n            Your browser does not support JavaScript.<br/>\n            Click <a href=\"$$noscriptUrl$$\">here</a> to continue without JavaScript.\n        </div>\n\n        <script type=\"text/javascript\">\n            //<![CDATA[\n            function addCss(url) {\n                var newSS = document.createElement(\"style\");\n                newSS.setAttribute(\"rel\", \"stylesheet\");\n                newSS.setAttribute(\"type\", \"text/css\");\n                newSS.appendChild(document.createTextNode(\"@import url(\" +url + \");\"));\n                document.getElementsByTagName(\"head\")[0].appendChild(newSS);\n            }\n\n            function loadCss(clean) {\n                // We don't need to restore the old css on initial requests or if < html5\n                if (!dswh.utils.isHtml5() || !window.name) {\n                    return;\n                }\n\n                var oldCss = dswh.utils.unstringify(localStorage.getItem(window.name + '_css'));\n                if (oldCss) {\n                    for (var i = 0; i < oldCss.length; i++) {\n                        addCss(oldCss[i]);\n                    }\n                    if (clean) {\n                        localStorage.removeItem(window.name + '_css');\n                    }\n                }\n            }\n\n            function replaceContent() {\n                if (document.body.textContent) {\n                    document.getElementById('message').textContent = \"Loading...\";\n                } else {\n                    document.getElementById('message').innerText = \"Loading...\";\n                }\n\n                // We don't need to restore the old windowtree on initial requests or if < html5\n                if (!dswh.utils.isHtml5() || !window.name) {\n                    return;\n                }\n\n                loadCss(false);\n\n                var oldBody = localStorage.getItem(window.name + '_body');\n                if (oldBody) {\n                    document.body.innerHTML = oldBody;\n\n                    var attributes = dswh.utils.unstringify(localStorage.getItem(window.name + '_bodyAttributes'));\n                    for (var attributeName in attributes) {\n                        if (attributes.hasOwnProperty(attributeName)) {\n                            document.body.setAttribute(attributeName, attributes[attributeName]);\n                        }\n                    }\n\n                    window.scrollTo(localStorage.getItem(window.name + '_scrollLeft'),\n                                    localStorage.getItem(window.name + '_scrollTop'));\n\n                    localStorage.removeItem(window.name + '_body');\n                    localStorage.removeItem(window.name + '_bodyAttributes');\n                    localStorage.removeItem(window.name + '_scrollTop');\n                    localStorage.removeItem(window.name + '_scrollLeft');\n\n                    // overlay the doc with an un-clickable full-size div\n                    var overlay = document.createElement(\"div\");\n                    overlay.setAttribute(\"style\", \"cursor: wait !important; position:absolute; z-index:1000; background-color:transparent; top:0; left:0; width:100%; height: 100%; background: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);\");\n                    overlay.setAttribute(\"class\", \"fulldiv\");\n                    document.body.appendChild(overlay);\n                }\n            }\n\n            replaceContent();\n\n            window.onload = function() {\n                if (dswh.DEBUG_MODE === true){\n                    if (!confirm('reload?')) {\n                        return true;\n                    }\n                }\n\n                loadCss(true);\n\n                var windowId = dswh.utils.getWindowIdFromWindowName();\n\n                function requestNewWindowId() {\n                    windowId = dswh.utils.generateNewWindowId();\n                    dswh.utils.setWindowIdAsWindowName(windowId);\n                }\n\n                dswh.utils.log('------- DeltaSpike windowhandler.html -------');\n                dswh.utils.log('windowId: ' + windowId);\n                dswh.utils.log('window.name: ' + window.name);\n\n                if (dswh.utils.isWindowNameDefined()) {\n                    if (!dswh.utils.isManagedWindowName()) {\n\n                        dswh.utils.log('window name unmanaged - request new windowId');\n\n                        requestNewWindowId();\n                    }\n                    else {\n                        // occurs with the \"duplicate tab\" feature of chrome\n                        if (windowId === dswh.TEMP_WINDOW_NAME) {\n\n                            dswh.utils.log('window name is temporary - request new windowId');\n\n                            requestNewWindowId();\n                        }\n                    }\n                }\n                // window name is undefined, which means that \"open in new tab/window\" was used\n                else {\n                    var newWindowId = '$$windowIdValue$$';\n\n                    dswh.utils.log('newWindowId ' + newWindowId);\n\n                    if (newWindowId === 'uninitializedWindowId') {\n                        dswh.utils.log('windowId not initialized - request new windowId');\n\n                        requestNewWindowId();\n                    }\n                    else {\n                        dswh.utils.log('assign window name from newWindowId');\n\n                        dswh.utils.setWindowIdAsWindowName(newWindowId); // set the window.name with our windowId\n                        windowId = newWindowId;\n                    }\n                }\n\n                var requestToken = dswh.utils.generateNewRequestToken();\n\n                var redirectUrl = '$$requestUrl$$';\n                redirectUrl = dswh.utils.setUrlParam(redirectUrl, \"dsrid\", requestToken);\n                // we still add the windowId page param to support lazy windowId dropping for some clients\n                redirectUrl = dswh.utils.setUrlParam(redirectUrl, \"jfwid\", windowId);\n\n                dswh.utils.storeCookie('dsrwid-' + requestToken, windowId, 3);\n\n                dswh.utils.log('redirect to ' + redirectUrl);\n\n                window.location.replace(redirectUrl);\n            };\n            //]]>\n        </script>\n    </body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/TestJsfModuleConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config;\n\nimport org.apache.deltaspike.jsf.api.config.JsfModuleConfig;\nimport org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Specializes;\n\n@Specializes\n@ApplicationScoped\npublic class TestJsfModuleConfig extends JsfModuleConfig\n{\n    private static final long serialVersionUID = -7188892423502607762L;\n\n    @Override\n    public ClientWindowConfig.ClientWindowRenderMode getDefaultWindowMode()\n    {\n        return ClientWindowConfig.ClientWindowRenderMode.LAZY;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc001/PageBean001.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\nclass PageBean001\n{\n    private boolean called = false;\n\n    @PreRenderView\n    protected void preRenderViewCallbackMethod()\n    {\n        called = true;\n    }\n\n    public boolean getCalled()\n    {\n        return called;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc001/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\n\n@ViewControllerRef(PageBean001.class)\nclass SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc001/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.reflect.Method;\nimport java.util.List;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithViewControllerCallback()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        //TODO related to the discussion about #getInheritedMetaData (see TODOs in other use-cases)\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testSimpleViewConfigWithViewControllerCallback()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class));\n        Assert.assertEquals(PageBean001.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().keySet().iterator().next());\n        Assert.assertEquals(\"preRenderViewCallbackMethod\", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc001/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc001;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-controller-uc001.war\")\n                .addPackage(PageBean001.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"controller/simplePageConfig.xhtml\", \"/simplePageConfig.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigation() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"simplePageConfig.xhtml\").toString());\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"pageBean001Called\")), \"true\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc002/PageBean002.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.controller.PostRenderView;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Named;\n\n\n@Named(\"pageBean\")\n@RequestScoped\nclass PageBean002\n{\n    private boolean called = false;\n\n    @PostRenderView\n    protected void postRenderViewCallbackMethod()\n    {\n        called = true;\n    }\n\n    public boolean getCalled()\n    {\n        return called;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc002/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\n\n@ViewControllerRef(value = PageBean002.class, name = \"pageBean\" /*TODO*/) //e.g. in case of producers with different @Named(...)\nclass SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc002/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\nimport org.apache.deltaspike.core.api.config.view.controller.PostRenderView;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.reflect.Method;\nimport java.util.List;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithViewControllerCallback()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        //TODO related to the discussion about #getInheritedMetaData (see TODOs in other use-cases)\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testSimpleViewConfigWithViewControllerCallback()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PostRenderView.class));\n        Assert.assertEquals(PageBean002.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PostRenderView.class).getCallbackMethods().keySet().iterator().next());\n        Assert.assertEquals(\"postRenderViewCallbackMethod\", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PostRenderView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc002/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc002;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-controller-uc002.war\")\n                .addPackage(PageBean002.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"controller/simplePageConfig.xhtml\", \"/simplePageConfig.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigation() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"simplePageConfig.xhtml\").toString());\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"pageBean002Called\")), \"true\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc003/PageBean003.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewRef;\nimport org.apache.deltaspike.core.api.config.view.controller.InitView;\nimport org.apache.deltaspike.core.api.config.view.controller.PreViewAction;\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\n@ViewRef(config = SimplePageConfig.class)\nclass PageBean003\n{\n    \n    private boolean called = false;\n\n    @InitView\n    @PreViewAction\n    protected void callbackMethod1()\n    {\n        called = true;\n    }\n\n    @PreRenderView\n    protected void callbackMethod2()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc003/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nclass SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc003/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.api.config.view.controller.*;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.reflect.Method;\nimport java.util.List;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithViewControllerCallback1()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n        this.viewConfigExtension.addIndirectlyInheritedMetaData(PageBean003.class);\n\n        testMetaDataTree();\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithViewControllerCallback2()\n    {\n        this.viewConfigExtension.addIndirectlyInheritedMetaData(PageBean003.class);\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        testMetaDataTree();\n    }\n\n    private void testMetaDataTree()\n    {\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(1, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testSimpleViewConfigWithViewControllerCallback()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n        this.viewConfigExtension.addIndirectlyInheritedMetaData(PageBean003.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class));\n        Assert.assertNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PostRenderView.class));\n\n        Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class).getCallbackMethods().keySet().iterator().next());\n        Assert.assertEquals(\"callbackMethod1\", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());\n\n        Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class).getCallbackMethods().keySet().iterator().next());\n        Assert.assertEquals(\"callbackMethod1\", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());\n\n        Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().keySet().iterator().next());\n        Assert.assertEquals(\"callbackMethod2\", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc003/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc003;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-controller-uc003.war\")\n                .addPackage(PageBean003.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"controller/simplePageConfig.xhtml\", \"/simplePageConfig.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigation() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"simplePageConfig.xhtml\").toString());\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"pageBean003Called\")), \"true\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc004/PageBean004.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean004\n{\n    @PreRenderView\n    protected void preRenderViewCallbackMethod()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc004/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\n\n@ViewControllerRef(PageBean004.class)\n@TestSecured(SimpleTestAccessDecisionVoter.class)\npublic class SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc004/SimpleTestAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc004;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class SimpleTestAccessDecisionVoter implements TestAccessDecisionVoter\n{\n    @Override\n    public Set<String> checkPermission(String param1, String param2)\n    {\n        Set<String> result = new HashSet<String>();\n        result.add(param1);\n        result.add(param2);\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc004/TestAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\n\nimport java.util.Set;\n\npublic interface TestAccessDecisionVoter\n{\n    @DefaultCallback\n    Set<String> checkPermission(String param1, String param2);\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc004/TestSecured.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ExecutableCallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.List;\nimport java.util.Set;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target( TYPE )\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData(preProcessor = TestSecured.AnnotationPreProcessor.class)\npublic @interface TestSecured\n{\n    Class<? extends TestAccessDecisionVoter>[] value();\n\n    class AnnotationPreProcessor implements ConfigPreProcessor<TestSecured>\n    {\n        //for a real implementation see e.g.:\n        //org.apache.deltaspike.security.api.authorization.Secured\n        //org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef\n        @Override\n        public TestSecured beforeAddToConfig(TestSecured metaData, ViewConfigNode viewConfigNode)\n        {\n            List<CallbackDescriptor> descriptors = viewConfigNode.getCallbackDescriptors(TestSecured.class);\n\n            if (descriptors.isEmpty()) //just for testing different constellations - usually not needed!\n            {\n                descriptors.add(new Descriptor(metaData.value(), DefaultCallback.class));\n            }\n            return metaData; //no change needed\n        }\n    }\n\n    //can be used from outside to get a typed result\n    static class Descriptor extends ExecutableCallbackDescriptor<Set<String>>\n    {\n        public Descriptor(Class[] beanClasses, Class<? extends Annotation> callbackMarker)\n        {\n            super(beanClasses, callbackMarker);\n        }\n\n        public List<Set<String>> execute(String param1, String param2)\n        {\n            return super.execute(param1, param2);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc004/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.core.api.config.view.controller.InitView;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.HashSet;\n\n/**\n * Tests for view-configs\n */\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithViewControllerCallback()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(2, node.getMetaData().size());\n\n        Iterator<Annotation> metaDataIterator = node.getMetaData().iterator();\n        List<Class<? extends Annotation>> possibleMetaDataTypes = new ArrayList<Class<? extends Annotation>>();\n        possibleMetaDataTypes.add(ViewControllerRef.class);\n        possibleMetaDataTypes.add(TestSecured.class);\n        Class<? extends Annotation> foundMetaData = metaDataIterator.next().annotationType();\n        possibleMetaDataTypes.remove(foundMetaData);\n        foundMetaData = metaDataIterator.next().annotationType();\n        possibleMetaDataTypes.remove(foundMetaData);\n\n        Assert.assertTrue(possibleMetaDataTypes.isEmpty());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        //TODO related to the discussion about #getInheritedMetaData (see TODOs in other use-cases)\n        Assert.assertEquals(0, node.getCallbackDescriptors().size()); //get added directly before adding the meta-data\n    }\n\n    @Test\n    public void testSimpleViewConfigWithCallbacks()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class));\n    }\n\n    @Test\n    public void testCallbackExecution()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        final SimpleTestAccessDecisionVoter testInstance = new SimpleTestAccessDecisionVoter();\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.class);\n        //add it to avoid in-container test for this simple constellation - usually not needed!\n        node.getCallbackDescriptors().put(TestSecured.class, new ArrayList<CallbackDescriptor>() {{\n            add(new TestSecured.Descriptor(new Class[] {SimpleTestAccessDecisionVoter.class}, DefaultCallback.class) {\n                @Override\n                protected Object getTargetObject(Class targetType)\n                {\n                    return testInstance;\n                }\n            });\n        }});\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class));\n        List<Set<String> /*return type of one callback*/> callbackResult =\n            viewConfigDescriptor.getExecutableCallbackDescriptor(TestSecured.class, TestSecured.Descriptor.class)\n                .execute(\"param1\", \"param2\");\n        Assert.assertNotNull(callbackResult);\n        Assert.assertEquals(1, callbackResult.size());\n        Assert.assertEquals(2, callbackResult.iterator().next().size());\n        Iterator<String> resultIterator = callbackResult.iterator().next().iterator();\n        //the order in the result isn't guaranteed\n        Set<String> expectedValues = new HashSet<String>();\n        expectedValues.add(\"param1\");\n        expectedValues.add(\"param2\");\n\n        while (resultIterator.hasNext())\n        {\n            String currentValue = resultIterator.next();\n            if (!expectedValues.remove(currentValue))\n            {\n                Assert.fail(\"value '\" + currentValue + \"' not found in the result\");\n            }\n        }\n        Assert.assertTrue(expectedValues.isEmpty());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/PageBean005.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean005\n{\n    @PreRenderView\n    protected void preRenderViewCallbackMethod()\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\n\npublic interface Pages extends ViewConfig\n{\n    @SecuredStereotype1\n    interface Secure extends Pages\n    {\n        @SecuredStereotype2\n        @ViewControllerRef(PageBean005.class)\n        class Settings implements Secure\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/SecuredStereotype1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target(TYPE)\n\n@ViewMetaData\n@Stereotype\n\n@TestSecured(SimpleTestAccessDecisionVoter1.class)\npublic @interface SecuredStereotype1\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/SecuredStereotype2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target(TYPE)\n\n@ViewMetaData\n@Stereotype\n\n@TestSecured(SimpleTestAccessDecisionVoter2.class)\npublic @interface SecuredStereotype2\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/SimpleTestAccessDecisionVoter1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class SimpleTestAccessDecisionVoter1 implements TestAccessDecisionVoter\n{\n    @Override\n    public Set<String> checkPermission(String param1, String param2)\n    {\n        Set<String> result = new HashSet<String>();\n        result.add(param1);\n        result.add(param2);\n        result.add(getClass().getName());\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/SimpleTestAccessDecisionVoter2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class SimpleTestAccessDecisionVoter2 implements TestAccessDecisionVoter\n{\n    @Override\n    public Set<String> checkPermission(String param1, String param2)\n    {\n        Set<String> result = new HashSet<String>();\n        result.add(param1);\n        result.add(param2);\n        result.add(getClass().getName());\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/TestAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\n\nimport java.util.Set;\n\npublic interface TestAccessDecisionVoter\n{\n    @DefaultCallback\n    Set<String> checkPermission(String param1, String param2);\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/TestSecured.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\nimport org.apache.deltaspike.core.api.config.view.metadata.ExecutableCallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.List;\nimport java.util.Set;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target( TYPE )\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData(preProcessor = TestSecured.AnnotationPreProcessor.class)\npublic @interface TestSecured\n{\n    Class<? extends TestAccessDecisionVoter>[] value();\n\n    class AnnotationPreProcessor implements ConfigPreProcessor<TestSecured>\n    {\n        //for a real implementation see e.g.:\n        //org.apache.deltaspike.security.api.authorization.Secured\n        //org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef\n        @Override\n        public TestSecured beforeAddToConfig(TestSecured metaData, ViewConfigNode viewConfigNode)\n        {\n            List<CallbackDescriptor> descriptors = viewConfigNode.getCallbackDescriptors(TestSecured.class);\n\n            if (descriptors.isEmpty()) //just for testing different constellations - usually not needed!\n            {\n                descriptors.add(new Descriptor(metaData.value(), DefaultCallback.class));\n            }\n            return metaData; //no change needed\n        }\n    }\n\n    //can be used from outside to get a typed result\n    static class Descriptor extends ExecutableCallbackDescriptor<Set<String>>\n    {\n        public Descriptor(Class[] beanClasses, Class<? extends Annotation> callbackMarker)\n        {\n            super(beanClasses, callbackMarker);\n        }\n\n        public List<Set<String>> execute(String param1, String param2)\n        {\n            return super.execute(param1, param2);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/controller/uc005/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.controller.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.controller.InitView;\nimport org.apache.deltaspike.core.api.config.view.controller.PreRenderView;\nimport org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef;\nimport org.apache.deltaspike.core.api.config.view.metadata.*;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.concurrent.CopyOnWriteArraySet;\n\n/**\n * Tests for view-configs\n */\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataTreeWithStereotypeViewMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.Settings.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Secure.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n\n        Iterator<Annotation> metaDataIterator = node.getMetaData().iterator();\n        List<Class<? extends Annotation>> possibleMetaDataTypes = new ArrayList<Class<? extends Annotation>>();\n        possibleMetaDataTypes.add(SecuredStereotype1.class);\n        Class<? extends Annotation> foundMetaData = metaDataIterator.next().annotationType();\n        possibleMetaDataTypes.remove(foundMetaData);\n\n        Assert.assertTrue(possibleMetaDataTypes.isEmpty());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Secure.Settings.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNotNull(node.getParent().getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(2, node.getMetaData().size());\n\n        metaDataIterator = node.getMetaData().iterator();\n        possibleMetaDataTypes = new ArrayList<Class<? extends Annotation>>();\n        possibleMetaDataTypes.add(ViewControllerRef.class);\n        possibleMetaDataTypes.add(SecuredStereotype2.class);\n        foundMetaData = metaDataIterator.next().annotationType();\n        possibleMetaDataTypes.remove(foundMetaData);\n        foundMetaData = metaDataIterator.next().annotationType();\n        possibleMetaDataTypes.remove(foundMetaData);\n\n        Assert.assertTrue(possibleMetaDataTypes.isEmpty());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testBaseViewConfigWithStereotypeViewMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Secure.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getCallbackDescriptor(TestSecured.class));\n        Assert.assertNotNull(configDescriptor.getCallbackDescriptor(TestSecured.class).getCallbackMethods());\n        Assert.assertFalse(configDescriptor.getCallbackDescriptor(TestSecured.class).getCallbackMethods().isEmpty());\n        Assert.assertNotNull(configDescriptor.getCallbackDescriptor(TestSecured.class).getCallbackMethods().get(SimpleTestAccessDecisionVoter1.class));\n    }\n\n    @Test\n    public void testViewConfigWithStereotypeViewMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.Settings.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Secure.Settings.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class));\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class).getCallbackMethods());\n        Assert.assertFalse(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class).getCallbackMethods().isEmpty());\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class).getCallbackMethods().get(SimpleTestAccessDecisionVoter2.class));\n    }\n\n    @Test\n    public void testCallbackExecutionFolder()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.class);\n\n        final SimpleTestAccessDecisionVoter1 testInstance1 = new SimpleTestAccessDecisionVoter1();\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Secure.class);\n        //add it to avoid in-container test for this simple constellation - usually not needed!\n        node.getCallbackDescriptors().put(TestSecured.class, new ArrayList<CallbackDescriptor>() {{\n            add(new TestSecured.Descriptor(new Class[] {SimpleTestAccessDecisionVoter1.class}, DefaultCallback.class) {\n                @Override\n                protected Object getTargetObject(Class targetType)\n                {\n                    return testInstance1;\n                }\n            });\n        }});\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Secure.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getCallbackDescriptor(TestSecured.class));\n        List<Set<String> /*return type of one callback*/> callbackResult =\n                ((TestSecured.Descriptor)configDescriptor.getExecutableCallbackDescriptor(TestSecured.class, TestSecured.Descriptor.class))\n                        .execute(\"param1\", \"param2\");\n        Assert.assertNotNull(callbackResult);\n        Assert.assertEquals(1, callbackResult.size());\n        Assert.assertEquals(3, callbackResult.iterator().next().size());\n        Iterator<String> resultIterator = callbackResult.iterator().next().iterator();\n\n        //the order in the result isn't guaranteed\n        Set<String> expectedValues = new CopyOnWriteArraySet<String>();\n        expectedValues.add(\"param1\");\n        expectedValues.add(\"param2\");\n        expectedValues.add(SimpleTestAccessDecisionVoter1.class.getName());\n\n        while (resultIterator.hasNext())\n        {\n            String currentValue = resultIterator.next();\n            if (!expectedValues.remove(currentValue))\n            {\n                Assert.fail(\"value '\" + currentValue + \"' not found in the result\");\n            }\n        }\n        Assert.assertTrue(expectedValues.isEmpty());\n    }\n\n    @Test\n    public void testCallbackExecutionPage()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Secure.Settings.class);\n\n        final SimpleTestAccessDecisionVoter2 testInstance2 = new SimpleTestAccessDecisionVoter2();\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Secure.Settings.class);\n        //add it to avoid in-container test for this simple constellation - usually not needed!\n        node.getCallbackDescriptors().put(TestSecured.class, new ArrayList<CallbackDescriptor>() {{\n            add(new TestSecured.Descriptor(new Class[] {SimpleTestAccessDecisionVoter2.class}, DefaultCallback.class) {\n                @Override\n                protected Object getTargetObject(Class targetType)\n                {\n                    return testInstance2;\n                }\n            });\n        }});\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Secure.Settings.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(TestSecured.class));\n        List<Set<String> /*return type of one callback*/> callbackResult =\n            viewConfigDescriptor.getExecutableCallbackDescriptor(TestSecured.class, TestSecured.Descriptor.class)\n                .execute(\"param1\", \"param2\");\n        Assert.assertNotNull(callbackResult);\n        Assert.assertEquals(1, callbackResult.size());\n        Assert.assertEquals(3, callbackResult.iterator().next().size());\n        Iterator<String> resultIterator = callbackResult.iterator().next().iterator();\n\n        //the order in the result isn't guaranteed\n        Set<String> expectedValues = new HashSet<String>();\n        expectedValues.add(\"param1\");\n        expectedValues.add(\"param2\");\n        expectedValues.add(SimpleTestAccessDecisionVoter2.class.getName());\n\n        while (resultIterator.hasNext())\n        {\n            String currentValue = resultIterator.next();\n            if (!expectedValues.remove(currentValue))\n            {\n                Assert.fail(\"value '\" + currentValue + \"' not found in the result\");\n            }\n        }\n        Assert.assertTrue(expectedValues.isEmpty());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc001/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n@TestEntryPoint\nclass SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc001/TestEntryPoint.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ TYPE })\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData\n@interface TestEntryPoint\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc001/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithCustomMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(TestEntryPoint.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testSimpleViewConfigWithCustomMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(2, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(TestEntryPoint.class).size());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc002/CustomMetaData.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Custom meta-data\n */\n\n//don't use @Inherited\n@Target(TYPE)\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData\n@interface CustomMetaData\n{\n    int value1();\n\n    //TODO discuss value aggregation for arrays\n    int[] value2();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc002/PageBean002.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\nclass PageBean002\n{\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return Pages.Index.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc002/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n//TODO add test\n\n@CustomMetaData(value1 = 5, value2 = 10)\ninterface Pages extends ViewConfig\n{\n    //value1 will be overruled and value2 aggregated\n    @CustomMetaData(value1 = 7, value2 = 14)\n    class Index implements Pages\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc003/CustomStaticQuota.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Custom meta-data\n */\n\n//don't use @Inherited\n@Target({TYPE})\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData\n@interface CustomStaticQuota\n{\n    int perDay();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc003/CustomUrlMapping.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Custom meta-data\n */\n\n//don't use @Inherited\n@Target({TYPE})\n@Retention(RUNTIME)\n@Documented\n\n@ViewMetaData\n@interface CustomUrlMapping\n{\n    String value();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc003/PageBean003.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\nclass PageBean003\n{\n    public Class<? extends ViewConfig> item()\n    {\n        return Pages.Public.Item.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc003/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n//TODO add tests\n\n@CustomStaticQuota(perDay = 10000) //only gets picked up via meta-data-inheritance\ninterface Pages\n{\n    interface Public extends ViewConfig, ViewQuota.PDF, ViewQuota.XML, ZIP\n    {\n        @CustomUrlMapping(\"/item/#{item}/\")\n        class Item implements Public\n        {\n        }\n    }\n\n    //folder - because it's of type ViewConfig\n    interface Private extends ViewConfig\n    {\n    }\n\n    //TODO discuss inheritance approach - currently meta-data from 'Pages' wouldn't get picked up\n    interface ViewQuota //technically not(!) needed (see ZIP) - just for better grouping\n    {\n        //TODO @Matches(pattern = \"*.xml\")\n        interface XML\n        {\n        }\n\n        //TODO @Matches(pattern = \"*.pdf\")\n        @CustomStaticQuota(perDay = 100) //overrule quota\n        interface PDF\n        {\n        }\n    }\n\n    //TODO discuss inheritance approach - currently meta-data from 'Pages' wouldn't get picked up\n    //TODO @Matches(pattern = \"*.zip\")\n    interface ZIP\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc004/PageBean004.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\nclass PageBean004\n{\n    public Class<? extends ViewConfig> item()\n    {\n        return Pages.Public.Index.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc004/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\n//TODO add tests\n\ninterface Pages\n{\n    @TestFacesRedirect\n    interface Public extends ViewConfig\n    {\n        class Index implements Public\n        {\n        }\n    }\n\n    @TestFacesRedirect\n    @View(viewParams = INCLUDE)\n    class Home implements ViewConfig\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc004/TestFacesRedirect.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc004;\n\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\n\n/**\n * Custom meta-data\n */\n\n//don't use @Inherited\n@Target({TYPE})\n@Retention(RUNTIME)\n@Documented\n\n@Stereotype\n@View(navigation = REDIRECT)\n@interface TestFacesRedirect\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc005/InvalidPageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigRoot;\n\n@ViewConfigRoot(configDescriptorValidators = TestInvalidConfigDescriptorValidator.class)\nclass InvalidPageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc005/TestInvalidConfigDescriptorValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.spi.config.view.ConfigDescriptorValidator;\n\npublic class TestInvalidConfigDescriptorValidator implements ConfigDescriptorValidator\n{\n    static boolean called;\n\n    @Override\n    public boolean isValid(ConfigDescriptor configDescriptor)\n    {\n        called = true;\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc005/TestValidConfigDescriptorValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.spi.config.view.ConfigDescriptorValidator;\n\npublic class TestValidConfigDescriptorValidator implements ConfigDescriptorValidator\n{\n    static boolean called;\n\n    @Override\n    public boolean isValid(ConfigDescriptor configDescriptor)\n    {\n        called = true;\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc005/ValidPageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigRoot;\n\n@ViewConfigRoot(configDescriptorValidators = TestValidConfigDescriptorValidator.class)\nclass ValidPageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc005/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc005;\n\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testCustomConfigDescriptorValidatorInvalid()\n    {\n        this.viewConfigExtension.addPageDefinition(InvalidPageConfig.class);\n\n        try\n        {\n            this.viewConfigResolverProducer.createViewConfigResolver();\n        }\n        catch (IllegalStateException e)\n        {\n            Assert.assertTrue(TestInvalidConfigDescriptorValidator.called);\n            Assert.assertTrue(e.getMessage().contains(InvalidPageConfig.class.getName()));\n            return;\n        }\n        Assert.fail();\n    }\n\n    @Test\n    public void testCustomConfigDescriptorValidatorValid()\n    {\n        this.viewConfigExtension.addPageDefinition(ValidPageConfig.class);\n\n        this.viewConfigResolverProducer.createViewConfigResolver();\n        Assert.assertTrue(TestValidConfigDescriptorValidator.called);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc006/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc006;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\ninterface Pages\n{\n    interface Public extends ViewConfig\n    {\n        @View(viewParams = INCLUDE)\n        class Index implements Public\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc006/TestConfigPreProcessor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc006;\n\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.api.literal.ViewLiteral;\n\npublic class TestConfigPreProcessor implements ConfigPreProcessor<View>\n{\n    @Override\n    public View beforeAddToConfig(View metaData, ViewConfigNode viewConfigNode)\n    {\n        return new ViewLiteral(\"/test/\", \"view\", \"custom\", View.NavigationMode.DEFAULT, View.ViewParameterMode.DEFAULT,\n            View.DefaultBasePathBuilder.class, View.DefaultFileNameBuilder.class, View.DefaultExtensionBuilder.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc006/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc006;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.*;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Map;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    private static boolean active;\n\n    @BeforeClass\n    public static void init()\n    {\n        active = true;\n\n        ConfigResolver.addConfigSources(new ArrayList<ConfigSource>() {\n            {\n                add(new ConfigSource()\n                {\n                    @Override\n                    public int getOrdinal()\n                    {\n                        return Integer.MAX_VALUE;\n                    }\n\n                    @Override\n                    public Map<String, String> getProperties()\n                    {\n                        return Collections.emptyMap();\n                    }\n\n                    @Override\n                    public String getPropertyValue(String key)\n                    {\n                        if (active && View.ViewConfigPreProcessor.class.getName().equals(key))\n                        {\n                            return TestConfigPreProcessor.class.getName();\n                        }\n                        return null;\n                    }\n\n                    @Override\n                    public String getConfigName()\n                    {\n                        return \"test-view-config\";\n                    }\n\n                    @Override\n                    public boolean isScannable()\n                    {\n                        return false;\n                    }\n                });\n            }\n\n            private static final long serialVersionUID = 3247551986947387154L;\n        });\n    }\n\n    @AfterClass\n    public static void cleanup()\n    {\n        active = false;\n    }\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataTreeCustomViewConfigPreProcessor()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Public.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNotNull(node.getParent().getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View)node.getMetaData().iterator().next()).viewParams());\n    }\n\n    @Test\n    public void testViewConfigCustomViewConfigPreProcessor()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);\n\n        //changed by TestConfigPreProcessor\n        Assert.assertEquals(\"/test/view.custom\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc007;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigRoot;\nimport org.apache.deltaspike.jsf.impl.config.view.DefaultViewConfigInheritanceStrategy;\n\n\n//just for testing root-node replacement in combination with a view-config\n@ViewConfigRoot(viewConfigInheritanceStrategy = DefaultViewConfigInheritanceStrategy.class)\ninterface Pages extends ViewConfig\n{\n    class Index implements Pages\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc007;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataTreeWithRandomOrder()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.class); //simulates random processing-order\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n    }\n\n    @Test\n    public void testViewConfigWithRandomOrder()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.class); //simulates random processing-order\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertEquals(\"/pages/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc008/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc008;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\ninterface Pages extends ViewConfig\n{\n    class Index implements Pages\n    {\n    }\n\n    @TestMenuEntry(pos = 1)\n    interface Section1 extends Pages\n    {\n        @TestMenuEntry(pos = 1)\n        class Content1 implements Section1\n        {\n        }\n\n        @TestMenuEntry(pos =2)\n        class Content2 implements Section1\n        {\n        }\n    }\n\n    @TestMenuEntry(pos = 2)\n    interface Section2 extends Pages\n    {\n        @TestMenuEntry(pos = 1)\n        class Content1 implements Section2\n        {\n        }\n\n        @TestMenuEntry(pos =2)\n        class Content2 implements Section2\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc008/TestMenuEntry.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc008;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@ViewMetaData\n\n@Target(TYPE)\n@Retention(RUNTIME)\npublic @interface TestMenuEntry\n{\n    int pos();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc008/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.custom.uc008;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataTree()\n    {\n        List<Class<? extends ViewConfig>> menuViewConfigClasses = new ArrayList<>();\n        menuViewConfigClasses.add(Pages.Section1.Content1.class);\n        menuViewConfigClasses.add(Pages.Section1.Content2.class);\n        menuViewConfigClasses.add(Pages.Section2.Content1.class);\n        menuViewConfigClasses.add(Pages.Section2.Content2.class);\n\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n\n        for (Class<? extends ViewConfig> menuViewConfigClass : menuViewConfigClasses)\n        {\n            this.viewConfigExtension.addPageDefinition(menuViewConfigClass);\n        }\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        for (Class<? extends ViewConfig> menuViewConfigClass : menuViewConfigClasses)\n        {\n            node = this.viewConfigExtension.findNode(menuViewConfigClass);\n\n            Assert.assertNotNull(node.getMetaData());\n            Assert.assertEquals(1, node.getMetaData().size());\n            Assert.assertEquals(TestMenuEntry.class, node.getMetaData().iterator().next().annotationType());\n        }\n    }\n\n    @Test\n    public void testViewConfig()\n    {\n        List<Class<? extends ViewConfig>> menuViewConfigClasses = new ArrayList<>();\n        menuViewConfigClasses.add(Pages.Section1.Content1.class);\n        menuViewConfigClasses.add(Pages.Section1.Content2.class);\n        menuViewConfigClasses.add(Pages.Section2.Content1.class);\n        menuViewConfigClasses.add(Pages.Section2.Content2.class);\n\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n\n        for (Class<? extends ViewConfig> menuViewConfigClass : menuViewConfigClasses)\n        {\n            this.viewConfigExtension.addPageDefinition(menuViewConfigClass);\n        }\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertTrue(viewConfigDescriptor.getMetaData(TestMenuEntry.class).isEmpty());\n\n        for (Class<? extends ViewConfig> menuViewConfigClass : menuViewConfigClasses)\n        {\n            viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(menuViewConfigClass);\n\n            Assert.assertEquals(1, viewConfigDescriptor.getMetaData(TestMenuEntry.class).size());\n            Assert.assertTrue(viewConfigDescriptor.getMetaData(TestMenuEntry.class).iterator().next().pos() > 0);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/folder/uc001/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.folder.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\n\ninterface Pages\n{\n    //folder (-only) meta-data would be here or at an interface\n    interface AdminArea extends ViewConfig\n    {\n        //empty (intentionally)\n    }\n\n    @Folder\n    interface VipArea\n    {\n        //empty (intentionally)\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/folder/uc001/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.folder.uc001;\n\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testFolderOnlyMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.AdminArea.class);\n        this.viewConfigExtension.addFolderDefinition(Pages.VipArea.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.AdminArea.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.VipArea.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(Folder.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/PageBean001.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean001\n{\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return Pages.Index.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n//nesting only leads to the final path - in this case /pages/index.xhtml\ninterface Pages\n{\n    class Index implements ViewConfig\n    {\n    }\n    \n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc001;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-destination-uc001.war\")\n                .addPackage(Pages.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/pages/index.xhtml\", \"/pages/index.xhtml\")\n                .addAsWebResource(\"navigation/pages/home.xhtml\", \"/pages/home.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionMethod() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb001ActionMethod\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"indexPage\")),\n                \"You arrived at index page\").apply(driver));\n    }\n    \n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/PageBean002.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean002\n{\n    public Class<? extends ViewConfig> actionWithoutError()\n    {\n        return Pages.Overview.class;\n    }\n\n    public Class<? extends Pages> restrictedToPages()\n    {\n        return Pages.Home.class;\n    }\n\n    //navigates to /pages/customErrorPage.xhtml\n    public Class<? extends ViewConfig> actionWithError()\n    {\n        return DefaultErrorView.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.FORWARD;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\n@View(navigation = REDIRECT)\ninterface Pages extends ViewConfig\n{\n    class Index implements Pages\n    {\n    }\n\n    @View(viewParams = INCLUDE)\n    class Overview implements Pages\n    {\n    }\n\n    //'navigation' overruled\n    @View(navigation = FORWARD)\n    class Home implements Pages\n    {\n    }\n\n    class CustomErrorPage extends DefaultErrorView\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-destination-uc002.war\")\n                .addPackage(Pages.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/pages/index.xhtml\", \"/pages/index.xhtml\")\n                .addAsWebResource(\"navigation/pages/home.xhtml\", \"/pages/home.xhtml\")\n                .addAsWebResource(\"navigation/pages/overview.xhtml\", \"/pages/overview.xhtml\")\n                .addAsWebResource(\"navigation/pages/customErrorPage.xhtml\", \"/pages/customErrorPage.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionWithoutError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb002ActionWithoutError\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"overviewPage\")),\n                \"You arrived at overview page\").apply(driver));\n        // Was redirected ?\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"overview.xhtml\"));\n    }\n    \n    @Test\n    @RunAsClient\n    public void testNavigationActionWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb002ActionWithError\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"customErrorPage\")),\n                \"This is a custom error page\").apply(driver));\n    }\n\n\n    @Test\n    @RunAsClient\n    public void testNavigationRestrictedToPages() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb002RestrictedToPages\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"homePage\")), \"You arrived at home page\")\n                .apply(driver));\n        // Was fowarded ?\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"origin.xhtml\"));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc003/PageBean003.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003;\n\nimport jakarta.enterprise.inject.Model;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n@Model\npublic class PageBean003\n{\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return Pages.Index.class;\n    }\n\n    public Class<? extends ViewConfig> actionMethod2()\n    {\n        return Pages.Overview.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc003/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\ninterface Pages extends ViewConfig\n{\n    class Index implements Pages\n    {\n    }\n\n    @View(name = \"home\")\n    class Overview implements Pages\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc003/PagesViolation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\ninterface PagesViolation extends ViewConfig\n{\n    class Index implements PagesViolation\n    {\n    }\n\n    @View(name = \"index\")\n    class Overview implements PagesViolation\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc003/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003;\n\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testDuplicatedNavigationTargetsInMetaDataTree()\n    {\n        this.viewConfigExtension.addPageDefinition(PagesViolation.Index.class);\n        this.viewConfigExtension.addPageDefinition(PagesViolation.Overview.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(PagesViolation.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(PagesViolation.Overview.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testDuplicatedNavigationTargetsDuringPageMetaDataTransformation()\n    {\n        this.viewConfigExtension.addPageDefinition(PagesViolation.Index.class);\n        this.viewConfigExtension.addPageDefinition(PagesViolation.Overview.class);\n\n        this.viewConfigResolverProducer.createViewConfigResolver();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc003/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-destination-uc003.war\")\n                .addClass(Pages.class)\n                .addClass(ViewConfigTestDrone.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/pages/index.xhtml\", \"/pages/index.xhtml\")\n                .addAsWebResource(\"navigation/pages/home.xhtml\", \"/pages/home.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionMethod() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb003ActionMethod\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"indexPage\")),\n                \"You arrived at index page\").apply(driver));\n    }\n    \n    @Test\n    @RunAsClient\n    public void testNavigationActionMethod2() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb003ActionMethod2\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"homePage\")),\n                \"You arrived at home page\").apply(driver));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc004/PageBean004.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc004;\n\nimport jakarta.enterprise.inject.Model;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n@Model\npublic class PageBean004\n{\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return Pages.Index.class;\n    }\n\n    public Class<? extends ViewConfig> actionMethod2()\n    {\n        return Pages.Overview.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc004/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\n\ninterface Pages\n{\n    class Index extends DefaultErrorView\n    {\n    }\n\n    class Overview extends DefaultErrorView\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc004/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testDuplicatedDefaultErrorViewInMetaDataTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Overview.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Overview.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testDuplicatedDefaultErrorViewDuringPageMetaDataTransformation()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Overview.class);\n\n        this.viewConfigResolverProducer.createViewConfigResolver();\n    }\n\n    @Test\n    public void testDefaultErrorViewInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        Assert.assertNotNull(viewConfigResolver.getDefaultErrorViewConfigDescriptor());\n        Assert.assertEquals(Pages.Index.class, viewConfigResolver.getDefaultErrorViewConfigDescriptor().getConfigClass());\n        Assert.assertEquals(Pages.Index.class, viewConfigResolver.getViewConfigDescriptor(DefaultErrorView.class).getConfigClass());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc004/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc004;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-destination-uc004.war\")\n                .addPackage(Pages.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/pages/index.xhtml\", \"/pages/index.xhtml\")\n                .addAsWebResource(\"navigation/pages/overview.xhtml\", \"/pages/overview.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionMethod() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb004ActionMethod\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"indexPage\")),\n                \"You arrived at index page\").apply(driver));\n    }\n    \n    @Test\n    @RunAsClient\n    public void testNavigationActionMethod2() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb004ActionMethod2\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"overviewPage\")),\n                \"You arrived at overview page\").apply(driver));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc005/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\ninterface Pages\n{\n    interface Wizard1\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./\")\n        class Step3 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w1/\")\n        class Step4 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/w1/\")\n        class Step5 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./w1b/\")\n        class Step6 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w1b\")\n        class Step7 implements ViewConfig\n        {\n        }\n    }\n\n    @View(basePath = \"w2\") //gets ignored because @Folder should be used instead\n    interface Wizard2\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./\")\n        class Step3 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w2/\")\n        class Step4 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/w2/\")\n        class Step5 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./w2b/\")\n        class Step6 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w2b\")\n        class Step7 implements ViewConfig\n        {\n        }\n    }\n\n    @View(basePath = \"/w3\") //gets ignored because @Folder should be used instead\n    interface Wizard3\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n    }\n\n    @View(basePath = \"./w4b\") //gets ignored because @Folder should be used instead\n    interface Wizard4\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n    }\n\n    @View(basePath = \"w5/\") //gets ignored because @Folder should be used instead\n    interface Wizard5\n    {\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n\n    @View(basePath = \"/w6/\") //gets ignored because @Folder should be used instead\n    interface Wizard6\n    {\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n\n    @View(basePath = \"./w7b/\") //gets ignored because @Folder should be used instead\n    interface Wizard7\n    {\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"w8/\")\n    interface Wizard8\n    {\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"/w9/\")\n    interface Wizard9\n    {\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"./w10a/\")\n    interface Wizard10\n    {\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"w11/\")\n    interface Wizard11\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./\")\n        class Step3 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w11b/\")\n        class Step4 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/w11b/\")\n        class Step5 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./w11b/\")\n        class Step6 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w11b\")\n        class Step7 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"/w12/\")\n    interface Wizard12\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./\")\n        class Step3 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w12b/\")\n        class Step4 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/w12b/\")\n        class Step5 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./w12b/\")\n        class Step6 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w12b\")\n        class Step7 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"./w13a/\")\n    interface Wizard13\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./\")\n        class Step3 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w13b/\")\n        class Step4 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"/w13b/\")\n        class Step5 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"./w13b/\")\n        class Step6 implements ViewConfig\n        {\n        }\n\n        @View(basePath = \"w13b\")\n        class Step7 implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"./\")\n    interface Wizard14\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc005/ViewConfigPathTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc005;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Map;\n\npublic class ViewConfigPathTest\n{\n    private static boolean active;\n\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @BeforeClass\n    public static void init()\n    {\n        active = true;\n\n        ConfigResolver.addConfigSources(new ArrayList<ConfigSource>() {\n            {\n                add(new ConfigSource() {\n                    @Override\n                    public int getOrdinal() {\n                        return Integer.MAX_VALUE;\n                    }\n\n                    @Override\n                    public Map<String, String> getProperties() {\n                        return Collections.emptyMap();\n                    }\n\n                    @Override\n                    public String getPropertyValue(String key) {\n                        if (active && View.ViewConfigPreProcessor.class.getName().equals(key)) {\n                            return ViewConfigPreProcessorWithoutValidation.class.getName();\n                        }\n                        return null;\n                    }\n\n                    @Override\n                    public String getConfigName() {\n                        return \"test-view-config\";\n                    }\n\n                    @Override\n                    public boolean isScannable() {\n                        return false;\n                    }\n                });\n            }\n\n            private static final long serialVersionUID = 3247551986947387154L;\n        });\n    }\n\n    @AfterClass\n    public static void cleanup()\n    {\n        active = false;\n    }\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testNamesWizard1()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step2.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step3.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step4.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step5.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step6.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step7.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard1/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step3.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard1/step3.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step4.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard1/w1/step4.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step5.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w1/step5.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step6.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard1/w1b/step6.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step7.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard1/w1b/step7.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard2()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step2.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step3.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step4.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step5.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step6.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard2.Step7.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard2/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step3.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard2/step3.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step4.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard2/w2/step4.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step5.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w2/step5.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step6.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard2/w2b/step6.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard2.Step7.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard2/w2b/step7.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard3()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard3.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard3.Step2.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard3.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard3/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard3.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard4()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard4.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard4.Step2.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard4.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard4/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard4.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard5()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard5.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard5.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard5/step1.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard6()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard6.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard6.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard6/step1.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard7()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard7.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard7.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/wizard7/step1.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard8()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard8.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard8.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w8/step1.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard9()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard9.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard9.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w9/step1.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard10()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard10.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard10.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w10a/step1.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard11()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step2.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step3.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step4.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step5.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step6.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard11.Step7.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w11/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step3.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w11/step3.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step4.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w11/w11b/step4.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step5.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w11b/step5.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step6.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w11/w11b/step6.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard11.Step7.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w11/w11b/step7.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard12()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step2.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step3.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step4.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step5.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step6.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step7.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w12/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step3.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w12/step3.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step4.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w12/w12b/step4.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step5.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w12b/step5.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step6.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w12/w12b/step6.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step7.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w12/w12b/step7.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test\n    public void testNamesWizard13()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step1.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step2.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step3.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step4.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step5.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step6.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step7.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        ViewConfigDescriptor viewConfigDescriptor;\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step1.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w13a/step1.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step2.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/step2.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step3.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w13a/step3.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step4.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w13a/w13b/step4.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step5.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/w13b/step5.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step6.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w13a/w13b/step6.xhtml\", viewConfigDescriptor.getViewId());\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step7.class);\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/w13a/w13b/step7.xhtml\", viewConfigDescriptor.getViewId());\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testNamesWizard14()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Wizard14.Step1.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        viewConfigResolver.getViewConfigDescriptor(Pages.Wizard14.Step1.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc005/ViewConfigPreProcessorWithoutValidation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc005;\n\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\npublic class ViewConfigPreProcessorWithoutValidation extends View.ViewConfigPreProcessor\n{\n    @Override\n    protected void validateViewMetaData(View view, ViewConfigNode viewConfigNode)\n    {\n        //do nothing to check intentionally ignored basePath usages at folder-nodes\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc006/PageBean006.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc006;\n\nimport jakarta.enterprise.inject.Model;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\n@Model\npublic class PageBean006\n{\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return Pages.Wizard1.Step1.class;\n    }\n\n   \n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc006/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc006;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\ninterface Pages\n{\n    @Folder(name = \"wizard1\") //valid usage\n    interface Wizard1\n    {\n        @View(basePath = \"\")\n        class Step1 implements ViewConfig\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc006/PagesViolation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc006;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\ninterface PagesViolation\n{\n    @View(basePath = \"w1\") //causes a violation because @Folder should be used instead\n    interface Wizard1\n    {\n        @View(basePath = \"\")\n        class Start implements ViewConfig\n        {\n        }\n    }\n\n    @Folder(name = \"w2\") //valid usage\n    interface Wizard2\n    {\n        @View(basePath = \"\")\n        class Start implements ViewConfig\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc006/ViewConfigBasePathValidationTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc006;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigBasePathValidationTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testInvalidBasePathUsage()\n    {\n        this.viewConfigExtension.addPageDefinition(PagesViolation.Wizard1.Start.class);\n\n        try\n        {\n            this.viewConfigResolverProducer.createViewConfigResolver();\n        }\n        catch (IllegalStateException e)\n        {\n            if (!(e.getMessage().contains(View.class.getName()) &&\n                e.getMessage().contains(Folder.class.getName())&&\n                e.getMessage().contains(\"#basePath\")))\n            {\n                Assert.fail(\"unexpected violation message found\");\n            }\n            return;\n        }\n        Assert.fail(\"violation not found\");\n    }\n\n    @Test\n    public void testValidBasePathUsage()\n    {\n        this.viewConfigExtension.addPageDefinition(PagesViolation.Wizard2.Start.class);\n        Assert.assertNotNull(this.viewConfigResolverProducer.createViewConfigResolver()); //won't cause an exception\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc006/ViewConfigTestDrone.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc006;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewConfigTestDrone\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"nav-destination-uc006.war\")\n                .addClass(Pages.class)\n                .addClass(ViewConfigTestDrone.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/wizard1/step1.xhtml\", \"/wizard1/step1.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionMethod() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"destination:pb006ActionMethod\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"step1\")),\n                \"You arrived at step1 page\").apply(driver));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PageBean002.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.Model;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.event.PreViewConfigNavigateEvent;\nimport org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001.Pages.CustomErrorPage;\n\n@Model\npublic class PageBean002\n{\n    public Class<? extends ViewConfig> actionWithoutError()\n    {\n        return Pages.Overview.class;\n    }\n\n    public Class<? extends ViewConfig> actionWithError()\n    {\n        return DefaultErrorView.class;\n    }\n\n    protected void onNavigation(@Observes PreViewConfigNavigateEvent navigateEvent)\n    {\n        //change the target dynamically instead of a static config of the DefaultErrorView\n        if (navigateEvent.getToView().equals(CustomErrorPage.class))\n        {\n            navigateEvent.navigateTo(Pages.Index.class);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.FORWARD;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\n@View(navigation = REDIRECT)\npublic interface Pages extends ViewConfig\n{\n    class Index implements Pages\n    {\n    }\n\n    @View(viewParams = INCLUDE)\n    class Overview implements Pages\n    {\n    }\n\n    //'navigation' overruled\n    @View(navigation = FORWARD)\n    class Home implements Pages\n    {\n    }\n\n    class CustomErrorPage extends DefaultErrorView\n    {\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PreViewConfigNavigateEventTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class PreViewConfigNavigateEventTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"nav-event-uc001.war\")\n                .addPackage(Pages.class.getPackage())\n                .addClass(PageBean002.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/pages/index.xhtml\", \"/pages/index.xhtml\")\n                .addAsWebResource(\"navigation/pages/home.xhtml\", \"/pages/home.xhtml\")\n                .addAsWebResource(\"navigation/pages/overview.xhtml\", \"/pages/overview.xhtml\")\n                .addAsWebResource(\"navigation/pages/customErrorPage.xhtml\", \"/pages/customErrorPage.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n        return archive;\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"event:pb002ActionWithError\"));\n        Assert.assertNotNull(button);\n        button.click();\n        // Index Page is shown instead of DefaultErrorView because PreViewConfigNavigateEvent changed the navigation\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"indexPage\")), \"You arrived at index page\")\n                .apply(driver));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/shared/TestClassDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.shared;\n\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigPathValidator;\n\npublic class TestClassDeactivator implements ClassDeactivator\n{\n    private static final long serialVersionUID = -3403907272881821406L;\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        if (targetClass.equals(ViewConfigPathValidator.class))\n        {\n            return Boolean.FALSE;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc001/NoNavigationParameterWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc001;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.test.category.DeltaSpikeTest;\nimport org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.shared.TestClassDeactivator;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.apache.deltaspike.test.jsf.impl.util.FileUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport java.net.URL;\n\n\n@RunWith(Arquillian.class)\npublic class NoNavigationParameterWarFileTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = NoNavigationParameterWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        URL fileUrl = NoNavigationParameterWarFileTest.class.getClassLoader()\n                .getResource(\"navigationParameterTest/apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addClass(TestClassDeactivator.class)\n                .addPackage(NoNavigationParameterWarFileTest.class.getPackage())\n                .addAsResource(FileUtils.getFileForURL(fileUrl.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Inject\n    private PageBean001 pageBean;\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    @Test\n    public void noParameters()\n    {\n        Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());\n        this.pageBean.actionMethod();\n        Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc001/PageBean001.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean001\n{\n    //no params\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return SimplePageConfig.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc001/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\npublic class SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/PageBean002.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean002\n{\n    @NavigationParameter(key = \"param1\", value = \"staticMarker\")\n    public Class<? extends ViewConfig> actionMethod1()\n    {\n        return SimplePageConfig.class;\n    }\n\n    @NavigationParameter.List({\n            @NavigationParameter(key = \"param1\", value = \"staticMarker1\"),\n            @NavigationParameter(key = \"param2\", value = \"staticMarker2\")\n    })\n    public Class<? extends ViewConfig> actionMethod2()\n    {\n        return SimplePageConfig.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\npublic class SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/StaticNavigationParameterWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc002;\n\nimport java.net.URL;\n\nimport jakarta.inject.Inject;\n\nimport junit.framework.Assert;\n\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.test.category.DeltaSpikeTest;\nimport org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.shared.TestClassDeactivator;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.apache.deltaspike.test.jsf.impl.util.FileUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\n\n@RunWith(Arquillian.class)\npublic class StaticNavigationParameterWarFileTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = StaticNavigationParameterWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        URL fileUrl = StaticNavigationParameterWarFileTest.class.getClassLoader()\n                .getResource(\"navigationParameterTest/apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addClass(TestClassDeactivator.class)\n                .addPackage(StaticNavigationParameterWarFileTest.class.getPackage())\n                .addAsResource(FileUtils.getFileForURL(fileUrl.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Inject\n    private PageBean002 pageBean;\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    @Test\n    public void oneParameter()\n    {\n        Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());\n        this.pageBean.actionMethod1();\n        Assert.assertEquals(1, this.navigationParameterContext.getPageParameters().size());\n        Assert.assertEquals(\"staticMarker\", this.navigationParameterContext.getPageParameters().get(\"param1\"));\n    }\n\n    @Test\n    public void multipleParameters()\n    {\n        Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());\n        this.pageBean.actionMethod2();\n        Assert.assertEquals(2, this.navigationParameterContext.getPageParameters().size());\n        Assert.assertEquals(\"staticMarker1\", this.navigationParameterContext.getPageParameters().get(\"param1\"));\n        Assert.assertEquals(\"staticMarker2\", this.navigationParameterContext.getPageParameters().get(\"param2\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/NavigationParameterTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc003;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class NavigationParameterTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"nav-parameter-uc003.war\")\n                .addPackage(SimplePageConfig.class.getPackage())\n                .addClass(PageBean003.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/simplePageConfig.xhtml\", \"/simplePageConfig.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n        return archive;\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionWithParameter() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n        WebElement button = driver.findElement(By.id(\"parameter:pb003ActionMethod\"));\n        button.click();\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"simplePageConfig\")),\n                \"You arrived at simplePageConfig page\")\n                .apply(driver));\n        System.out.println(driver.getCurrentUrl());\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"param1=0\"));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/PageBean003.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc003;\n\nimport jakarta.enterprise.inject.Model;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\n\n@Model\npublic class PageBean003\n{\n    private int nextValue = 0;\n\n    @NavigationParameter(key = \"param1\", value = \"#{pageBean003.nextValue}\")\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        this.nextValue++;\n        return SimplePageConfig.class;\n    }\n\n    public int getNextValue()\n    {\n        return nextValue;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;\nimport org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;\n\n@View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)\npublic class SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/DynamicNavigationParameterWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\nimport org.apache.deltaspike.test.category.DeltaSpikeTest;\nimport org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.shared.TestClassDeactivator;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.apache.deltaspike.test.jsf.impl.util.FileUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport java.net.URL;\n\n\n@RunWith(Arquillian.class)\npublic class DynamicNavigationParameterWarFileTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = DynamicNavigationParameterWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        URL fileUrl = DynamicNavigationParameterWarFileTest.class.getClassLoader()\n                .getResource(\"navigationParameterTest/apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addClass(TestClassDeactivator.class)\n                .addPackage(DynamicNavigationParameterWarFileTest.class.getPackage())\n                .addAsResource(FileUtils.getFileForURL(fileUrl.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Inject\n    private PageBean004 pageBean;\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    @Test\n    public void dynamicParameters()\n    {\n        Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());\n\n        this.pageBean.actionMethod();\n        Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());\n\n        this.pageBean.actionMethod();\n        Assert.assertEquals(1, this.navigationParameterContext.getPageParameters().size());\n        Assert.assertEquals(\"0\", this.navigationParameterContext.getPageParameters().get(\"cv\"));\n\n        this.pageBean.actionMethod();\n        Assert.assertEquals(1, this.navigationParameterContext.getPageParameters().size());\n        Assert.assertEquals(\"1\", this.navigationParameterContext.getPageParameters().get(\"cv\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/NavigationParameterTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class NavigationParameterTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"nav-parameter-uc004-drone.war\")\n                .addPackage(SimplePageConfig.class.getPackage())\n                .addClass(PageBean004.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/simplePageConfig.xhtml\", \"/simplePageConfig.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n        return archive;\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionWithParameter() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        //first click\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n        WebElement button = driver.findElement(By.id(\"parameter:pb004ActionMethod\"));\n        button.click();\n\n        //second click\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n        button = driver.findElement(By.id(\"parameter:pb004ActionMethod\"));\n        button.click();\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"simplePageConfig\")),\n                \"You arrived at simplePageConfig page\")\n                .apply(driver));\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"cv=\"));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/PageBean004.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\n@Named\n@SessionScoped\npublic class PageBean004 implements Serializable\n{\n    private static final long serialVersionUID = -436742087379474804L;\n\n    private int currentValue = -2;\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        currentValue++;\n\n        if (currentValue >= 0)\n        {\n            this.navigationParameterContext.addPageParameter(\"cv\", this.currentValue);\n        }\n        return SimplePageConfig.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/SimplePageConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;\nimport org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;\n\n@View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)\npublic class SimplePageConfig implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/NavigationParameterTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc005;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class NavigationParameterTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"nav-parameter-uc005.war\")\n                .addPackage(Pages.class.getPackage())\n                .addClass(PageBean005.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/pages/index.xhtml\", \"/pages/index.xhtml\")\n                .addAsWebResource(\"navigation/pages/overview.xhtml\", \"/pages/overview.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n        return archive;\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionOverview() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"parameter:pb005Overview\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"overviewPage\")),\n                \"You arrived at overview page\")\n                .apply(driver));\n        System.out.println(driver.getCurrentUrl());\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"param1=staticValue2\"));\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"param2=aValue\"));\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionIndex() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"parameter:pb005Index\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"indexPage\")),\n                \"You arrived at index page\")\n                .apply(driver));\n        System.out.println(driver.getCurrentUrl());\n        Assert.assertTrue(driver.getCurrentUrl().contains(\"param1=staticValue2\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/PageBean005.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean005\n{\n    private String currentValue = \"aValue\";\n\n    public Class<? extends ViewConfig> index()\n    {\n        return Pages.Index.class;\n    }\n\n    public Class<? extends ViewConfig> overview()\n    {\n        return Pages.Overview.class;\n    }\n\n    public String getCurrentValue()\n    {\n        return currentValue;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;\nimport org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;\n\n@View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)\npublic interface Pages extends ViewConfig\n{\n    @NavigationParameter(key = \"param1\", value = \"staticValue2\")\n    class Index implements Pages\n    {\n    }\n\n    @NavigationParameter.List({\n            @NavigationParameter(key = \"param1\", value = \"staticValue2\"),\n            @NavigationParameter(key = \"param2\", value = \"#{pageBean005.currentValue}\")\n    })\n    class Overview implements Pages\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/NavigationParameterTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class NavigationParameterTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"nav-parameter-uc006.war\")\n                .addPackage(PageBean006.class.getPackage())\n                .addClass(Pages.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"navigation/origin.xhtml\", \"/origin.xhtml\")\n                .addAsWebResource(\"navigation/pages/customErrorPage.xhtml\", \"/pages/customErrorPage.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n        return archive;\n    }\n\n    @Test\n    @RunAsClient\n    public void testNavigationActionWithParameter() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"origin.xhtml\").toString());\n\n        WebElement button = driver.findElement(By.id(\"parameter:pb006AnyMethod\"));\n        button.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"customErrorPage\")),\n                \"This is a custom error page\")\n                .apply(driver));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageBean006.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.inject.Inject;\n\n@Model\npublic class PageBean006\n{\n    @Inject\n    private ViewNavigationHandler viewNavigationHandler;\n\n    //faces-redirect=true will be added by the navigation handler\n    public void anyMethod()\n    {\n        //navigates to the view which is configured as default error-view\n        //(in this example via a redirect, because it's configured for PageConfigForRedirect)\n        this.viewNavigationHandler.navigateTo(DefaultErrorView.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\n@View(navigation = REDIRECT)\npublic interface Pages extends ViewConfig\n{\n    public class CustomErrorPage extends DefaultErrorView implements Pages\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc007/PageBean007.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc007;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport jakarta.enterprise.inject.Model;\n\n@Model\npublic class PageBean007\n{\n    //includeViewParams=true will be added by the navigation handler\n    //TODO add test\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        return ViewConfigForIncludeViewParams.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc007/ViewConfigForIncludeViewParams.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc007;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\n@View(viewParams = INCLUDE)\npublic class ViewConfigForIncludeViewParams implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc001/SimplePageConfig001.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nclass SimplePageConfig001 implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc001/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc001;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithoutMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig001.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig001.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test\n    public void testSimpleViewConfigWithOptionalPageMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig001.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig001.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/simplePageConfig001.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(SimplePageConfig001.class, viewConfigDescriptor.getConfigClass());\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n\n        //@View gets added autom. if it isn't provided in-/directly\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc002/SimplePageConfig002.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\n@View\nclass SimplePageConfig002 implements ViewConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc002/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc002;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testSimpleMetaDataTreeWithMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig002.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test\n    public void testSimpleViewConfigWithExplicitPageMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig002.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/simplePageConfig002.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(SimplePageConfig002.class, viewConfigDescriptor.getConfigClass());\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\ninterface Pages\n{\n    class Index implements ViewConfig\n    {\n    }\n\n    @View\n    class Home implements ViewConfig\n    {\n    }\n\n    interface Admin extends ViewConfig\n    {\n        class Index implements Admin\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc003;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testNestedMetaDataTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View)node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test\n    public void testNestedViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(\"/pages/\", ((Folder)configDescriptor.getMetaData().iterator().next()).name());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(\"/pages/admin/\", ((Folder)configDescriptor.getMetaData().iterator().next()).name());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, ((View) viewConfigDescriptor.getMetaData().iterator().next())\n                .navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, (viewConfigDescriptor.getMetaData(View.class).iterator()\n                .next()).viewParams());\n        Assert.assertEquals(\"index\", (viewConfigDescriptor.getMetaData(View.class).iterator().next()).name());\n        Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/home.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, ((View) viewConfigDescriptor.getMetaData().iterator().next())\n                .navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).viewParams());\n        Assert.assertEquals(\"home\", (viewConfigDescriptor.getMetaData(View.class).iterator().next()).name());\n        Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());\n\n\n        ConfigDescriptor folderDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(folderDescriptor);\n        Assert.assertEquals(\"/pages/admin/\", folderDescriptor.getPath());\n        Assert.assertEquals(Pages.Admin.class, folderDescriptor.getConfigClass());\n\n        Assert.assertNotNull(folderDescriptor.getMetaData());\n        Assert.assertEquals(1, folderDescriptor.getMetaData().size());\n        Assert.assertEquals(\"/pages/admin/\", ((Folder)folderDescriptor.getMetaData().iterator().next()).name());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, ((View) viewConfigDescriptor.getMetaData().iterator().next())\n                .navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).viewParams());\n        Assert.assertEquals(\"index\", (viewConfigDescriptor.getMetaData(View.class).iterator().next()).name());\n        Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.Extension.JSP;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.FORWARD;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\ninterface Pages\n{\n    @View(name = \"home\", extension = JSP) class Index implements ViewConfig\n    {\n    }\n\n    @View(navigation = REDIRECT, viewParams = INCLUDE)\n    interface Admin extends ViewConfig\n    {\n        interface Statistics\n        {\n            @View\n            class Index implements ViewConfig\n            {\n            }\n\n            class Home implements Admin //inherit navigation = REDIRECT and viewParams = INCLUDE\n            {\n            }\n        }\n\n        class Index implements Admin //inherit navigation = REDIRECT and viewParams = INCLUDE\n        {\n        }\n\n        @View(navigation = FORWARD)\n        class Home implements Admin //inherit navigation = REDIRECT - but overruled and viewParams = INCLUDE\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc004;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    //only (all) real annotations are available here -> e.g. #getInheritedMetaData never returns a result here\n    //currently #getInheritedMetaData doesn't get tested explicitly\n    //the (merged) result gets exposed via the ViewConfigResolver\n    //TODO discuss if #getInheritedMetaData should be tested as well by exposing the transformed tree for tests\n    public void testMetaDataInheritanceInTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(2, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(2, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"home\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(\"jsp\", ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Statistics\n        Assert.assertNotNull(node.getParent().getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Statistics\n        Assert.assertNotNull(node.getParent().getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size()); //not processed at this point - node was just added\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());  //not processed at this point - node was just added\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());  //not processed at this point - node was just added\n    }\n\n    @Test\n    public void testMetaDataInheritanceInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        //the following is correct because it's @View at the folder level:\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(View.class).iterator().next().basePath());\n        Assert.assertEquals(\"xhtml\", configDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.Statistics.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.Statistics.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/statistics/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/home.jsp\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"jsp\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/statistics/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Statistics.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/statistics/home.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Statistics.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/home.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.FORWARD;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\n@View(navigation = REDIRECT)\ninterface Pages extends ViewConfig\n{\n    //inherits navigation = REDIRECT\n    class Index implements Pages\n    {\n    }\n\n    interface Admin extends Pages\n    {\n        //inherits navigation = REDIRECT\n        @View(viewParams = INCLUDE)\n        interface Statistics extends Admin\n        {\n            //inherits navigation = REDIRECT and viewParams = INCLUDE\n            @View\n            class Index implements Statistics\n            {\n            }\n\n            //inherits navigation = REDIRECT\n            class Home implements Admin\n            {\n            }\n        }\n\n        //inherits navigation = REDIRECT\n        @View\n        class Index implements Admin\n        {\n        }\n\n        //inherits but overrules navigation\n        @View(navigation = FORWARD)\n        class Home implements Admin\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc005;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    //only (all) real annotations are available here -> e.g. #getInheritedMetaData never returns a result here\n    //currently #getInheritedMetaData doesn't get tested explicitly\n    //the (merged) result gets exposed via the ViewConfigResolver\n    //TODO discuss if #getInheritedMetaData should be tested as well by exposing the transformed tree for tests\n    public void testMetaDataInheritanceInTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(2, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(2, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Statistics\n        Assert.assertNotNull(node.getParent().getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Statistics\n        Assert.assertNotNull(node.getParent().getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());  //not processed at this point - node was just added\n    }\n\n    @Test\n    public void testMetaDataInheritanceInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(View.Extension.XHTML, configDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        //the following is correct because it's @View at the folder level:\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(View.class).iterator().next().basePath());\n        Assert.assertEquals(\"xhtml\", configDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.Statistics.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.Statistics.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/statistics/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());   //TODO update uc004 with these lines\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        //the following is correct because it's @View at the folder level:\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"/pages/admin/\", configDescriptor.getMetaData(View.class).iterator().next().basePath());\n        Assert.assertEquals(\"xhtml\", configDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/statistics/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Statistics.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/statistics/home.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Statistics.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/home.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc006;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.Extension.FACES;\nimport static org.apache.deltaspike.jsf.api.config.view.View.Extension.JSF;\nimport static org.apache.deltaspike.jsf.api.config.view.View.Extension.XHTML;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.FORWARD;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\n@View(navigation = REDIRECT, extension = JSF)\ninterface Pages extends ViewConfig\n{\n    //inherits navigation = REDIRECT and extension = JSF\n    class Index implements Pages\n    {\n    }\n\n    //inherits navigation = REDIRECT and extension = JSF\n    interface Admin extends Pages\n    {\n        //inherits navigation = REDIRECT\n        @View(viewParams = INCLUDE, extension = FACES)\n        interface Statistics extends Admin\n        {\n            //inherits navigation = REDIRECT and viewParams = INCLUDE and extension = FACES\n            @View\n            class Index implements Statistics\n            {\n            }\n\n            //inherits navigation = REDIRECT and extension = JSF\n            class Home implements Admin\n            {\n            }\n        }\n\n        //inherits navigation = REDIRECT\n        @View(extension = XHTML) class Index implements Admin\n        {\n        }\n\n        //inherits but overrules navigation and extension = JSF\n        @View(navigation = FORWARD) class Home implements Admin\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc006;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    //only (all) real annotations are available here -> e.g. #getInheritedMetaData never returns a result here\n    //currently #getInheritedMetaData doesn't get tested explicitly\n    //the (merged) result gets exposed via the ViewConfigResolver\n    //TODO discuss if #getInheritedMetaData should be tested as well by exposing the transformed tree for tests\n    public void testMetaDataInheritanceInTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(2, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.JSF, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(2, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.FACES, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Statistics\n        Assert.assertNotNull(node.getParent().getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Statistics\n        Assert.assertNotNull(node.getParent().getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.XHTML, ((View) node.getMetaData().iterator().next()).extension());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());  //not processed at this point - node was just added\n    }\n\n    @Test\n    public void testMetaDataInheritanceInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next()\n                .navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(View.Extension.JSF, configDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        //the following is correct because it's @View at the folder level:\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(View.class).iterator().next().basePath());\n        Assert.assertEquals(\"jsf\", configDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.Statistics.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.Statistics.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(2, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/statistics/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n        Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        //the following is correct because it's @View at the folder level:\n        Assert.assertEquals(\"\", configDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"/pages/admin/\", configDescriptor.getMetaData(View.class).iterator().next().basePath());\n        Assert.assertEquals(\"faces\", configDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/index.jsf\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"jsf\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/statistics/index.faces\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Statistics.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"faces\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/statistics/home.jsf\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Statistics.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"jsf\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/home.jsf\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Home.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"home\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"jsf\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc007;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\ninterface Pages\n{\n    @TestFacesRedirect\n    interface Public extends ViewConfig\n    {\n        class Index implements Public\n        {\n        }\n    }\n\n    @TestFacesRedirect\n    @View(viewParams = INCLUDE)\n    class Home implements ViewConfig\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/TestFacesRedirect.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc007;\n\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\n\n/**\n * Custom meta-data\n */\n\n//don't use @Inherited\n@Target({TYPE})\n@Retention(RUNTIME)\n@Documented\n\n@Stereotype\n@View(navigation = REDIRECT)\n@interface TestFacesRedirect\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc007;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.annotation.Annotation;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataTreeWithStereotypeMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(2, node.getMetaData().size());\n\n        Assert.assertEquals(2, node.getMetaData().size());\n\n        boolean facesRedirectAnnotationFound = false;\n        boolean viewAnnotationFound = false;\n\n        for (Annotation metaData : node.getMetaData())\n        {\n            if (TestFacesRedirect.class.isAssignableFrom(metaData.annotationType()))\n            {\n                facesRedirectAnnotationFound = true;\n            }\n            else if (View.class.isAssignableFrom(metaData.annotationType()))\n            {\n                viewAnnotationFound = true;\n            }\n        }\n\n        Assert.assertTrue(facesRedirectAnnotationFound);\n        Assert.assertTrue(viewAnnotationFound);\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(TestFacesRedirect.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNotNull(node.getParent().getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testViewConfigWithStereotypeMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc008;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\n@Folder\ninterface Pages extends ViewConfig\n{\n    @Folder\n    interface Admin extends Pages\n    {\n        @View\n        class Index implements Admin\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc008;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataInheritanceInTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(\".\", ((Folder) node.getMetaData().iterator().next()).name());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(Folder.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test\n    public void testMetaDataInheritanceInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/pages/admin/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/pages/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/pages/admin/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc009/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc009;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\n@Folder(name = \"/\") //there are multiple folders which should be grouped by the outermost interface\ninterface Pages extends ViewConfig\n{\n    //result: /index.xhtml\n    class Index implements Pages\n    {\n    }\n\n    //result: /admin\n    interface Admin extends Pages\n    {\n        @View\n        class Index implements Admin\n        {\n        }\n    }\n\n    //result: /public\n    @Folder\n    interface Public extends Pages\n    {\n        @View\n        class Index implements Public\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc009/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc009;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataInheritanceInTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Public\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(Folder.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Public\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n    }\n\n    @Test\n    public void testMetaDataInheritanceInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/admin/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/admin/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Public.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Public.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/public/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/public/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Public.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/public/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc010/MyView.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc010;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\nimport static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;\n\n/**\n * Custom meta-data\n */\n\n@ViewMetaData\n//don't use @Inherited\n@Target({TYPE})\n@Retention(RUNTIME)\n@Documented\n\n@Stereotype\n@View(navigation = REDIRECT)\n@interface MyView\n{\n    String description();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc010/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc010;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;\n\ninterface Pages\n{\n    @MyView(description = \"public content\")\n    interface Public extends ViewConfig\n    {\n        class Index implements Public\n        {\n        }\n    }\n\n    @MyView(description = \"landing page\")\n    @View(viewParams = INCLUDE)\n    class Home implements ViewConfig\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc010/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc010;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.lang.annotation.Annotation;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataTreeWithStereotypeMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Home.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(2, node.getMetaData().size());\n\n        Assert.assertEquals(2, node.getMetaData().size());\n\n        boolean facesRedirectAnnotationFound = false;\n        boolean viewAnnotationFound = false;\n\n        for (Annotation metaData : node.getMetaData())\n        {\n            if (MyView.class.isAssignableFrom(metaData.annotationType()))\n            {\n                facesRedirectAnnotationFound = true;\n            }\n            else if (View.class.isAssignableFrom(metaData.annotationType()))\n            {\n                viewAnnotationFound = true;\n            }\n        }\n\n        Assert.assertTrue(facesRedirectAnnotationFound);\n        Assert.assertTrue(viewAnnotationFound);\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(MyView.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent());\n        Assert.assertNotNull(node.getParent().getParent());\n        Assert.assertNotNull(node.getParent().getParent().getParent());\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n        Assert.assertNotNull(node.getCallbackDescriptors());\n        Assert.assertEquals(0, node.getCallbackDescriptors().size());\n    }\n\n    @Test\n    public void testViewConfigWithStereotypeMetaData()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Home.class);\n        this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Home.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(2, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(MyView.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"landing page\", viewConfigDescriptor.getMetaData(MyView.class).iterator().next().description());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(2, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData(MyView.class).size());\n        Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"public content\", viewConfigDescriptor.getMetaData(MyView.class).iterator().next().description());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc011/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc011;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigRoot;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@ViewConfigRoot\n@Folder(name = \"/\") //there are multiple folders which should be grouped by the outermost interface\ninterface Pages extends ViewConfig\n{\n    //result: /index.xhtml\n    class Index implements Pages\n    {\n    }\n\n    //result: /admin\n    interface Admin extends Pages\n    {\n        @View\n        class Index implements Admin\n        {\n        }\n    }\n\n    //result: /public\n    @Folder\n    interface Public extends Pages\n    {\n        @View\n        class Index implements Public\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc011/ViewConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.navigation.syntax.uc011;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class ViewConfigTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testMetaDataInheritanceInTree()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n\n        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Root\n        Assert.assertNull(node.getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(3, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(3, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(0, node.getMetaData().size());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Admin\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Public\n        Assert.assertNotNull(node.getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(1, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(Folder.class, node.getMetaData().iterator().next().annotationType());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        node = this.viewConfigExtension.findNode(Pages.Public.Index.class);\n\n        Assert.assertNotNull(node);\n        Assert.assertNotNull(node.getParent()); //Public\n        Assert.assertNotNull(node.getParent().getParent()); //Pages\n        Assert.assertNotNull(node.getParent().getParent().getParent()); //Root\n        Assert.assertNull(node.getParent().getParent().getParent().getParent());\n\n        Assert.assertNotNull(node.getChildren());\n        Assert.assertEquals(0, node.getChildren().size());\n\n        Assert.assertNotNull(node.getMetaData());\n        Assert.assertEquals(1, node.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());\n        Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());\n        Assert.assertEquals(\"\", ((View) node.getMetaData().iterator().next()).name());\n        Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n\n\n        Assert.assertNotNull(node.getInheritedMetaData());\n        Assert.assertEquals(0, node.getInheritedMetaData().size());\n    }\n\n    @Test\n    public void testMetaDataInheritanceInViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n        ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/admin/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/admin/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/admin/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n\n\n        configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Public.class);\n\n        Assert.assertNotNull(configDescriptor);\n        Assert.assertNotNull(configDescriptor.getConfigClass());\n        Assert.assertEquals(Pages.Public.class, configDescriptor.getConfigClass());\n\n        Assert.assertNotNull(configDescriptor.getMetaData());\n        Assert.assertEquals(1, configDescriptor.getMetaData().size());\n        Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());\n        Assert.assertEquals(\"/public/\", configDescriptor.getMetaData(Folder.class).iterator().next().name());\n\n\n        viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);\n\n        Assert.assertNotNull(viewConfigDescriptor);\n        Assert.assertEquals(\"/public/index.xhtml\", viewConfigDescriptor.getViewId());\n        Assert.assertEquals(Pages.Public.Index.class, viewConfigDescriptor.getConfigClass());\n\n        Assert.assertNotNull(viewConfigDescriptor.getMetaData());\n        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());\n        Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());\n        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());\n        Assert.assertEquals(\"index\", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());\n        Assert.assertEquals(\"xhtml\", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());\n        Assert.assertEquals(\"/public/\", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/validation/Pages.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.validation;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\ninterface Pages extends ViewConfig\n{\n    class Index implements Pages\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/validation/ViewConfigPathValidatorTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.config.view.validation;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;\nimport org.apache.deltaspike.jsf.api.config.view.Folder;\nimport org.apache.deltaspike.jsf.api.config.view.View;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigPathValidator;\nimport org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport jakarta.servlet.ServletContextEvent;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class ViewConfigPathValidatorTest\n{\n    private ViewConfigExtension viewConfigExtension;\n\n    private ViewConfigResolverProducer viewConfigResolverProducer;\n\n    @Before\n    public void before()\n    {\n        this.viewConfigExtension = new ViewConfigExtension();\n        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);\n    }\n\n    @After\n    public void after()\n    {\n        this.viewConfigExtension.freeViewConfigCache(null);\n    }\n\n    @Test\n    public void testValidViewConfig()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        List<String> supportedExtensions = new ArrayList<String>();\n        supportedExtensions.add(View.Extension.XHTML);\n\n        try\n        {\n            new MockedViewConfigPathValidator(true).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"valid view-config was reported as invalid\");\n        }\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testMissingPath()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        List<String> supportedExtensions = new ArrayList<String>();\n        supportedExtensions.add(View.Extension.XHTML);\n        new MockedViewConfigPathValidator(false).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);\n    }\n\n    @Test\n    public void testMissingPathButUnsupportedExtension()\n    {\n        this.viewConfigExtension.addPageDefinition(Pages.Index.class);\n\n        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();\n\n        List<String> supportedExtensions = new ArrayList<String>();\n        supportedExtensions.add(View.Extension.JSF);\n\n        try\n        {\n            new MockedViewConfigPathValidator(false).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"unsupported extension wasn't ignored\");\n        }\n    }\n\n    private class MockedViewConfigPathValidator extends ViewConfigPathValidator\n    {\n        private final boolean validatePathAsValid;\n\n        private MockedViewConfigPathValidator(boolean validatePathAsValid)\n        {\n            this.validatePathAsValid = validatePathAsValid;\n        }\n\n        @Override\n        public void validateViewConfigPaths(ServletContextEvent sce,\n                                            ViewConfigResolver viewConfigResolver,\n                                            List<String> supportedExtensions)\n        {\n            super.validateViewConfigPaths(sce, viewConfigResolver, supportedExtensions);\n        }\n\n        @Override\n        protected boolean isValidPath(ServletContextEvent sce, ConfigDescriptor configDescriptor)\n        {\n            //in our tests we just validate views -> skip folders\n            return !configDescriptor.getMetaData(Folder.class).isEmpty() || this.validatePathAsValid;\n        }\n\n        @Override\n        protected void printException(Exception e)\n        {\n            //do nothing\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc001/AnotherBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc001;\n\npublic class AnotherBean\n{\n\n    private String value;\n\n    public AnotherBean()\n    {\n\n    }\n\n    public AnotherBean(String value)\n    {\n        this.value = value;\n    }\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public Object getAsObject(String value)\n    {\n        if (value != null && !value.isEmpty())\n        {\n            return new AnotherBean(value);\n        }\n        else\n        {\n            return null;\n        }\n    }\n\n    public String getAsString(Object object)\n    {\n        if (object instanceof AnotherBean)\n        {\n            AnotherBean myValue = (AnotherBean) object;\n            return myValue.getValue();\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc001/AnotherBeanConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc001;\n\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.convert.Converter;\nimport jakarta.faces.convert.ConverterException;\nimport jakarta.faces.convert.FacesConverter;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@FacesConverter(value = \"myValueConverter\", managed = true)\npublic class AnotherBeanConverter implements Converter\n{\n\n    @Inject\n    private AnotherBean myValue;\n\n    @Override\n    public Object getAsObject(FacesContext context, UIComponent component,\n            String value)\n    {\n        try\n        {\n            if (value == null || value.isEmpty())\n            {\n                return null;\n            }\n            Integer.parseInt(value);\n            return myValue.getAsObject(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConverterException(new FacesMessage(\"Value is not an Integer\"));\n        }\n\n    }\n\n    @Override\n    public String getAsString(FacesContext context, UIComponent component,\n            Object value)\n    {\n        return myValue.getAsString(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc001/InjectionDroneTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc001;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class InjectionDroneTest\n{\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"injection-uc001.war\")\n                .addPackage(MyBean.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"injection/testValidatorConverter.xhtml\", \"/testValidatorConverter.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testConverter() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"converter:convertedValue\"));\n        convertedValue.sendKeys(\"123\");\n        WebElement testConverterButton = driver.findElement(By.id(\"converter:testConverterButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testConverterWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"converter:convertedValue\"));\n        convertedValue.sendKeys(\"String Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"converter:testConverterButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"converter:errorMessage\")), \"Value is not an Integer\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidator() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"DeltaSpike\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidatorWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"Wrong Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"validator:errorMessage\")), \"Not a valid value\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc001/MyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc001;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\n\n@Model\npublic class MyBean\n{\n\n    private String stringValue;\n\n    private AnotherBean convertedValue;\n\n    public String getStringValue()\n    {\n        return stringValue;\n    }\n\n    public void setStringValue(String stringValue)\n    {\n        this.stringValue = stringValue;\n    }\n\n    public AnotherBean getConvertedValue()\n    {\n        return convertedValue;\n    }\n\n    public void setConvertedValue(AnotherBean convertedValue)\n    {\n        this.convertedValue = convertedValue;\n    }\n\n    public void testAction()\n    {\n        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Worked\"));\n    }\n\n    public boolean isValid(String value)\n    {\n        return \"DeltaSpike\".equals(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc001/MyBeanValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc001;\n\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.validator.FacesValidator;\nimport jakarta.faces.validator.Validator;\nimport jakarta.faces.validator.ValidatorException;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@FacesValidator(value = \"myBeanValidator\", managed = true)\npublic class MyBeanValidator implements Validator\n{\n\n    @Inject\n    private MyBean myBean;\n\n    @Override\n    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException\n    {\n        if (value instanceof String)\n        {\n            String valueAString = (String) value;\n            if (!myBean.isValid(valueAString))\n            {\n                throw new ValidatorException(new FacesMessage(\"Not a valid value\"));\n            }\n\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc002/AnotherBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc002;\n\npublic class AnotherBean\n{\n\n    private String value;\n\n    public AnotherBean()\n    {\n\n    }\n\n    public AnotherBean(String value)\n    {\n        this.value = value;\n    }\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public Object getAsObject(String value)\n    {\n        if (value != null && !value.isEmpty())\n        {\n            return new AnotherBean(value);\n        }\n        else\n        {\n            return null;\n        }\n    }\n\n    public String getAsString(Object object)\n    {\n        if (object instanceof AnotherBean)\n        {\n            AnotherBean myValue = (AnotherBean) object;\n            return myValue.getValue();\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc002/AnotherBeanConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc002;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Model;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.convert.Converter;\nimport jakarta.faces.convert.ConverterException;\nimport jakarta.faces.convert.FacesConverter;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@RequestScoped\n@FacesConverter(value = \"myValueConverter\", managed = true)\npublic class AnotherBeanConverter implements Converter\n{\n\n    @Inject\n    private AnotherBean myValue;\n\n    @Override\n    public Object getAsObject(FacesContext context, UIComponent component,\n            String value)\n    {\n        try\n        {\n            if (value == null || value.isEmpty())\n            {\n                return null;\n            }\n            Integer.parseInt(value);\n            return myValue.getAsObject(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConverterException(new FacesMessage(\"Value is not an Integer\"));\n        }\n\n    }\n\n    @Override\n    public String getAsString(FacesContext context, UIComponent component,\n            Object value)\n    {\n        return myValue.getAsString(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc002/InjectionDroneTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc002;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class InjectionDroneTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"injection-uc002.war\")\n                .addPackage(MyBean.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"injection/testValidatorConverter.xhtml\", \"/testValidatorConverter.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testConverter() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"converter:convertedValue\"));\n        convertedValue.sendKeys(\"123\");\n        WebElement testConverterButton = driver.findElement(By.id(\"converter:testConverterButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testConverterWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"converter:convertedValue\"));\n        convertedValue.sendKeys(\"String Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"converter:testConverterButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"converter:errorMessage\")), \"Value is not an Integer\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidator() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"DeltaSpike\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidatorWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"Wrong Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"validator:errorMessage\")), \"Not a valid value\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc002/MyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc002;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\n\n@Model\npublic class MyBean\n{\n\n    private String stringValue;\n\n    private AnotherBean convertedValue;\n\n    public String getStringValue()\n    {\n        return stringValue;\n    }\n\n    public void setStringValue(String stringValue)\n    {\n        this.stringValue = stringValue;\n    }\n\n    public AnotherBean getConvertedValue()\n    {\n        return convertedValue;\n    }\n\n    public void setConvertedValue(AnotherBean convertedValue)\n    {\n        this.convertedValue = convertedValue;\n    }\n\n    public void testAction()\n    {\n        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Worked\"));\n    }\n\n    public boolean isValid(String value)\n    {\n        return \"DeltaSpike\".equals(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc002/MyBeanValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc002;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.validator.FacesValidator;\nimport jakarta.faces.validator.Validator;\nimport jakarta.faces.validator.ValidatorException;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@RequestScoped\n@FacesValidator(value = \"myBeanValidator\", managed = true)\npublic class MyBeanValidator implements Validator\n{\n\n    @Inject\n    private MyBean myBean;\n\n    @Override\n    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException\n    {\n        if (value instanceof String)\n        {\n            String valueAString = (String) value;\n            if (!myBean.isValid(valueAString))\n            {\n                throw new ValidatorException(new FacesMessage(\"Not a valid value\"));\n            }\n\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc003/AbstractStateHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc003;\n\nimport jakarta.faces.component.StateHolder;\nimport jakarta.faces.context.FacesContext;\n\npublic abstract class AbstractStateHolder implements StateHolder\n{\n\n    private boolean isTransient;\n\n    @Override\n    public Object saveState(FacesContext context)\n    {\n        // no need to really save the state\n        return null;\n    }\n\n    @Override\n    public void restoreState(FacesContext context, Object state)\n    {\n        // no need to really restore the state\n    }\n\n    @Override\n    public boolean isTransient()\n    {\n        return isTransient;\n    }\n\n    @Override\n    public void setTransient(boolean newTransientValue)\n    {\n        this.isTransient = newTransientValue;\n\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc003/AnotherBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc003;\n\npublic class AnotherBean\n{\n\n    private String value;\n\n    public AnotherBean()\n    {\n\n    }\n\n    public AnotherBean(String value)\n    {\n        this.value = value;\n    }\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public Object getAsObject(String value)\n    {\n        if (value != null && !value.isEmpty())\n        {\n            return new AnotherBean(value);\n        }\n        else\n        {\n            return null;\n        }\n    }\n\n    public String getAsString(Object object)\n    {\n        if (object instanceof AnotherBean)\n        {\n            AnotherBean myValue = (AnotherBean) object;\n            return myValue.getValue();\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc003/AnotherBeanConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc003;\n\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.convert.Converter;\nimport jakarta.faces.convert.ConverterException;\nimport jakarta.faces.convert.FacesConverter;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@FacesConverter(value = \"myValueConverter\", managed = true)\npublic class AnotherBeanConverter extends AbstractStateHolder implements Converter\n{\n\n    @Inject\n    private AnotherBean myValue;\n\n    @Override\n    public Object getAsObject(FacesContext context, UIComponent component,\n            String value)\n    {\n        try\n        {\n            if (value == null || value.isEmpty())\n            {\n                return null;\n            }\n            Integer.parseInt(value);\n            return myValue.getAsObject(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConverterException(new FacesMessage(\"Value is not an Integer\"));\n        }\n\n    }\n\n    @Override\n    public String getAsString(FacesContext context, UIComponent component,\n            Object value)\n    {\n        return myValue.getAsString(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc003/InjectionDroneTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc003;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class InjectionDroneTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"injection-uc003.war\")\n                .addPackage(MyBean.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"injection/testValidatorConverterTag.xhtml\", \"/testValidatorConverter.xhtml\")\n                .addAsWebInfResource(\"META-INF/test.taglib.xml\", \"classes/META-INF/test.taglib.xml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(\"default/WEB-INF/faces-config.xml\", \"faces-config.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testConverter() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"converter:convertedValue\"));\n        convertedValue.sendKeys(\"123\");\n        WebElement testConverterButton = driver.findElement(By.id(\"converter:testConverterButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testConverterWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"converter:convertedValue\"));\n        convertedValue.sendKeys(\"String Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"converter:testConverterButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"converter:errorMessage\")),\n                \"Value is not an Integer\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidator() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"DeltaSpike\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidatorWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"Wrong Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"validator:errorMessage\")),\n                \"Not a valid value\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc003/MyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc003;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\n\n@Model\npublic class MyBean\n{\n\n    private String stringValue;\n\n    private AnotherBean convertedValue;\n\n    public String getStringValue()\n    {\n        return stringValue;\n    }\n\n    public void setStringValue(String stringValue)\n    {\n        this.stringValue = stringValue;\n    }\n\n    public AnotherBean getConvertedValue()\n    {\n        return convertedValue;\n    }\n\n    public void setConvertedValue(AnotherBean convertedValue)\n    {\n        this.convertedValue = convertedValue;\n    }\n\n    public void testAction()\n    {\n        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Worked\"));\n    }\n\n    public boolean isValid(String value)\n    {\n        return \"DeltaSpike\".equals(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc003/MyBeanValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc003;\n\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.validator.FacesValidator;\nimport jakarta.faces.validator.Validator;\nimport jakarta.faces.validator.ValidatorException;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@FacesValidator(value = \"myBeanValidator\", managed = true)\npublic class MyBeanValidator extends AbstractStateHolder implements Validator\n{\n\n    @Inject\n    private MyBean myBean;\n\n\n    @Override\n    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException\n    {\n        if (value instanceof String)\n        {\n            String valueAString = (String) value;\n            if (!myBean.isValid(valueAString))\n            {\n                throw new ValidatorException(new FacesMessage(\"Not a valid value\"));\n            }\n\n        }\n    }\n\n  \n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc004/AnotherBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc004;\n\npublic class AnotherBean\n{\n\n    private String value;\n\n    public AnotherBean()\n    {\n\n    }\n\n    public AnotherBean(String value)\n    {\n        this.value = value;\n    }\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n\n    public Object getAsObject(String value)\n    {\n        if (value != null && !value.isEmpty())\n        {\n            return new AnotherBean(value);\n        }\n        else\n        {\n            return null;\n        }\n    }\n\n    public String getAsString(Object object)\n    {\n        if (object instanceof AnotherBean)\n        {\n            AnotherBean myValue = (AnotherBean) object;\n            return myValue.getValue();\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc004/AnotherBeanConverter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc004;\n\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.convert.Converter;\nimport jakarta.faces.convert.ConverterException;\nimport jakarta.faces.convert.FacesConverter;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@FacesConverter(value = \"myValueConverter\", managed = true)\npublic class AnotherBeanConverter implements Converter\n{\n\n    @Inject\n    private AnotherBean myValue;\n\n    @Override\n    public Object getAsObject(FacesContext context, UIComponent component,\n            String value)\n    {\n        try\n        {\n            if (value == null || value.isEmpty())\n            {\n                return null;\n            }\n            Integer.parseInt(value);\n            return myValue.getAsObject(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConverterException(new FacesMessage(\"Value is not an Integer\"));\n        }\n\n    }\n\n    @Override\n    public String getAsString(FacesContext context, UIComponent component,\n            Object value)\n    {\n        return myValue.getAsString(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc004/InjectionDroneTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc004;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class InjectionDroneTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"injection-uc004.war\")\n                .addPackage(MyBean.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"injection/testValidatorTagParameter.xhtml\", \"/testValidatorConverter.xhtml\")\n                .addAsWebInfResource(\"META-INF/test.taglib.xml\", \"classes/META-INF/test.taglib.xml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(\"default/WEB-INF/faces-config.xml\", \"faces-config.xml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidator() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"DeltaSpike\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"messages\")), \"Worked\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testValidatorWithError() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"testValidatorConverter.xhtml\").toString());\n        WebElement convertedValue = driver.findElement(By.id(\"validator:stringValue\"));\n        convertedValue.sendKeys(\"Wrong Value\");\n        WebElement testConverterButton = driver.findElement(By.id(\"validator:testValidatorButton\"));\n        testConverterButton.click();\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id(\"validator:errorMessage\")),\n                \"The valid value should be DeltaSpike\").apply(driver));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc004/MyBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc004;\n\nimport jakarta.enterprise.inject.Model;\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.context.FacesContext;\n\n@Model\npublic class MyBean\n{\n\n    private String stringValue;\n\n    private AnotherBean convertedValue;\n\n    public String getStringValue()\n    {\n        return stringValue;\n    }\n\n    public void setStringValue(String stringValue)\n    {\n        this.stringValue = stringValue;\n    }\n\n    public AnotherBean getConvertedValue()\n    {\n        return convertedValue;\n    }\n\n    public void setConvertedValue(AnotherBean convertedValue)\n    {\n        this.convertedValue = convertedValue;\n    }\n\n    public void testAction()\n    {\n        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Worked\"));\n    }\n\n    public boolean isValid(String value, String validValue)\n    {\n        return validValue.equals(value);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/injection/uc004/MyBeanValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.injection.uc004;\n\nimport jakarta.faces.application.FacesMessage;\nimport jakarta.faces.component.StateHolder;\nimport jakarta.faces.component.UIComponent;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.validator.FacesValidator;\nimport jakarta.faces.validator.Validator;\nimport jakarta.faces.validator.ValidatorException;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n@Named\n@FacesValidator(value = \"myBeanValidator\", managed = true)\npublic class MyBeanValidator implements Validator, StateHolder\n{\n\n    @Inject\n    private MyBean myBean;\n\n    private String validValue = \"DeltaSpike\";\n    \n    private boolean isTransient;\n\n    public void setValidValue(String validValue)\n    {\n        this.validValue = validValue;\n    }\n\n    public String getValidValue()\n    {\n        return validValue;\n    }\n\n    @Override\n    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException\n    {\n        if (value instanceof String)\n        {\n            String valueAString = (String) value;\n            if (!myBean.isValid(valueAString, validValue))\n            {\n                throw new ValidatorException(new FacesMessage(\"The valid value should be \" + validValue));\n            }\n\n        }\n    }\n\n    @Override\n    public Object saveState(FacesContext context)\n    {\n        return this.validValue;\n    }\n\n    @Override\n    public void restoreState(FacesContext context, Object state)\n    {\n        this.validValue = (String) state;\n        \n    }\n\n    @Override\n    public boolean isTransient()\n    {\n        return isTransient;\n    }\n\n    @Override\n    public void setTransient(boolean newTransientValue)\n    {\n       this.isTransient = newTransientValue;\n        \n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/JsfMessageTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.message;\n\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.config.TestJsfModuleConfig;\nimport org.apache.deltaspike.test.jsf.impl.message.beans.JsfMessageBackingBean;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n/**\n * Test for the DeltaSpike JsfMessage Producer\n */\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class JsfMessageTest\n{\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"jsfMessageTest.war\")\n                .addPackage(JsfMessageBackingBean.class.getPackage())\n                .addClass(TestJsfModuleConfig.class)\n                .addAsResource(\"jsfMessageTest/UserMessage_en.properties\")\n                .addAsResource(\"jsfMessageTest/UserMessage_de.properties\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebResource(\"jsfMessageTest/page.xhtml\", \"page.xhtml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    public void testEnglishMessages() throws Exception\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"page.xhtml\").toString());\n\n        //X comment this in if you like to debug the server\n        //X I've already reported ARQGRA-213 for it\n        //X System.out.println(\"contextpath= \" + contextPath);\n        //X Thread.sleep(600000L);\n\n        // check the JSF FacesMessages\n        Assert.assertNotNull(ExpectedConditions.presenceOfElementLocated(By.xpath(\"id('messages')\")).apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[1]\")), \"message with details warnInfo!\").apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[2]\")), \"message without detail but parameter errorInfo.\").apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[3]\")), \"a simple message without a param.\").apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[4]\")), \"simple message with a string param fatalInfo.\").apply(driver));\n\n        // check the free message usage\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"test:valueOutput\")), \"a simple message without a param.\").apply(driver));\n\n        // and also the usage via direct EL invocation\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"test:elOutput\")), \"a simple message without a param.\").apply(driver));\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"test:elOutputWithParam\")), \"simple message with a string param hiho.\").apply(driver));\n    }\n\n    @Test\n    @RunAsClient\n    public void testGermanMessages() throws Exception\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"page.xhtml?lang=de\").toString());\n\n        // check the JSF FacesMessages\n        Assert.assertNotNull(ExpectedConditions.presenceOfElementLocated(By.xpath(\"id('messages')\")).apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[1]\")), \"Nachricht mit Details warnInfo!\").apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[2]\")), \"Nachricht ohne Details aber mit Parameter errorInfo.\").apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[3]\")), \"Einfache Nachricht ohne Parameter.\").apply(driver));\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.xpath(\"id('messages')/ul/li[4]\")), \"Einfache Nachricht mit String Parameter fatalInfo.\").apply(driver));\n\n        // check the free message usage\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"test:valueOutput\")), \"Einfache Nachricht ohne Parameter.\").apply(driver));\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/beans/JsfMessageBackingBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.message.beans;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\nimport org.apache.deltaspike.jsf.api.message.JsfMessage;\n\n/**\n * sample backing bean for JsfMessage.\n */\n@RequestScoped\n@Named\npublic class JsfMessageBackingBean\n{\n    @Inject\n    private JsfMessage<UserMessage> msg;\n\n    private String locale = \"en\";\n\n\n    public void init()\n    {\n        msg.addWarn().messageWithDetail(\"warnInfo\");\n        msg.addError().messageWithoutDetail(\"errorInfo\");\n        msg.addInfo().simpleMessageNoParam();\n        msg.addFatal().simpleMessageWithParam(\"fatalInfo\");\n    }\n\n    public String getSomeMessage()\n    {\n        return msg.get().simpleMessageNoParam();\n    }\n\n    public String getLocale()\n    {\n        return locale;\n    }\n\n    public void setLocale(String locale)\n    {\n        this.locale = locale;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/beans/UserMessage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.message.beans;\n\nimport org.apache.deltaspike.core.api.message.Message;\nimport org.apache.deltaspike.core.api.message.MessageBundle;\nimport org.apache.deltaspike.core.api.message.MessageContextConfig;\n\nimport jakarta.inject.Named;\n\n@MessageBundle\n@Named\n@MessageContextConfig(messageSource = \"jsfMessageTest.UserMessage\")\npublic interface UserMessage\n{\n    Message messageWithDetail(String param);\n\n    Message messageWithoutDetail(String param);\n\n    String simpleMessageWithParam(String param);\n\n    String simpleMessageNoParam();\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/view/beans/ViewScopedBackingBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.view.beans;\n\nimport jakarta.faces.view.ViewScoped;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\n/**\n * ViewScoped sample backing bean.\n */\n@ViewScoped\n@Named(\"viewScopedBean\")\npublic class ViewScopedBackingBean implements Serializable\n{\n    private int i = 0;\n\n    public int getI()\n    {\n        return i;\n    }\n\n    public void setI(int i)\n    {\n        this.i = i;\n    }\n\n    public String someAction()\n    {\n        // stay on the page.\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/viewaccess/ViewAccessScopedWebAppTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.viewaccess;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.control.LockedImplementation;\nimport org.apache.deltaspike.test.control.VersionControlRule;\nimport org.apache.deltaspike.test.jsf.impl.scope.viewaccess.beans.ViewAccessScopedBeanX;\nimport org.apache.deltaspike.test.jsf.impl.scope.viewaccess.beans.ViewAccessScopedBeanY;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.Implementation;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class ViewAccessScopedWebAppTest\n{\n    @ArquillianResource\n    private URL contextPath;\n\n    @Rule\n    public VersionControlRule versionControlRule = new VersionControlRule();\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ViewAccessScopedWebAppTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap\n                .create(WebArchive.class, archiveName + \".war\")\n                .addClass(ViewAccessScopedBeanX.class)\n                .addClass(ViewAccessScopedBeanY.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebResource(\"viewAccessScopedContextTest/page1.xhtml\", \"page1.xhtml\")\n                .addAsWebResource(\"viewAccessScopedContextTest/page2.xhtml\", \"page2.xhtml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n    @Test\n    @RunAsClient\n    // Actually not a MyFaces bug but html-unit uses Rhino which cannot handle EcmaScript spread operator syntax yet\n    // See https://github.com/mozilla/rhino/issues/968\n    @LockedImplementation(excludedImplementations = {Implementation.MYFACES40})\n    public void testForward() throws Exception\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        driver.get(new URL(contextPath, \"page1.xhtml\").toString());\n\n        WebElement inputFieldX = driver.findElement(By.id(\"testForm1:valueInputX\"));\n        inputFieldX.sendKeys(\"abc\");\n        WebElement inputFieldY = driver.findElement(By.id(\"testForm1:valueInputY\"));\n        inputFieldY.sendKeys(\"xyz\");\n\n        WebElement button = driver.findElement(By.id(\"testForm1:next\"));\n        button.click();\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"valueX\")), \"abc\").apply(driver));\n\n        button = driver.findElement(By.id(\"testForm2:back\"));\n        button.click();\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"valueOutputX\")), \"abc\").apply(driver));\n        Assert.assertFalse(ExpectedConditions.textToBePresentInElement(\n                driver.findElement( By.id(\"valueOutputY\")), \"xyz\").apply(driver));\n    }\n}"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/viewaccess/ViewAccessScopedWithFViewActionWebAppTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.jsf.impl.scope.viewaccess;\r\n\r\nimport org.apache.deltaspike.test.category.WebEEProfileCategory;\r\nimport org.apache.deltaspike.test.jsf.impl.scope.viewaccess.beans.ViewAccessScopedBeanX;\r\nimport org.apache.deltaspike.test.jsf.impl.scope.viewaccess.beans.ViewAccessScopedBeanY;\r\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.container.test.api.RunAsClient;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.arquillian.test.api.ArquillianResource;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assert;\r\nimport org.junit.Test;\r\nimport org.junit.experimental.categories.Category;\r\nimport org.junit.runner.RunWith;\r\nimport org.openqa.selenium.By;\r\nimport org.openqa.selenium.WebDriver;\r\nimport org.openqa.selenium.WebElement;\r\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\r\nimport org.openqa.selenium.support.ui.ExpectedConditions;\r\n\r\nimport java.net.URL;\r\n\r\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\r\n\r\n@RunWith(Arquillian.class)\r\n@Category(WebEEProfileCategory.class)\r\npublic class ViewAccessScopedWithFViewActionWebAppTest\r\n{\r\n\r\n    @ArquillianResource\r\n    private URL contextPath;\r\n\r\n    @Deployment\r\n    public static WebArchive deploy()\r\n    {\r\n        String simpleName = ViewAccessScopedWithFViewActionWebAppTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        return ShrinkWrap\r\n                .create(WebArchive.class, archiveName + \".war\")\r\n                .addClass(ViewAccessScopedBeanX.class)\r\n                .addClass(ViewAccessScopedBeanY.class)\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\r\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\r\n                .addAsWebResource(\"viewAccessScopedContextTest/index.xhtml\", \"index.xhtml\")\r\n                .addAsWebResource(\"viewAccessScopedContextTest/next.xhtml\", \"next.xhtml\")\r\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\r\n    }\r\n\r\n    @Test\r\n    @RunAsClient\r\n    public void testForward() throws Exception\r\n    {\r\n        WebDriver driver = new HtmlUnitDriver(true);\r\n        driver.get(new URL(contextPath, \"index.xhtml\").toString());\r\n\r\n        WebElement inputFieldX = driver.findElement(By.id(\"form:firstValue\"));\r\n        inputFieldX.sendKeys(\"abc\");\r\n        WebElement inputFieldY = driver.findElement(By.id(\"form:secondValue\"));\r\n        inputFieldY.sendKeys(\"xyz\");\r\n\r\n        WebElement button = driver.findElement(By.id(\"form:next\"));\r\n        button.click();\r\n\r\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\r\n                driver.findElement(By.id(\"firstValue\")), \"abc\").apply(driver));\r\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\r\n                driver.findElement(By.id(\"secondValue\")), \"xyz\").apply(driver));\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/viewaccess/beans/ViewAccessScopedBeanX.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.jsf.impl.scope.viewaccess.beans;\r\n\r\nimport java.io.Serializable;\r\nimport jakarta.inject.Named;\r\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\r\n\r\n@Named\r\n@ViewAccessScoped\r\npublic class ViewAccessScopedBeanX implements Serializable\r\n{\r\n    private String value;\r\n\r\n    public String getValue()\r\n    {\r\n        return value;\r\n    }\r\n\r\n    public void setValue(String value)\r\n    {\r\n        this.value = value;\r\n    }\r\n\r\n    public void viewAction()\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/viewaccess/beans/ViewAccessScopedBeanY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.viewaccess.beans;\n\nimport java.io.Serializable;\nimport jakarta.inject.Named;\nimport org.apache.deltaspike.core.api.scope.ViewAccessScoped;\n\n@Named\n@ViewAccessScoped\npublic class ViewAccessScopedBeanY implements Serializable\n{\n    private String value;\n\n    public String getValue()\n    {\n        return value;\n    }\n\n    public void setValue(String value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/window/MyWindowScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.window;\n\nimport java.io.Serializable;\n\nimport jakarta.inject.Named;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\n\n@Named\n@WindowScoped\npublic class MyWindowScopedBean implements Serializable\n{\n\n    private static final long serialVersionUID = 1L;\n\n    private int value = 0;\n\n    public int getValue()\n    {\n        return value;\n    }\n\n    public void count()\n    {\n        value++;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/window/WindowMaxCountTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.window;\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class WindowMaxCountTest\n{\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        WebArchive archive = ShrinkWrap\n                .create(WebArchive.class, \"windowMaxCountTest.war\")\n                .addPackage(WindowMaxCountTest.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebResource(\"windowScopedContextTest/windowcount.xhtml\", \"/windowcount.xhtml\")\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebInfResource(\"META-INF/apache-deltaspike.properties\",\n                        \"classes/META-INF/apache-deltaspike.properties\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n        return archive;\n    }\n\n    @Test\n    @RunAsClient\n    public void maxWindowPerSessionTest() throws MalformedURLException\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        // PAGE 1 - REQUEST 1\n        driver.get(new URL(contextPath, \"windowcount.xhtml\").toString());\n        // click once\n        WebElement button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        WebElement value = driver.findElement(By.id(\"form:value\"));\n        Assert.assertEquals(\"1\", value.getText());\n        driver.get(driver.getCurrentUrl());\n        // click twice\n        button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        Assert.assertEquals(\"2\", value.getText());\n        String page1 = driver.getCurrentUrl();\n\n        // PAGE 2 - REQUEST 2\n        driver.get(new URL(contextPath, \"windowcount.xhtml\").toString());\n        // click once\n        button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        Assert.assertEquals(\"1\", value.getText());\n        driver.get(driver.getCurrentUrl());\n        // click twice\n        button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        Assert.assertEquals(\"2\", value.getText());\n\n        // PAGE 3 - REQUEST 3 to force the oldest (page 1) WindowScope to drop\n        driver.get(new URL(contextPath, \"windowcount.xhtml\").toString());\n        // click once\n        button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        Assert.assertEquals(\"1\", value.getText());\n        driver.get(driver.getCurrentUrl());\n        // click twice\n        button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        Assert.assertEquals(\"2\", value.getText());\n        String page3 = driver.getCurrentUrl();\n\n        // PAGE 1 - REQUEST 4 on previous PAGE 1 page (value should get dropped to 0)\n        driver.get(new URL(page1).toString());\n        // click once\n        button = driver.findElement(By.id(\"form:count\"));\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        // Value should return to 1\n        Assert.assertEquals(\"1\", value.getText());\n\n        // PAGE 3 - REQUEST 5 on previous PAGE 3 page (page 1 and page 3 should be the two active pages)\n        driver.get(new URL(page3).toString());\n        button = driver.findElement(By.id(\"form:count\"));\n        // click once\n        button.click();\n        value = driver.findElement(By.id(\"form:value\"));\n        // Value should continue to 3\n        Assert.assertEquals(\"3\", value.getText());\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/window/WindowScopedContextFrameTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.window;\n\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.control.LockedImplementation;\nimport org.apache.deltaspike.test.control.VersionControlRule;\nimport org.apache.deltaspike.test.jsf.impl.config.TestJsfModuleConfig;\nimport org.apache.deltaspike.test.jsf.impl.scope.window.beans.WindowScopedBackingBean;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.Implementation;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\n\nimport java.net.URL;\nimport java.util.logging.Logger;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n/**\n * Test for the DeltaSpike JsfMessage Producer\n */\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class WindowScopedContextFrameTest\n{\n    private static final Logger log = Logger.getLogger(WindowScopedContextFrameTest.class.getName());\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Rule\n    public VersionControlRule versionControlRule = new VersionControlRule();\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"windowScopedContextFrameTest.war\")\n                .addPackage(WindowScopedBackingBean.class.getPackage())\n                .addClass(TestJsfModuleConfig.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebResource(\"META-INF/resources/deltaspike/windowhandler.js\",\n                                  \"resources/deltaspike/windowhandler.js\")\n                .addAsWebResource(\"windowScopedContextTest/framecontainer.xhtml\", \"framecontainer.xhtml\")\n                .addAsWebResource(\"windowScopedContextTest/frame.xhtml\", \"frame.xhtml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    // Actually not a MyFaces bug but html-unit uses Rhino which cannot handle EcmaScript spread operator syntax yet\n    // See https://github.com/mozilla/rhino/issues/968\n    @LockedImplementation(excludedImplementations = {Implementation.MYFACES40})\n    public void testWindowId() throws Exception\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        System.out.println(\"contextpath= \" + contextPath);\n\n        //X comment this in if you like to debug the server\n        //X I've already reported ARQGRA-213 for it\n        //X Thread.sleep(600000L);\n\n        driver.get(new URL(contextPath, \"framecontainer.xhtml\").toString());\n\n        String outerId = driver.findElement(By.id(\"window-id\")).getText();\n        String innerId = ((HtmlUnitDriver) driver).executeScript(\"return document.getElementById('iframe').contentWindow.document.getElementById('window-id').innerHTML\").toString().trim();\n\n        Assert.assertEquals(outerId, innerId);\n\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/window/WindowScopedContextTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.window;\n\n\nimport org.apache.deltaspike.test.category.WebProfileCategory;\nimport org.apache.deltaspike.test.control.LockedImplementation;\nimport org.apache.deltaspike.test.control.LockedVersionRange;\nimport org.apache.deltaspike.test.control.VersionControlRule;\nimport org.apache.deltaspike.test.jsf.impl.config.TestJsfModuleConfig;\nimport org.apache.deltaspike.test.jsf.impl.scope.window.beans.WindowScopedBackingBean;\nimport org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.Implementation;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.container.test.api.RunAsClient;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\n\nimport java.net.URL;\nimport java.util.logging.Logger;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n\n/**\n * Test for the DeltaSpike JsfMessage Producer\n */\n@RunWith(Arquillian.class)\n@Category(WebProfileCategory.class)\npublic class WindowScopedContextTest\n{\n    private static final Logger log = Logger.getLogger(WindowScopedContextTest.class.getName());\n\n    @Rule\n    public VersionControlRule versionControlRule = new VersionControlRule();\n\n    @ArquillianResource\n    private URL contextPath;\n\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap\n                .create(WebArchive.class, \"windowScopedContextTest.war\")\n                .addPackage(WindowScopedBackingBean.class.getPackage())\n                .addClass(TestJsfModuleConfig.class)\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())\n                .addAsWebInfResource(\"default/WEB-INF/web.xml\", \"web.xml\")\n                .addAsWebResource(\"META-INF/resources/deltaspike/windowhandler.js\",\n                                  \"resources/deltaspike/windowhandler.js\")\n                .addAsWebResource(\"windowScopedContextTest/page.xhtml\", \"page.xhtml\")\n                .addAsWebResource(\"windowScopedContextTest/page2.xhtml\", \"page2.xhtml\")\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n\n\n    @Test\n    @RunAsClient\n    // Actually not a MyFaces bug but html-unit uses Rhino which cannot handle EcmaScript spread operator syntax yet\n    // See https://github.com/mozilla/rhino/issues/968\n    @LockedImplementation(excludedImplementations = {Implementation.MYFACES40})\n    public void testWindowId() throws Exception\n    {\n        WebDriver driver = new HtmlUnitDriver(true);\n        System.out.println(\"contextpath= \" + contextPath);\n\n        //X comment this in if you like to debug the server\n        //X I've already reported ARQGRA-213 for it\n        //X Thread.sleep(600000L);\n\n        driver.get(new URL(contextPath, \"page.xhtml\").toString());\n\n        WebElement inputField = driver.findElement(By.id(\"test:valueInput\"));\n        inputField.sendKeys(\"23\");\n\n        WebElement button = driver.findElement(By.id(\"test:saveButton\"));\n        button.click();\n\n        Assert.assertTrue(ExpectedConditions.textToBePresentInElement(\n                driver.findElement(By.id(\"valueOutput\")), \"23\").apply(driver));\n\n    }\n\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/window/beans/WindowAccessBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.window.beans;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\nimport org.apache.deltaspike.core.spi.scope.window.WindowContext;\n\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\n@Named\n@WindowScoped\npublic class WindowAccessBean implements Serializable\n{\n\n    private static final long serialVersionUID = 1L;\n\n    @Inject\n    WindowContext windowContext;\n\n    public String getId()\n    {\n        return windowContext.getCurrentWindowId();\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/scope/window/beans/WindowScopedBackingBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.scope.window.beans;\n\nimport jakarta.inject.Named;\nimport java.io.Serializable;\n\nimport org.apache.deltaspike.core.api.scope.WindowScoped;\n\n/**\n * WindowScoped sample backing bean.\n */\n@WindowScoped\n@Named(\"windowScopedBean\")\npublic class WindowScopedBackingBean implements Serializable\n{\n    private int i = 0;\n\n    public int getI()\n    {\n        return i;\n    }\n\n    public void setI(int i)\n    {\n        this.i = i;\n    }\n\n    public String someAction()\n    {\n        return \"page2?faces-redirect=true\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.util;\n\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\n/**\n * This class contains helpers for building frequently used archives\n */\npublic class ArchiveUtils\n{\n    private ArchiveUtils() \n    {\n        // private ct\n    }\n    \n    public static JavaArchive[] getDeltaSpikeCoreAndJsfArchive()\n    {\n        String[] excludedFiles;\n\n        excludedFiles = new String[]{\"META-INF.apache-deltaspike.properties\"};\n\n        JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null\n                , \"META-INF/beans.xml\"\n                , new String[]{ \"org.apache.deltaspike.core\",\n                                \"org.apache.deltaspike.proxy\",\n                                \"org.apache.deltaspike.jsf\" }\n                , excludedFiles,\n                \"ds-core_proxy_jsf\");\n\n        return coreArchives;\n    }\n\n    public static JavaArchive[] getDeltaSpikeSecurityArchive()\n    {\n        String[] excludedFiles;\n\n        excludedFiles = new String[]{\"META-INF.apache-deltaspike.properties\"};\n\n\n        return ShrinkWrapArchiveUtil.getArchives(null,\n                \"META-INF/beans.xml\",\n                new String[]{\"org.apache.deltaspike.security\"}, excludedFiles,\n                \"ds-security\");\n    }\n\n    public static Asset getBeansXml()\n    {\n        Asset beansXml = new StringAsset(\n            \"<beans bean-discovery-mode=\\\"all\\\">\" +\n                \"<interceptors>\" +\n                    \"<class>org.apache.deltaspike.jsf.impl.config.view.navigation.NavigationParameterInterceptor</class>\" +\n                    \"<class>org.apache.deltaspike.jsf.impl.config.view.navigation.NavigationParameterListInterceptor</class>\" +\n                \"</interceptors>\" +\n            \"</beans>\"\n        );\n\n        return beansXml;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/FileUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.util;\n\nimport java.io.File;\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\n/**\n * Some basic utils\n */\n//TODO merge test-util classes\npublic class FileUtils\n{\n    private FileUtils()\n    {\n        // prevent instantiation\n    }\n\n    /**\n     * @param url the target URL\n     * @return a file created based on the given URL\n     */\n    public static File getFileForURL(String url)\n    {\n        //fix for wls\n        if(!url.startsWith(\"file:/\")) {\n            url = \"file:/\" + url;\n        }\n\n        url = url.replaceAll(\"%20\", \" \");\n\n        try\n        {\n            return new File( (new URL(url)).getFile());\n        }\n        catch (MalformedURLException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/JsfUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.jsf.impl.util;\n\nimport org.apache.deltaspike.jsf.impl.util.JsfUtils;\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport jakarta.faces.application.FacesMessage;\nimport java.util.ArrayList;\nimport java.util.List;\n\n//several tests are only needed to check that there won't be a NullPointerException\npublic class JsfUtilsTest\n{\n    @Test\n    public void testNewMessageWithoutExistingMessages()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, new FacesMessage(\"test\")));\n    }\n\n    @Test\n    public void testExistingSimpleMessage()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(\"test\"));\n        FacesMessage messageToCheck = new FacesMessage(\"test\");\n        Assert.assertEquals(Boolean.FALSE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testExistingMessageWithoutSummary()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(null, \"test\"));\n        FacesMessage messageToCheck = new FacesMessage(null, \"test\");\n        Assert.assertEquals(Boolean.FALSE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testExistingMessageWithoutDetails()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(\"test\", null));\n        FacesMessage messageToCheck = new FacesMessage(\"test\", null);\n        Assert.assertEquals(Boolean.FALSE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testNewMessageWithExistingMessageWithoutText()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(null, null));\n        FacesMessage messageToCheck = new FacesMessage(\"test\");\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testNewMessageWithoutText()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(\"existing\", \"message\"));\n        FacesMessage messageToCheck = new FacesMessage(null, null);\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testNewMessageWithoutSummary()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(\"existing\", \"message\"));\n        FacesMessage messageToCheck = new FacesMessage(null, \"test\");\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testNewMessageWithoutDetails()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(\"existing\", \"message\"));\n        FacesMessage messageToCheck = new FacesMessage(\"test\", null);\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testMessagesWithoutText()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(null, null));\n        FacesMessage messageToCheck = new FacesMessage(null, null);\n        Assert.assertEquals(Boolean.FALSE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testNewMessageWithExistingMessageWithoutSummary()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(null, \"message\"));\n        FacesMessage messageToCheck = new FacesMessage(\"new\", \"message\");\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testNewMessageWithExistingMessageWithoutDetails()\n    {\n        List<FacesMessage> existingFacesMessage = new ArrayList<FacesMessage>();\n        existingFacesMessage.add(new FacesMessage(\"existing\", null));\n        FacesMessage messageToCheck = new FacesMessage(\"new\", \"message\");\n        Assert.assertEquals(Boolean.TRUE,\n            JsfUtils.isNewMessage(existingFacesMessage, messageToCheck));\n    }\n\n    @Test\n    public void testRemoveUrlParameter()\n    {\n        Assert.assertEquals(\"http://localhost:58481/windowScopedContextTest/page.xhtml\",\n                JsfUtils.removeUrlParameter(\"http://localhost:58481/windowScopedContextTest/page.xhtml?jfwid=-1281\", \"jfwid\"));\n\n        Assert.assertEquals(\"http://localhost:58481/windowScopedContextTest/page.xhtml\",\n                JsfUtils.removeUrlParameter(\"http://localhost:58481/windowScopedContextTest/page.xhtml?jfwid=\", \"jfwid\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\ndeltaspike.scope.window.max-count=2\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/META-INF/test.taglib.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE facelet-taglib PUBLIC \"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN\" \"facelet-taglib_1_0.dtd\">\n<facelet-taglib>\n\t<namespace>http://deltaspike.apache.org/tags</namespace>\n\t<tag>\n\t\t<tag-name>myBeanValidator</tag-name>\n\t\t<validator>\n\t\t\t<validator-id>myBeanValidator</validator-id>\n\t\t</validator>\n\t</tag>\n\t<tag>\n\t\t<tag-name>myValueConverter</tag-name>\n\t\t<converter>\n\t\t    <converter-id>myValueConverter</converter-id>\n\t\t</converter>\n\t</tag>\n</facelet-taglib>"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/controller/simplePageConfig.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"simplePageConfig\">You arrived at simplePageConfig page</div>\n\t<div id=\"pageBean001Called\">#{pageBean001.called}</div>\n\t<div id=\"pageBean002Called\">#{pageBean002.called}</div>\n\t<div id=\"pageBean002Called\">#{pageBean003.called}</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/faces-config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!-- This file is not required if you don't need any extra configuration. -->\n<faces-config xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee\n        https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd\"\n    version=\"4.0\">\n    \n    <!-- This descriptor activates the JSF 2.0 Servlet -->\n\n    <!-- Write your navigation rules here. You are encouraged to use CDI \n        for creating @Named managed beans. -->\n\n</faces-config>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<web-app version=\"6.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd\">\n\n    <!--\n     * This is a simple web.xml for JSF applications.\n     * It just registers the FacesServlet and defines\n     * a mapping for xhtml files.\n    -->\n    <servlet>\n        <servlet-name>Faces Servlet</servlet-name>\n        <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n    </servlet>\n    <servlet-mapping>\n        <servlet-name>Faces Servlet</servlet-name>\n        <url-pattern>*.xhtml</url-pattern>\n    </servlet-mapping>\n</web-app>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/injection/testValidatorConverter.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:ui=\"http://java.sun.com/jsf/facelets\"\n\txmlns:f=\"http://java.sun.com/jsf/core\"\n\txmlns:h=\"http://java.sun.com/jsf/html\">\n\n<h:head></h:head>\n<body>\n\t<h:messages id=\"messages\" globalOnly=\"true\" />\n\t<br />\n\t<h:form id=\"converter\">\n\t\tConverterd Value :\n\t\t<h:inputText id=\"convertedValue\" value=\"#{myBean.convertedValue}\">\n\t\t\t<f:converter converterId=\"myValueConverter\" />\n\t\t</h:inputText>\n\t\t<h:message id=\"errorMessage\" for=\"convertedValue\" />\n\t\t<br />\n\t\t<h:commandButton id=\"testConverterButton\"\n\t\t\taction=\"#{myBean.testAction()}\" value=\"Test Converter\" />\n\t</h:form>\n\t<h:form id=\"validator\">\n\t\tValue String:\n\t\t<h:inputText id=\"stringValue\" value=\"#{myBean.stringValue}\">\n\t\t\t<f:validator validatorId=\"myBeanValidator\" />\n\t\t</h:inputText>\n\t\t<h:message id=\"errorMessage\" for=\"stringValue\" />\n\t\t<br />\n\t\t<h:commandButton id=\"testValidatorButton\"\n\t\t\taction=\"#{myBean.testAction()}\" value=\"Test Validator\" />\n\t</h:form>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/injection/testValidatorConverterTag.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:ui=\"http://java.sun.com/jsf/facelets\"\n\txmlns:f=\"http://java.sun.com/jsf/core\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:d=\"http://deltaspike.apache.org/tags\">\n\n<h:head></h:head>\n<body>\n\t<h:messages id=\"messages\" globalOnly=\"true\" />\n\t<br />\n\t<h:form id=\"converter\">\n\t\tConverterd Value :\n\t\t<h:inputText id=\"convertedValue\" value=\"#{myBean.convertedValue}\">\n\t\t\t<d:myValueConverter />\n\t\t</h:inputText>\n\t\t<h:message id=\"errorMessage\" for=\"convertedValue\" />\n\t\t<br />\n\t\t<h:commandButton id=\"testConverterButton\"\n\t\t\taction=\"#{myBean.testAction()}\" value=\"Test Converter\" />\n\t</h:form>\n\t<h:form id=\"validator\">\n\t\tValue String:\n\t\t<h:inputText id=\"stringValue\" value=\"#{myBean.stringValue}\">\n\t\t\t<d:myBeanValidator />\n\t\t</h:inputText>\n\t\t<h:message id=\"errorMessage\" for=\"stringValue\" />\n\t\t<br />\n\t\t<h:commandButton id=\"testValidatorButton\"\n\t\t\taction=\"#{myBean.testAction()}\" value=\"Test Validator\" />\n\t</h:form>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/injection/testValidatorTagParameter.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:ui=\"http://java.sun.com/jsf/facelets\"\n\txmlns:f=\"http://java.sun.com/jsf/core\"\n\txmlns:h=\"http://java.sun.com/jsf/html\"\n\txmlns:d=\"http://deltaspike.apache.org/tags\">\n\n<h:head></h:head>\n<body>\n\t<h:messages id=\"messages\" globalOnly=\"true\" />\n\t<br />\n\t<h:form id=\"validator\">\n\t\tValue String:\n\t\t<h:inputText id=\"stringValue\" value=\"#{myBean.stringValue}\">\n\t\t\t<d:myBeanValidator validValue=\"DeltaSpike\"/>\n\t\t</h:inputText>\n\t\t<h:message id=\"errorMessage\" for=\"stringValue\" />\n\t\t<br />\n\t\t<h:commandButton id=\"testValidatorButton\"\n\t\t\taction=\"#{myBean.testAction()}\" value=\"Test Validator\" />\n\t</h:form>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/UserMessage_de.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nmessageWithDetail = Nachricht mit Details %s!\nmessageWithDetail.detail = Nachricht mit sehr langen und genauen Details %s!\n\nmessageWithoutDetail = Nachricht ohne Details aber mit Parameter %s.\n\nsimpleMessageWithParam = Einfache Nachricht mit String Parameter %s.\n\nsimpleMessageNoParam = Einfache Nachricht ohne Parameter.\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/UserMessage_en.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\nmessageWithDetail = message with details %s!\nmessageWithDetail.detail = message with loooong and very specific details %s!\n\nmessageWithoutDetail = message without detail but parameter %s.\n\nsimpleMessageWithParam = simple message with a string param %s.\n\nsimpleMessageNoParam = a simple message without a param.\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/page.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\">\n\n<body>\n<f:view locale=\"#{jsfMessageBackingBean.locale}\">\n    <f:metadata>\n        <f:viewParam name=\"lang\" id=\"lang\" value=\"#{jsfMessageBackingBean.locale}\"/>\n        <f:event type=\"jakarta.faces.event.PreRenderViewEvent\" listener=\"#{jsfMessageBackingBean.init}\"/>\n    </f:metadata>\n    <div>\n\n    <h:form id=\"test\">\n        <div id=\"messages\">\n            <h:messages/>\n        </div>\n        <br/>\n        <h:outputLabel for=\"valueOutput\" value=\"the message:\"/>\n        <h:outputText id=\"valueOutput\" value=\"#{jsfMessageBackingBean.someMessage}\"/>\n        <br/>\n\n        <br/>\n        <h:outputLabel for=\"elOutput\" value=\"and via EL:\"/>\n        <h:outputText id=\"elOutput\" value=\"#{userMessage.simpleMessageNoParam()}\"/>\n        <br/>\n\n        <br/>\n        <h:outputLabel for=\"elOutputWithParam\" value=\"and via EL and param:\"/>\n        <h:outputText id=\"elOutputWithParam\" value=\"#{userMessage.simpleMessageWithParam('hiho')}\"/>\n        <br/>\n\n    </h:form>\n    </div>\n</f:view>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/mappedJsfContextTest/page.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\">\n\n<body>\n<f:view>\n    <f:metadata>\n        <f:viewParam name=\"req\" id=\"req\" value=\"#{jsfRequestScopedBackingBean.i}\"/>\n        <f:viewParam name=\"sess\" id=\"sess\" value=\"#{jsfSessionScopedBackingBean.i}\"/>\n        <f:viewParam name=\"app\" id=\"app\" value=\"#{jsfApplicationScopedBackingBean.i}\"/>\n    </f:metadata>\n    <div>\n\n    <h:form id=\"test\">\n        <h:outputText id=\"reqValue\" value=\"#{jsfRequestScopedBackingBean.i}\"/><br/>\n        <h:outputText id=\"sessValue\" value=\"#{jsfSessionScopedBackingBean.i}\"/><br/>\n        <h:outputText id=\"appValue\" value=\"#{jsfApplicationScopedBackingBean.i}\"/><br/>\n    </h:form>\n    </div>\n</f:view>\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/origin.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<h:form id=\"destination\">\n\t\t<h:commandButton id=\"pb001ActionMethod\" value=\"Action Method\" action=\"#{pageBean001.actionMethod()}\" />\n\t\t<h:commandButton id=\"pb002ActionWithoutError\" value=\"Action Method\" action=\"#{pageBean002.actionWithoutError()}\" />\n\t\t<h:commandButton id=\"pb002ActionWithError\" value=\"Action Method\" action=\"#{pageBean002.actionWithError()}\" />\n\t\t<h:commandButton id=\"pb002RestrictedToPages\" value=\"Action Method\" action=\"#{pageBean002.restrictedToPages()}\" />\n\t\t<h:commandButton id=\"pb003ActionMethod\" value=\"Action Method\" action=\"#{pageBean003.actionMethod()}\" />\n\t\t<h:commandButton id=\"pb003ActionMethod2\" value=\"Action Method\" action=\"#{pageBean003.actionMethod2()}\" />\n\t\t<h:commandButton id=\"pb004ActionMethod\" value=\"Action Method\" action=\"#{pageBean004.actionMethod()}\" />\n\t\t<h:commandButton id=\"pb004ActionMethod2\" value=\"Action Method\" action=\"#{pageBean004.actionMethod2()}\" />\n\t\t<h:commandButton id=\"pb006ActionMethod\" value=\"Action Method\" action=\"#{pageBean006.actionMethod()}\" />\n\t</h:form>\n\t<h:form id=\"event\">\n\t\t<h:commandButton id=\"pb002ActionWithError\" value=\"Action Method\" action=\"#{pageBean002.actionWithError()}\" />\n\t</h:form>\n\t<h:form id=\"parameter\">\n\t\t<h:commandButton id=\"pb003ActionMethod\" value=\"Action Method\" action=\"#{pageBean003.actionMethod()}\" />\n\t\t<h:commandButton id=\"pb004ActionMethod\" value=\"Action Method\" action=\"#{pageBean004.actionMethod()}\" />\n\t\t<h:commandButton id=\"pb005Overview\" value=\"Action Method\" action=\"#{pageBean005.overview()}\" />\n\t\t<h:commandButton id=\"pb005Index\" value=\"Action Method\" action=\"#{pageBean005.index()}\" />\n\t\t<h:commandButton id=\"pb006AnyMethod\" value=\"Action\" action=\"#{pageBean006.anyMethod()}\" />\n\t</h:form>\n\t\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/customErrorPage.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"customErrorPage\">This is a custom error page</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/home.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"homePage\">You arrived at home page</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/index.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"indexPage\">You arrived at index page</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/overview.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"overviewPage\">You arrived at overview page</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/simplePageConfig.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"simplePageConfig\">You arrived at simplePageConfig page</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigation/wizard1/step1.xhtml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"> \n\n<h:head><title>Test</title></h:head>\n<body> \n\t<div id=\"step1\">You arrived at step1 page</div>\n</body> \n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/navigationParameterTest/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.shared.TestClassDeactivator\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/viewAccessScopedContextTest/index.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:f=\"http://xmlns.jcp.org/jsf/core\"\n      xmlns:h=\"http://xmlns.jcp.org/jsf/html\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n<f:view>\n  <f:metadata>\n    <f:viewAction action=\"#{viewAccessScopedBeanX.viewAction()}\"/>\n  </f:metadata>\n\n  <h:head>\n  </h:head>\n\n  <h:body>\n    <ds:windowId/>\n\n    <h:form id=\"form\">\n      <h:outputLabel for=\"firstValue\" value=\"First value\"/>\n      <h:inputText id=\"firstValue\" value=\"#{viewAccessScopedBeanX.value}\"/>\n      <p/>\n      <h:outputLabel for=\"secondValue\" value=\"Second value\"/>\n      <h:inputText id=\"secondValue\" value=\"#{viewAccessScopedBeanY.value}\"/>\n      <p/>\n      <h:commandButton id=\"next\" action=\"next.xhtml\" value=\"Next\"/>\n    </h:form>\n  </h:body>\n</f:view>\n\n</html>"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/viewAccessScopedContextTest/next.xhtml",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<html\nxmlns=\"http://www.w3.org/1999/xhtml\"\nxmlns:h=\"http://xmlns.jcp.org/jsf/html\"\nxmlns:f=\"http://xmlns.jcp.org/jsf/core\"\nxmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<f:view>\n  <h:head>\n  </h:head>\n\n  <h:body>\n    <ds:windowId/>\n    <h:outputText id=\"firstValue\" value=\"#{viewAccessScopedBeanX.value}\"/>\n    <p/>\n    <h:outputText id=\"secondValue\" value=\"#{viewAccessScopedBeanY.value}\"/>\n    <p/>\n  </h:body>\n</f:view>\n\n</html>"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/viewAccessScopedContextTest/page1.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n      xmlns:c=\"http://java.sun.com/jsp/jstl/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n\n</h:head>\n\n<h:body>\n    <ds:windowId/>\n    <div>\n        <h:form id=\"testForm1\">\n            <h:outputLabel for=\"valueInputX\" value=\"x:\"/>\n            <h:inputText id=\"valueInputX\" value=\"#{viewAccessScopedBeanX.value}\"/>\n            <br/>\n            <h:outputLabel for=\"valueInputY\" value=\"y:\"/>\n            <h:inputText id=\"valueInputY\" value=\"#{viewAccessScopedBeanY.value}\"/>\n            <br/>\n            <h:commandButton id=\"next\" action=\"page2.xhtml\" value=\"next\"/>\n        </h:form>\n        <h:outputText id=\"valueOutputX\" value=\"#{viewAccessScopedBeanX.value}\"/>\n        <h:outputText id=\"valueOutputY\" value=\"#{viewAccessScopedBeanY.value}\"/>\n    </div>\n</h:body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/viewAccessScopedContextTest/page2.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n      xmlns:c=\"http://java.sun.com/jsp/jstl/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n\n</h:head>\n\n<h:body>\n    <ds:windowId/>\n    <div>\n        <h:outputLabel for=\"valueX\" value=\"x:\"/>\n        <h:outputText id=\"valueX\" value=\"#{viewAccessScopedBeanX.value}\"/>\n        <br/>\n\n        <h:form id=\"testForm2\">\n            <h:commandButton id=\"back\" action=\"page1.xhtml\" value=\"back\"/>\n        </h:form>\n    </div>\n</h:body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/windowScopedContextTest/frame.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n      xmlns:c=\"http://java.sun.com/jsp/jstl/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n\n</h:head>\n\n<h:body>\n<ds:windowId/>\n<div id=\"window-id\">\n    #{windowAccessBean.id}\n</div>\n</h:body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/windowScopedContextTest/framecontainer.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n      xmlns:c=\"http://java.sun.com/jsp/jstl/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n\n</h:head>\n\n<h:body>\n<ds:windowId/>\n    <div id=\"window-id\">\n        #{windowAccessBean.id}\n    </div>\n    <iframe id=\"iframe\" src=\"#{facesContext.externalContext.context.contextPath}/frame.xhtml\"></iframe>\n</h:body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/windowScopedContextTest/page.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n      xmlns:c=\"http://java.sun.com/jsp/jstl/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n\n</h:head>\n\n<h:body>\n<ds:windowId/>\n<div>\n    <h:form id=\"test\">\n        <h:outputLabel for=\"valueInput\" value=\"WindowScoped value:\"/>\n        <h:inputText id=\"valueInput\" value=\"#{windowScopedBean.i}\"/>\n        <br/>\n        <h:outputLabel for=\"valueOutput\" value=\"backing bean value:\"/>\n        <h:outputText id=\"valueOutput\" value=\"#{windowScopedBean.i}\"/>\n        <br/>\n        <h:commandButton id=\"saveButton\" action=\"#{windowScopedBean.someAction}\" value=\"save\"/>\n        <br/>\n        <h:link value=\"forward to page2 via GET\" outcome=\"page2.xhtml\"/>\n    </h:form>\n</div>\n</h:body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/windowScopedContextTest/page2.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n      xmlns:c=\"http://java.sun.com/jsp/jstl/core\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n\n<h:head>\n\n</h:head>\n\n<h:body>\n<ds:windowId/>\n<div>\n    <h:outputLabel for=\"valueOutput\" value=\"backing bean value:\"/>\n    <h:outputText id=\"valueOutput\" value=\"#{windowScopedBean.i}\"/>\n    <br/>\n</div>\n</h:body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/impl/src/test/resources/windowScopedContextTest/windowcount.xhtml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\txmlns:ui=\"http://java.sun.com/jsf/facelets\"\n\txmlns:f=\"http://java.sun.com/jsf/core\"\n\txmlns:h=\"http://java.sun.com/jsf/html\">\n\n<h:head></h:head>\n<body>\n\t<h:form id=\"form\">\n\tValue: <h:outputText id=\"value\" value=\"#{myWindowScopedBean.value}\" />\n\t\t<br />\n\t\t<h:commandButton action=\"#{myWindowScopedBean.count()}\" value=\"Count\"\n\t\t\tid=\"count\" />\n\t</h:form>\n\n</body>\n</html>\n"
  },
  {
    "path": "deltaspike/modules/jsf/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>jsf-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike JSF-Module</name>\n\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n\n    <dependencies>\n        <!-- JSF API, just for compiling -->\n        <dependency>\n            <groupId>org.apache.myfaces.core</groupId>\n            <artifactId>myfaces-api</artifactId>\n            <version>${myfaces.version}</version>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>partial-bean-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-partial-bean-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Partial-Bean-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.partialbean.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.partialbean.*,\n            *\n        </deltaspike.osgi.import>\n        <cdi.osgi.beans-managed>META-INF/beans.xml</cdi.osgi.beans-managed>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/api/PartialBeanBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.partialbean.api;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target(ANNOTATION_TYPE)\npublic @interface PartialBeanBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>partial-bean-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-partial-bean-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Partial-Bean-Module Impl</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.partialbean.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.partialbean.impl.*,\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n        <deltaspike.osgi.provide.capability>\n            org.ops4j.pax.cdi.extension;\n            extension=deltaspike-partial-bean-module-impl\n        </deltaspike.osgi.provide.capability>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-partial-bean-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-proxy-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-proxy-module-impl-asm</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.ow2.asm</groupId>\n            <artifactId>asm</artifactId>\n            <version>${asm.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.ow2.asm</groupId>\n            <artifactId>asm-commons</artifactId>\n            <version>${asm.version}</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.ow2.asm</groupId>\n            <artifactId>asm-tree</artifactId>\n            <version>${asm.version}</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.partialbean.impl;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\nimport jakarta.enterprise.inject.spi.configurator.BeanConfigurator;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.Annotateds;\nimport org.apache.deltaspike.core.util.AnnotationUtils;\nimport org.apache.deltaspike.core.util.BeanConfiguratorUtils;\nimport org.apache.deltaspike.core.util.BeanUtils;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ReflectionUtils;\nimport org.apache.deltaspike.partialbean.api.PartialBeanBinding;\nimport org.apache.deltaspike.proxy.api.DeltaSpikeProxyBeanConfigurator;\n\npublic class PartialBeanBindingExtension implements Extension, Deactivatable\n{\n    private final Map<Class<? extends Annotation>, PartialBeanDescriptor> descriptors =\n            new HashMap<Class<? extends Annotation>, PartialBeanDescriptor>();\n\n    private Boolean isActivated = true;\n    private IllegalStateException definitionError;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        this.isActivated = ClassDeactivationUtils.isActivated(getClass());      \n    }\n\n    public <X> void findInvocationHandlerBindings(@Observes ProcessAnnotatedType<X> pat)\n    {\n        if (!this.isActivated || this.definitionError != null)\n        {\n            return;\n        }\n\n        Class<X> beanClass = pat.getAnnotatedType().getJavaClass();\n\n        // skip classes without a partial bean binding\n        Class<? extends Annotation> bindingClass = extractBindingClass(pat);\n        if (bindingClass == null)\n        {\n            return;\n        }\n\n        if (beanClass.isInterface() || Modifier.isAbstract(beanClass.getModifiers()))\n        {\n            pat.veto();\n\n            PartialBeanDescriptor descriptor = descriptors.get(bindingClass);\n\n            if (descriptor == null)\n            {\n                descriptor = new PartialBeanDescriptor(bindingClass, null, beanClass);\n                descriptors.put(bindingClass, descriptor);\n            }\n            else if (!descriptor.getClasses().contains(beanClass))\n            {\n                descriptor.getClasses().add(beanClass);\n            }\n        }\n        else if (InvocationHandler.class.isAssignableFrom(beanClass))\n        {\n            PartialBeanDescriptor descriptor = descriptors.get(bindingClass);\n\n            if (descriptor == null)\n            {\n                descriptor = new PartialBeanDescriptor(bindingClass, (Class<? extends InvocationHandler>) beanClass);\n                descriptors.put(bindingClass, descriptor);\n            }\n            else\n            {\n                if (descriptor.getHandler() == null)\n                {\n                    descriptor.setHandler((Class<? extends InvocationHandler>) beanClass);\n                }\n                else if (!descriptor.getHandler().equals(beanClass))\n                {\n                    this.definitionError = new IllegalStateException(\"Multiple handlers found for \"\n                            + bindingClass.getName() + \" (\"\n                            + descriptor.getHandler().getName()\n                            + \" and \" + beanClass.getName() + \")\");\n                }\n            }\n        }\n        else\n        {\n            this.definitionError = new IllegalStateException(beanClass.getName() + \" is annotated with @\"\n                    + bindingClass.getName() + \" and therefore has to be \"\n                    + \"an abstract class, an interface or an implementation of \" + InvocationHandler.class.getName());\n        }\n    }\n\n    public <X> void createBeans(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        if (this.definitionError != null)\n        {\n            afterBeanDiscovery.addDefinitionError(this.definitionError);\n            return;\n        }\n\n        for (Map.Entry<Class<? extends Annotation>, PartialBeanDescriptor> entry : this.descriptors.entrySet())\n        {\n            PartialBeanDescriptor descriptor = entry.getValue();\n            if (descriptor.getClasses() != null)\n            {\n                for (Class partialBeanClass : descriptor.getClasses())\n                {\n                    boolean added = createPartialBean(partialBeanClass, descriptor, afterBeanDiscovery, beanManager);\n                    if (added)\n                    {\n                        createPartialProducersDefinedIn(afterBeanDiscovery, beanManager, partialBeanClass);\n                    }\n                }\n            }\n        }\n\n        this.descriptors.clear();\n    }\n\n    protected <T> boolean createPartialBean(Class<T> beanClass, PartialBeanDescriptor descriptor,\n            AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)\n    {\n        if (descriptor.getHandler() == null)\n        {\n            afterBeanDiscovery.addDefinitionError(new IllegalStateException(\"A class which implements \"\n                    + InvocationHandler.class.getName()\n                    + \" and is annotated with @\" + descriptor.getBinding().getName()\n                    + \" is needed as a handler for \" + beanClass.getName()\n                    + \". See the documentation about @\" + PartialBeanBinding.class.getName() + \".\"));\n\n            return false;\n        }\n\n        AnnotatedType<T> annotatedType = beanManager.createAnnotatedType(beanClass);\n\n        BeanConfigurator<T> beanConfigurator = afterBeanDiscovery.addBean();\n        BeanConfiguratorUtils.read(beanManager, beanConfigurator, annotatedType)\n            .beanClass(beanClass);\n        beanConfigurator.id(PartialBeanBinding.class.getName() + \":\" + Annotateds.createTypeId(annotatedType));\n\n        new DeltaSpikeProxyBeanConfigurator(beanClass,\n                descriptor.getHandler(),\n                PartialBeanProxyFactory.getInstance(),\n                beanManager,\n                beanConfigurator)\n            .delegateCreateWith()\n            .delegateDestroyWith();\n\n        return true;\n    }\n\n    protected <X> Class<? extends Annotation> extractBindingClass(ProcessAnnotatedType<X> pat)\n    {\n        for (Annotation annotation : pat.getAnnotatedType().getAnnotations())\n        {\n            if (annotation.annotationType().isAnnotationPresent(PartialBeanBinding.class))\n            {\n                return annotation.annotationType();\n            }\n        }\n\n        return null;\n    }\n\n    /*\n     * logic for partial-producers\n     */\n\n    private void createPartialProducersDefinedIn(\n            AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager, Class currentClass)\n    {\n        while (currentClass != null && !Object.class.getName().equals(currentClass.getName()))\n        {\n            for (Class interfaceClass : currentClass.getInterfaces())\n            {\n                if (interfaceClass.getName().startsWith(\"java.\")\n                        || interfaceClass.getName().startsWith(\"javax.\")\n                        || interfaceClass.getName().startsWith(\"jakarta.\"))\n                {\n                    continue;\n                }\n\n                createPartialProducersDefinedIn(afterBeanDiscovery, beanManager, interfaceClass);\n            }\n\n            for (Method currentMethod : currentClass.getDeclaredMethods())\n            {\n                if (currentMethod.isAnnotationPresent(Produces.class))\n                {\n                    if (currentMethod.getParameterTypes().length > 0)\n                    {\n                        afterBeanDiscovery.addDefinitionError(\n                            new IllegalStateException(\n                                \"Producer-methods in partial-beans currently don't support injection-points. \" +\n                                \"Please remove the parameters from \" +\n                                currentMethod.toString() + \" in \" + currentClass.getName()));\n                    }\n\n                    Class<? extends Annotation> scopeClass =\n                        extractScope(currentMethod.getDeclaredAnnotations(), beanManager);\n\n                    Class<?> producerResultType = currentMethod.getReturnType();\n\n                    Set<Annotation> qualifiers = extractQualifiers(currentMethod.getDeclaredAnnotations(), beanManager);\n\n                    final Class partialBeanClass = currentClass;\n\n                    afterBeanDiscovery.addBean()\n                            .beanClass(producerResultType)\n                            .types(Object.class, producerResultType)\n                            .qualifiers(qualifiers)\n                            .scope(scopeClass)\n                            .id(createPartialProducerId(currentClass, currentMethod, qualifiers))\n                            .produceWith(e ->\n                                {\n                                    Object instance = BeanProvider.getContextualReference(partialBeanClass);\n                                    return ReflectionUtils.invokeMethod(instance, currentMethod, Object.class, false); \n                                });\n                }\n            }\n\n            currentClass = currentClass.getSuperclass();\n        }\n    }\n\n    private Set<Annotation> extractQualifiers(Annotation[] annotations, BeanManager beanManager)\n    {\n        Set<Annotation> result = BeanUtils.getQualifiers(beanManager, annotations);\n\n        if (result.isEmpty())\n        {\n            result.add(Default.Literal.INSTANCE);\n        }\n        return result;\n    }\n\n    private Class<? extends Annotation> extractScope(Annotation[] annotations, BeanManager beanManager)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (beanManager.isScope(annotation.annotationType()))\n            {\n                return annotation.annotationType();\n            }\n        }\n        return Dependent.class;\n    }\n\n    private String createPartialProducerId(Class currentClass, Method currentMethod, Set<Annotation> qualifiers)\n    {\n        int qualifierHashCode = 0;\n        for (Annotation qualifier : qualifiers)\n        {\n            qualifierHashCode += AnnotationUtils.getQualifierHashCode(qualifier);\n        }\n        return \"PartialProducer#\" + currentClass.getName() + \"#\" + currentMethod.getName() + \"#\" + qualifierHashCode;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanDescriptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.partialbean.impl;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationHandler;\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class PartialBeanDescriptor\n{\n    private Class<? extends Annotation> binding;\n    private Class<? extends InvocationHandler> handler;\n    private Set<Class<?>> classes;\n\n    public PartialBeanDescriptor(Class<? extends Annotation> binding)\n    {\n        this.binding = binding;\n        this.classes = new HashSet<>();\n    }\n\n    public PartialBeanDescriptor(Class<? extends Annotation> binding,\n            Class<? extends InvocationHandler> handler)\n    {\n        this(binding);\n        this.handler = handler;\n    }\n\n    public PartialBeanDescriptor(Class<? extends Annotation> binding,\n            Class<? extends InvocationHandler> handler,\n            Class<?> clazz)\n    {\n        this(binding, handler);\n        this.classes.add(clazz);\n    }\n    \n    public Class<? extends Annotation> getBinding()\n    {\n        return binding;\n    }\n\n    public void setBinding(Class<? extends Annotation> binding)\n    {\n        this.binding = binding;\n    }\n\n    public Class<? extends InvocationHandler> getHandler()\n    {\n        return handler;\n    }\n\n    public void setHandler(Class<? extends InvocationHandler> handler)\n    {\n        this.handler = handler;\n    }\n\n    public Set<Class<?>> getClasses()\n    {\n        return classes;\n    }\n\n    public void setClasses(Set<Class<?>> classes)\n    {\n        this.classes = classes;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.partialbean.impl;\n\nimport org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory;\n\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.util.ArrayList;\nimport java.util.Iterator;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n/**\n * {@link DeltaSpikeProxyFactory} which delegates all abstract methods to the \n * partial bean binding {@link java.lang.reflect.InvocationHandler}.\n */\n@Vetoed\npublic class PartialBeanProxyFactory extends DeltaSpikeProxyFactory\n{\n    private static final PartialBeanProxyFactory INSTANCE = new PartialBeanProxyFactory();\n    \n    public static PartialBeanProxyFactory getInstance()\n    {\n        return INSTANCE;\n    }\n    \n    @Override\n    protected String getProxyClassSuffix()\n    {\n        return \"$$DSPartialBeanProxy\";\n    }\n\n    @Override\n    protected ArrayList<Method> getDelegateMethods(Class<?> targetClass, ArrayList<Method> allMethods)\n    {\n        ArrayList<Method> methods = new ArrayList<>();\n        \n        Iterator<Method> it = allMethods.iterator();\n        while (it.hasNext())\n        {\n            Method method = it.next();\n\n            if (Modifier.isAbstract(method.getModifiers()))\n            {\n                methods.add(method);\n            }\n        }\n        \n        return methods;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.partialbean.impl.PartialBeanBindingExtension"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target({ TYPE, METHOD })\n@InterceptorBinding\npublic @interface CustomInterceptor\n{\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptorImpl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport java.io.Serializable;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\n\n@Interceptor\n@CustomInterceptor\npublic class CustomInterceptorImpl implements Serializable\n{\n    @Inject private CustomInterceptorState interceptionStateHolder;\n\n    @AroundInvoke\n    public Object interceptIt(InvocationContext invocationContext) throws Exception\n    {\n        interceptionStateHolder.setIntercepted(true);\n        return invocationContext.proceed();\n    }\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptorState.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class CustomInterceptorState\n{\n    private boolean intercepted;\n\n    public boolean isIntercepted()\n    {\n        return intercepted;\n    }\n\n    public void setIntercepted(boolean intercepted)\n    {\n        this.intercepted = intercepted;\n    }\n\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class TestBean\n{\n    public String getValue()\n    {\n        return \"test\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestInterceptorAware.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\n/**\n * Just needed for testing interceptors\n */\npublic interface TestInterceptorAware\n{\n    void setIntercepted(boolean intercepted);\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport org.apache.deltaspike.partialbean.api.PartialBeanBinding;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@PartialBeanBinding\n\n@Retention(RUNTIME)\n@Target(TYPE)\npublic @interface TestPartialBeanBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport org.apache.deltaspike.partialbean.api.PartialBeanBinding;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@PartialBeanBinding\n\n@Retention(RUNTIME)\n@Target(TYPE)\npublic @interface ThrowExceptionPartialBeanBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.shared;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ThrowExceptionPartialBeanBinding\n@ApplicationScoped\npublic class ThrowExceptionPartialBeanHandler implements InvocationHandler\n{\n    @Override\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        throw new ClassNotFoundException();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc001;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.enterprise.context.RequestScoped;\r\n\r\n@TestPartialBeanBinding\r\n@RequestScoped\r\npublic interface PartialBean\r\n{\r\n    String getResult();\r\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceEarFileTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc001;\r\n\r\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\r\nimport org.junit.experimental.categories.Category;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\n@Category(EnterpriseArchiveProfileCategory.class)\r\npublic class PartialBeanAsInterfaceEarFileTest extends PartialBeanAsInterfaceTest\r\n{\r\n    @Deployment\r\n    public static EnterpriseArchive deployEar()\r\n    {\r\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\r\n        String simpleName = PartialBeanAsInterfaceWarFileTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\r\n                .addAsModule(PartialBeanAsInterfaceWarFileTest.deploy());\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc001;\r\n\r\nimport org.junit.Assert;\r\nimport org.junit.Test;\r\n\r\nimport jakarta.inject.Inject;\r\n\r\npublic abstract class PartialBeanAsInterfaceTest\r\n{\r\n    @Inject\r\n    private PartialBean partialBean;\r\n\r\n    @Test\r\n    public void testPartialBeanAsInterface() throws Exception\r\n    {\r\n        String result = this.partialBean.getResult();\r\n\r\n        Assert.assertEquals(\"partial-test-false\", result);\r\n\r\n        //TODO test pre-destroy callback\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc001;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\npublic class PartialBeanAsInterfaceWarFileTest extends PartialBeanAsInterfaceTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = PartialBeanAsInterfaceWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(PartialBeanAsInterfaceWarFileTest.class.getPackage())\n                .addPackage(TestPartialBeanBinding.class.getPackage())\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/TestPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc001;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\n@TestPartialBeanBinding\n@Dependent //normal-scopes are possible as well\npublic class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware\n{\n    @Inject\n    private TestBean testBean;\n\n    private String value;\n    private boolean intercepted;\n\n    @PostConstruct\n    protected void onCreate()\n    {\n        this.value = \"partial\";\n    }\n\n    @PreDestroy\n    protected void onDestroy()\n    {\n        //TODO check in a test\n    }\n\n    @Override\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        return this.value + \"-\" + this.testBean.getValue() + \"-\" + this.intercepted;\n    }\n\n    @Override\n    public void setIntercepted(boolean intercepted)\n    {\n        this.intercepted = intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc002;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\r\n\r\nimport jakarta.annotation.PostConstruct;\r\nimport jakarta.annotation.PreDestroy;\r\nimport jakarta.enterprise.context.RequestScoped;\r\nimport jakarta.inject.Inject;\r\n\r\n@TestPartialBeanBinding\r\n@RequestScoped\r\npublic abstract class PartialBean\r\n{\r\n    @Inject\r\n    private TestBean testBean;\r\n\r\n    private String value;\r\n\r\n    public abstract String getResult(String value);\r\n\r\n    @PostConstruct\r\n    protected void onCreate()\r\n    {\r\n        this.value = \"manual\";\r\n    }\r\n\r\n    @PreDestroy\r\n    protected void onDestroy()\r\n    {\r\n        //TODO check in a test\r\n    }\r\n\r\n    public String getManualResult()\r\n    {\r\n        return this.value + \"-\" + this.testBean.getValue();\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc002;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assert;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\nimport jakarta.inject.Inject;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class PartialBeanAsAbstractClassTest\r\n{\r\n    @Inject\r\n    private PartialBean partialBean;\r\n\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        String simpleName = PartialBeanAsAbstractClassTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(PartialBeanAsAbstractClassTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        return webArchive;\r\n    }\r\n\r\n    @Test\r\n    public void testPartialBeanAsAbstractClass() throws Exception\r\n    {\r\n        String result = this.partialBean.getResult(\"test\");\r\n\r\n        Assert.assertEquals(\"partial-test-false\", result);\r\n\r\n        result = this.partialBean.getManualResult();\r\n\r\n        Assert.assertEquals(\"manual-test\", result);\r\n\r\n        //TODO test pre-destroy callback\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/TestPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc002;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\n@TestPartialBeanBinding\n@Dependent //normal-scopes are possible as well\npublic class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware\n{\n    @Inject\n    private TestBean testBean;\n\n    private String value;\n    private boolean intercepted;\n\n    @PostConstruct\n    protected void onCreate()\n    {\n        this.value = \"partial\";\n    }\n\n    @PreDestroy\n    protected void onDestroy()\n    {\n        //TODO check in a test\n    }\n\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        return this.value + \"-\" + this.testBean.getValue() + \"-\" + this.intercepted;\n    }\n\n    public void setIntercepted(boolean intercepted)\n    {\n        this.intercepted = intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc003;\r\n\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\n@TestPartialBeanBinding\r\n@ApplicationScoped\r\npublic interface PartialBean extends SuperInterface<Object>, SuperInterface2<Object>\r\n{\r\n\r\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBeanTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc003;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assume;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class PartialBeanTest\r\n{\r\n    private static final String CONTAINER_OWB_1_2_x_BEFORE_1_2_8 = \"owb-1\\\\.2\\\\.[0-7]\";\r\n    private static final String CONTAINER_TOMEE_1_7_x = \"tomee-1\\\\.7\\\\..*\";\r\n    \r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        String simpleName = PartialBeanTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(PartialBeanTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        return webArchive;\r\n    }\r\n\r\n    @Test\r\n    public void testPartialBeanWithApplicationScope() throws Exception\r\n    {\r\n        // this test is known to not work under OWB 1.2.0 till 1.2.7 - see OWB #1036\r\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_OWB_1_2_x_BEFORE_1_2_8)\r\n                && !CdiContainerUnderTest.is(CONTAINER_TOMEE_1_7_x));\r\n        \r\n        PartialBean bean = BeanProvider.getContextualReference(PartialBean.class);\r\n        bean.test(this);            \r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/SuperInterface.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc003;\r\n\r\npublic interface SuperInterface<E>\r\n{\r\n    E test(E entity);\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/SuperInterface2.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc003;\r\n\r\npublic interface SuperInterface2<E>\r\n{\r\n     E test(E entity);\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/TestPartialBeanHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc003;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.annotation.PostConstruct;\r\nimport jakarta.annotation.PreDestroy;\r\nimport jakarta.enterprise.context.Dependent;\r\nimport jakarta.inject.Inject;\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\n\r\n@TestPartialBeanBinding\r\n@Dependent //normal-scopes are possible as well\r\npublic class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware\r\n{\r\n    @Inject\r\n    private TestBean testBean;\r\n\r\n    private String value;\r\n    private boolean intercepted;\r\n\r\n    @PostConstruct\r\n    protected void onCreate()\r\n    {\r\n        this.value = \"partial\";\r\n    }\r\n\r\n    @PreDestroy\r\n    protected void onDestroy()\r\n    {\r\n        //TODO check in a test\r\n    }\r\n\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {\r\n        return this.value + \"-\" + this.testBean.getValue() + \"-\" + this.intercepted;\r\n    }\r\n\r\n    public void setIntercepted(boolean intercepted)\r\n    {\r\n        this.intercepted = intercepted;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/AbstractSuper.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc004;\r\n\r\npublic abstract class AbstractSuper implements SuperInterface\r\n{\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ApplicationScopedPartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc004;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\n@TestPartialBeanBinding\r\n@ApplicationScoped\r\npublic abstract class ApplicationScopedPartialBean extends AbstractSuper\r\n{\r\n    private int count;\r\n\r\n    public abstract String getResult();\r\n\r\n    public int getManualResult()\r\n    {\r\n        return count++;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/DependentScopedPartialBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc004;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\n@TestPartialBeanBinding\npublic abstract class DependentScopedPartialBean\n{\n    private int count;\n\n    public abstract String getResult();\n\n    public int getManualResult()\n    {\n        return count++;\n    }\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ScopedPartialBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc004;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.BeansXmlUtil;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class ScopedPartialBeanTest\n{\n    @Deployment\n    public static WebArchive war()\n    {\n        String simpleName = ScopedPartialBeanTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(ScopedPartialBeanTest.class.getPackage())\n                .addPackage(TestPartialBeanBinding.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return webArchive;\n    }\n\n    @Test\n    public void testPartialBeanWithApplicationScope() throws Exception\n    {\n        ApplicationScopedPartialBean bean = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class);\n        \n        String result = bean.getResult();\n\n        Assert.assertEquals(\"partial-test-false\", result);\n\n        int count = bean.getManualResult();\n        Assert.assertEquals(0, count);\n\n        count = bean.getManualResult();\n        Assert.assertEquals(1, count);\n    }\n\n    @Test\n    public void testPartialBeanWithDependentScope() throws Exception\n    {\n        String result = BeanProvider.getContextualReference(DependentScopedPartialBean.class).getResult();\n\n        Assert.assertEquals(\"partial-test-false\", result);\n\n        int count = BeanProvider.getContextualReference(DependentScopedPartialBean.class).getManualResult();\n        Assert.assertEquals(0, count);\n\n        count = BeanProvider.getContextualReference(DependentScopedPartialBean.class).getManualResult();\n        Assert.assertEquals(0, count);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/SuperInterface.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc004;\r\n\r\npublic interface SuperInterface\r\n{\r\n    String willFail();\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/TestPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc004;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\n@TestPartialBeanBinding\n@Dependent //normal-scopes are possible as well\npublic class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware\n{\n    @Inject\n    private TestBean testBean;\n\n    private String value;\n    private boolean intercepted;\n\n    @PostConstruct\n    protected void onCreate()\n    {\n        this.value = \"partial\";\n    }\n\n    @PreDestroy\n    protected void onDestroy()\n    {\n        //TODO check in a test\n    }\n\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        return this.value + \"-\" + this.testBean.getValue() + \"-\" + this.intercepted;\n    }\n\n    public void setIntercepted(boolean intercepted)\n    {\n        this.intercepted = intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/AbstractSuper.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc005;\r\n\r\npublic abstract class AbstractSuper\r\n{\r\n    public abstract String willFail2();\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ApplicationScopedPartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc005;\r\n\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\n@TestPartialBeanBinding\r\n@ApplicationScoped\r\npublic abstract class ApplicationScopedPartialBean extends AbstractSuper implements SuperInterface\r\n{\r\n    private int count;\r\n\r\n    public abstract String getResult();\r\n\r\n    public int getManualResult()\r\n    {\r\n        return count++;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ScopedPartialBeanTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc005;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assert;\r\nimport org.junit.Assume;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class ScopedPartialBeanTest\r\n{\r\n    private static final String CONTAINER_OWB_1_2_x_BEFORE_1_2_8 = \"owb-1\\\\.2\\\\.[0-7]\";\r\n    private static final String CONTAINER_TOMEE_1_7_x = \"tomee-1\\\\.7\\\\..*\";\r\n\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        String simpleName = ScopedPartialBeanTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(ScopedPartialBeanTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        return webArchive;\r\n    }\r\n\r\n    @Test\r\n    public void testPartialBeanWithApplicationScope() throws Exception\r\n    {\r\n        // this test is known to not work under OWB 1.2.0 till 1.2.7 - see OWB #1036\r\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_OWB_1_2_x_BEFORE_1_2_8)\r\n                && !CdiContainerUnderTest.is(CONTAINER_TOMEE_1_7_x));\r\n\r\n        ApplicationScopedPartialBean bean = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class);\r\n        \r\n        String result = bean.willFail();\r\n\r\n        Assert.assertEquals(\"partial-test-false\", result);\r\n\r\n        String result2 = bean.willFail2();\r\n\r\n        Assert.assertEquals(\"partial-test-false\", result2);\r\n\r\n        int count = bean.getManualResult();\r\n        Assert.assertEquals(0, count);\r\n\r\n        count = bean.getManualResult();\r\n        Assert.assertEquals(1, count);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/SuperInterface.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc005;\r\n\r\npublic interface SuperInterface\r\n{\r\n    String willFail();\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/TestPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc005;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.annotation.PreDestroy;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\n@TestPartialBeanBinding\n@Dependent //normal-scopes are possible as well\npublic class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware\n{\n    @Inject\n    private TestBean testBean;\n\n    private String value;\n    private boolean intercepted;\n\n    @PostConstruct\n    protected void onCreate()\n    {\n        this.value = \"partial\";\n    }\n\n    @PreDestroy\n    protected void onDestroy()\n    {\n        //TODO check in a test\n    }\n\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        return this.value + \"-\" + this.testBean.getValue() + \"-\" + this.intercepted;\n    }\n\n    public void setIntercepted(boolean intercepted)\n    {\n        this.intercepted = intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuper.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc006;\r\n\r\npublic abstract class AbstractSuper<T> extends AbstractSuperSuper\r\n{\r\n    public abstract T willFail2() throws Throwable;\r\n\r\n    @Override\r\n    public String willFail3() throws RuntimeException, ClassNotFoundException, NoSuchMethodException, NoSuchFieldException\r\n    {\r\n        return \"willFail3\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuperSuper.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc006;\r\n\r\npublic abstract class AbstractSuperSuper\r\n{\r\n    public abstract String willFail3() throws Throwable;\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ApplicationScopedPartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc006;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.ThrowExceptionPartialBeanBinding;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\n@ThrowExceptionPartialBeanBinding\r\n@ApplicationScoped\r\npublic abstract class ApplicationScopedPartialBean extends AbstractSuper<String>\r\n{\r\n    private int count;\r\n\r\n    public abstract String getResult();\r\n\r\n    public int getManualResult()\r\n    {\r\n        return count++;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ScopedPartialBeanTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc006;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assert;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class ScopedPartialBeanTest\r\n{\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        final String simpleName = ScopedPartialBeanTest.class.getSimpleName();\r\n        final String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        final JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(ScopedPartialBeanTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        final WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        return webArchive;\r\n    }\r\n\r\n    @Test\r\n    public void testPartialBeanWithApplicationScope() throws Throwable\r\n    {\r\n        ApplicationScopedPartialBean bean = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class);\r\n        bean.getManualResult();\r\n\r\n        Assert.assertEquals(\"willFail3\", bean.willFail3());\r\n\r\n        try\r\n        {\r\n            bean.willFail2();\r\n\r\n            Assert.fail(\"#willFail2 should actually throw a ClassNotFoundException\");\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            Assert.assertEquals(e.getClass(), ClassNotFoundException.class);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/TestPartialBeanHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc006;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.annotation.PostConstruct;\r\nimport jakarta.annotation.PreDestroy;\r\nimport jakarta.enterprise.context.Dependent;\r\nimport jakarta.inject.Inject;\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;\r\n\r\n@TestPartialBeanBinding\r\n@Dependent //normal-scopes are possible as well\r\npublic class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware\r\n{\r\n    @Inject\r\n    private TestBean testBean;\r\n\r\n    private String value;\r\n    private boolean intercepted;\r\n\r\n    @PostConstruct\r\n    protected void onCreate()\r\n    {\r\n        this.value = \"partial\";\r\n    }\r\n\r\n    @PreDestroy\r\n    protected void onDestroy()\r\n    {\r\n        //TODO check in a test\r\n    }\r\n\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {\r\n        return this.value + \"-\" + this.testBean.getValue() + \"-\" + this.intercepted;\r\n    }\r\n\r\n    public void setIntercepted(boolean intercepted)\r\n    {\r\n        this.intercepted = intercepted;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/CustomInterceptorStereotype.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc007;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport jakarta.enterprise.inject.Stereotype;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptor;\n\n@Inherited\n@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })\n@Retention(RetentionPolicy.RUNTIME)\n@Stereotype\n@CustomInterceptor\npublic @interface CustomInterceptorStereotype {\n    \n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/MethodLevelInterceptorTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc007;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.core.util.ClassUtils;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorState;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.Asset;\r\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assert;\r\nimport org.junit.Assume;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class MethodLevelInterceptorTest\r\n{\r\n    public static final String CONTAINER_WELD_5_0 = \"weld-5\\\\.0\\\\..*\";\r\n\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        Asset beansXml = new StringAsset(\r\n            \"<beans bean-discovery-mode=\\\"all\\\"><interceptors><class>\" +\r\n                    CustomInterceptorImpl.class.getName() +\r\n            \"</class></interceptors></beans>\"\r\n        );\r\n\r\n        String simpleName = MethodLevelInterceptorTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        //don't create a completely empty web-archive\r\n        if (CdiContainerUnderTest.is(CONTAINER_WELD_5_0))\r\n        {\r\n            return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                    .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive());\r\n        }\r\n\r\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(MethodLevelInterceptorTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(beansXml, \"beans.xml\");\r\n\r\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(beansXml, \"beans.xml\");\r\n    }\r\n\r\n    @Test\r\n    public void testMethodLevelInterceptor() throws Exception\r\n    {\r\n        // this test is known to not work under weld-5.0.x\r\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));\r\n\r\n        // workaround as payara doesnt pass cdicontainer.version to the arquillian process\r\n        if (ClassUtils.tryToLoadClassForName(\"org.apache.deltaspike.test.core.api.partialbean.uc007.PartialBean\") == null)\r\n        {\r\n            return;\r\n        }\r\n\r\n        PartialBean partialBean = BeanProvider.getContextualReference(PartialBean.class);\r\n        CustomInterceptorState state = BeanProvider.getContextualReference(CustomInterceptorState.class);\r\n\r\n        Assert.assertNotNull(partialBean);\r\n        partialBean.doSomething();\r\n        Assert.assertEquals(true, state.isIntercepted());\r\n    }\r\n    \r\n    @Test\r\n    public void testMethodLevelInterceptorStereotype() throws Exception\r\n    {\r\n        // this test is known to not work under weld-5.0.x\r\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));\r\n\r\n        // workaround as payara doesnt pass cdicontainer.version to the arquillian process\r\n        if (ClassUtils.tryToLoadClassForName(\"org.apache.deltaspike.test.core.api.partialbean.uc007.PartialBean\") == null)\r\n        {\r\n            return;\r\n        }\r\n\r\n        PartialBean partialBean = BeanProvider.getContextualReference(PartialBean.class);\r\n        CustomInterceptorState state = BeanProvider.getContextualReference(CustomInterceptorState.class);\r\n\r\n        Assert.assertNotNull(partialBean);\r\n        partialBean.doSomething2();\r\n        Assert.assertEquals(true, state.isIntercepted());\r\n    }\r\n\r\n    @Test\r\n    public void testMethodLevelInterceptorOnAbstractMethod() throws Exception\r\n    {\r\n        // this test is known to not work under weld-5.0.x\r\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));\r\n\r\n        // workaround as payara doesnt pass cdicontainer.version to the arquillian process\r\n        if (ClassUtils.tryToLoadClassForName(\"org.apache.deltaspike.test.core.api.partialbean.uc007.PartialBean\") == null)\r\n        {\r\n            return;\r\n        }\r\n\r\n        PartialBean partialBean = BeanProvider.getContextualReference(PartialBean.class);\r\n        CustomInterceptorState state = BeanProvider.getContextualReference(CustomInterceptorState.class);\r\n\r\n        Assert.assertNotNull(partialBean);\r\n        Assert.assertEquals(\"partial\", partialBean.getResult());\r\n        Assert.assertEquals(true, state.isIntercepted());\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc007;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.enterprise.context.RequestScoped;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptor;\r\n\r\n@TestPartialBeanBinding\r\n@RequestScoped\r\npublic abstract class PartialBean\r\n{\r\n    @CustomInterceptor\r\n    public abstract String getResult();\r\n\r\n    @CustomInterceptor\r\n    public void doSomething()\r\n    {\r\n        String a = \"test\";\r\n    }\r\n    \r\n    @CustomInterceptorStereotype\r\n    public void doSomething2()\r\n    {\r\n        String a = \"test2\";\r\n    }\r\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/TestPartialBeanHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc007;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\n@TestPartialBeanBinding\r\n@ApplicationScoped\r\npublic class TestPartialBeanHandler implements InvocationHandler\r\n{\r\n    @Override\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {        \r\n        return \"partial\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/ClassLevelInterceptorTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc008;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorState;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Assume;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\npublic class ClassLevelInterceptorTest\n{\n    public static final String CONTAINER_WELD_5_0 = \"weld-5\\\\.0\\\\..*\";\n\n    @Deployment\n    public static WebArchive war()\n    {\n        Asset beansXml = new StringAsset(\n            \"<beans bean-discovery-mode=\\\"all\\\"><interceptors><class>\" +\n                    CustomInterceptorImpl.class.getName() +\n            \"</class></interceptors></beans>\"\n        );\n\n        String simpleName = ClassLevelInterceptorTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        //don't create a completely empty web-archive\n        if (CdiContainerUnderTest.is(CONTAINER_WELD_5_0))\n        {\n            return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                    .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive());\n        }\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(ClassLevelInterceptorTest.class.getPackage())\n                .addPackage(TestPartialBeanBinding.class.getPackage())\n                .addAsManifestResource(beansXml, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(beansXml, \"beans.xml\");\n    }\n\n    @Test\n    public void testClassLevelInterceptor() throws Exception\n    {\n        // this test is known to not work under weld-5.0.x\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));\n\n        // workaround as payara doesnt pass cdicontainer.version to the arquillian process\n        if (ClassUtils.tryToLoadClassForName(\"org.apache.deltaspike.test.core.api.partialbean.uc008.PartialBean\") == null)\n        {\n            return;\n        }\n\n        PartialBean partialBean = BeanProvider.getContextualReference(PartialBean.class);\n        CustomInterceptorState state = BeanProvider.getContextualReference(CustomInterceptorState.class);\n\n        Assert.assertNotNull(partialBean);\n        Assert.assertEquals(\"manual\", partialBean.getManualResult());\n\n        Assert.assertTrue(state.isIntercepted());\n    }\n\n    @Test\n    public void testClassLevelInterceptorOnAbstractMethod() throws Exception\n    {\n        // this test is known to not work under weld-5.0.x\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));\n\n        // workaround as payara doesnt pass cdicontainer.version to the arquillian process\n        if (ClassUtils.tryToLoadClassForName(\"org.apache.deltaspike.test.core.api.partialbean.uc008.PartialBean\") == null)\n        {\n            return;\n        }\n\n        PartialBean partialBean = BeanProvider.getContextualReference(PartialBean.class, true);\n        CustomInterceptorState state = BeanProvider.getContextualReference(CustomInterceptorState.class);\n\n        Assert.assertNotNull(partialBean);\n        Assert.assertEquals(\"partial\", partialBean.getResult());\n\n        Assert.assertTrue(state.isIntercepted());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/PartialBean.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc008;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptor;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.enterprise.context.RequestScoped;\r\n\r\n@CustomInterceptor\r\n@TestPartialBeanBinding\r\n@RequestScoped\r\npublic abstract class PartialBean\r\n{\r\n    public abstract String getResult();\r\n\r\n    public String getManualResult()\r\n    {\r\n        return \"manual\";\r\n    }\r\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/TestPartialBeanHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc008;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\n@TestPartialBeanBinding\r\n@ApplicationScoped\r\npublic class TestPartialBeanHandler implements InvocationHandler\r\n{\r\n    @Override\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {\r\n        return \"partial\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/PartialBeanWithProducerEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class PartialBeanWithProducerEarFileTest extends PartialBeanWithProducerTest\n{\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = PartialBeanWithProducerWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(PartialBeanWithProducerWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/PartialBeanWithProducerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport jakarta.inject.Inject;\n\npublic abstract class PartialBeanWithProducerTest\n{\n    @Inject\n    private TestConfig testConfig;\n\n    @Inject\n    @TestValue\n    private String value2;\n\n    @Inject\n    private TestCustomType value4;\n\n    @Test\n    public void testPartialBeanWithProducerManualAccess() throws Exception\n    {\n        Assert.assertEquals(new Integer(1), testConfig.value1());\n        Assert.assertEquals(\"2\", testConfig.value2());\n        Assert.assertEquals(new Integer(3), testConfig.value3());\n        Assert.assertEquals(new Integer(4), testConfig.value4().getTestValue());\n    }\n\n    @Test\n    public void testProducedResultOfPartialBeanWithProducer() throws Exception\n    {\n        Assert.assertEquals(\"2\", value2);\n        Assert.assertEquals(new Integer(4), value4.getTestValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/PartialBeanWithProducerWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.BeansXmlUtil;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class PartialBeanWithProducerWarFileTest extends PartialBeanWithProducerTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = PartialBeanWithProducerWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n                .addPackage(PartialBeanWithProducerWarFileTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/TestBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport jakarta.enterprise.inject.Produces;\n\npublic interface TestBaseConfig\n{\n    Integer value1();\n\n    @Produces\n    @TestValue\n    String value2();\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/TestConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.enterprise.inject.Produces;\n\n@TestTypeSafeConfig\npublic interface TestConfig extends TestBaseConfig\n{\n    Integer value3();\n\n    @Produces\n    @SessionScoped\n    TestCustomType value4();\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/TestCustomType.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.io.Serializable;\n\n@Vetoed\npublic class TestCustomType implements Serializable\n{\n    private Integer testValue;\n\n    public static TestCustomType parse(String value)\n    {\n        TestCustomType result = new TestCustomType();\n        result.testValue = Integer.parseInt(value);\n        return result;\n    }\n\n    public Integer getTestValue()\n    {\n        return testValue;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/TestTypeSafeConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport org.apache.deltaspike.partialbean.api.PartialBeanBinding;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@PartialBeanBinding\n\n@Retention(RUNTIME)\n@Target(TYPE)\npublic @interface TestTypeSafeConfig\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/TestTypeSafeConfigHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\n@TestTypeSafeConfig\n@SuppressWarnings(\"unused\")\npublic class TestTypeSafeConfigHandler implements InvocationHandler\n{\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        String stringValue = getTestValue(method.getName());\n        Object parsedValue = null;\n\n        final Class<?> configType = method.getReturnType();\n        if (configType.equals(Integer.class))\n        {\n            parsedValue = Integer.parseInt(stringValue);\n        }\n        else if (configType.equals(String.class))\n        {\n            parsedValue = stringValue;\n        }\n        else if (configType.equals(TestCustomType.class))\n        {\n            parsedValue = TestCustomType.parse(stringValue);\n        }\n\n        return parsedValue;\n    }\n\n    private String getTestValue(String methodName)\n    {\n        return methodName.replace(\"value\", \"\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc009/TestValue.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc009;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.*;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({METHOD, FIELD})\n@Retention(RUNTIME)\n@Qualifier\npublic @interface TestValue\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanAsAbstractClassTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc010;\r\n\r\nimport jakarta.enterprise.inject.spi.BeanManager;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\nimport jakarta.inject.Inject;\r\nimport org.apache.deltaspike.partialbean.impl.PartialBeanProxyFactory;\r\nimport org.apache.deltaspike.test.core.api.partialbean.uc010.PartialBeanWrapper.PartialBean;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class PartialBeanAsAbstractClassTest\r\n{\r\n    @Inject\r\n    private PartialBean partialBean;\r\n    \r\n    @Inject\r\n    private BeanManager beanManager;\r\n\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        String simpleName = PartialBeanAsAbstractClassTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(PartialBeanAsAbstractClassTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        return webArchive;\r\n    }\r\n\r\n    @Test\r\n    public void testDuplicateProxyGeneration() throws Exception\r\n    {\r\n        this.partialBean.getResult(\"test\");        \r\n        \r\n        PartialBeanProxyFactory.getInstance().getProxyClass(\r\n                beanManager,\r\n                PartialBean.class);\r\n        \r\n        PartialBeanProxyFactory.getInstance().getProxyClass(\r\n                beanManager,\r\n                PartialBean.class);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanWrapper.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc010;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\nimport jakarta.enterprise.context.RequestScoped;\r\n\r\n@ApplicationScoped\r\npublic class PartialBeanWrapper\r\n{\r\n    @TestPartialBeanBinding\r\n    @RequestScoped\r\n    public interface PartialBean\r\n    {\r\n        String getResult(String value);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/TestPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc010;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@TestPartialBeanBinding\n@ApplicationScoped\npublic class TestPartialBeanHandler implements InvocationHandler\n{\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/BaseRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc011;\n\nimport java.io.Serializable;\n\npublic abstract class BaseRepository<E> implements EntityRepository<E, Long>, Serializable\n{\n\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/CustomerRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc011;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\n@TestPartialBeanBinding\n@ApplicationScoped\npublic abstract class CustomerRepository extends BaseRepository<Object>\n{\n\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/EntityRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc011;\n\nimport java.io.Serializable;\n\npublic interface EntityRepository<E, PK extends Serializable>\n{\n    E save(E entity);\n    \n    E findBy(PK primaryKey);\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/ScopedPartialBeanTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc011;\r\n\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Ignore;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class ScopedPartialBeanTest\r\n{\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        final String simpleName = ScopedPartialBeanTest.class.getSimpleName();\r\n        final String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        final JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(ScopedPartialBeanTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        final WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\r\n\r\n        return webArchive;\r\n    }\r\n\r\n    @Test\r\n    @Ignore(\"Test to demonstrate WELD-2084\")\r\n    public void testPartialBeanWithApplicationScope() throws Throwable\r\n    {\r\n        CustomerRepository repository = BeanProvider.getContextualReference(CustomerRepository.class);\r\n        repository.save(null);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/TestPartialBeanHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc011;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport jakarta.enterprise.context.Dependent;\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\n\r\n@TestPartialBeanBinding\r\n@Dependent\r\npublic class TestPartialBeanHandler implements InvocationHandler\r\n{\r\n    @Override\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {\r\n        return null;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc012/BlockPolicy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.partialbean.uc012;\n\nimport java.util.concurrent.RejectedExecutionHandler;\nimport java.util.concurrent.ThreadPoolExecutor;\n\npublic class BlockPolicy implements RejectedExecutionHandler\n{\n   @Override\n   public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor)\n   {\n      try\n      {\n         executor.getQueue().put(runnable);\n      }\n      catch (InterruptedException interruptedException)\n      {\n         Thread.currentThread().interrupt();\n      }\n   }\n}"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc012/ConcurrencyBugTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.partialbean.uc012;\n\nimport jakarta.inject.Inject;\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.*;\n\nimport static java.util.concurrent.TimeUnit.SECONDS;\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class ConcurrencyBugTest\n{\n\n   @Deployment\n   public static WebArchive war()\n   {\n      final String simpleName = ConcurrencyBugTest.class.getSimpleName();\n      final String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n      final JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\n            .addPackage(ConcurrencyBugTest.class.getPackage())\n            .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n\n      final WebArchive webArchive =  ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\n            .addAsLibraries(testJar)\n            .addAsWebInfResource(BEANS_XML_ALL, \"beans.xml\");\n\n      return webArchive;\n   }\n\n   @Inject\n   private PartialBean bean;\n\n   @Test\n   public void testWithConcurrency() throws Exception\n   {\n      ThreadFactory threadFactory = Executors.defaultThreadFactory();\n      ExecutorService executor = new ThreadPoolExecutor(5, 10, 60, SECONDS, new SynchronousQueue<Runnable>(),\n            threadFactory, new BlockPolicy());\n      int iterations = 100;\n      List<Future<String>> results = new ArrayList<Future<String>>(iterations);\n      for (int i = 0; i < iterations; i++) {\n         results.add(executor.submit(new BeanCaller(bean)));\n      }\n      executor.shutdown();\n      executor.awaitTermination(60, SECONDS);\n      for (int i = 0; i < iterations; i++)\n      {\n         results.get(i).get();\n      }\n   }\n\n   private class BeanCaller implements Callable<String>\n   {\n      private final PartialBean partialBean;\n\n      private BeanCaller(PartialBean partialBean) {\n         this.partialBean = partialBean;\n      }\n\n      @Override\n      public String call() {\n         try {\n            return partialBean.getValue();\n         }\n         catch (NullPointerException e)\n         {\n            e.printStackTrace();\n            throw e;\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc012/MyPartialBeanBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.partialbean.uc012;\n\nimport org.apache.deltaspike.partialbean.api.PartialBeanBinding;\n\nimport java.lang.annotation.Retention;\n\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@PartialBeanBinding\n@Retention(RUNTIME)\npublic @interface MyPartialBeanBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc012/MyPartialBeanHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.partialbean.uc012;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\n@MyPartialBeanBinding\npublic class MyPartialBeanHandler implements InvocationHandler\n{\n   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n   {\n      return method.getName();\n   }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc012/PartialBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.core.api.partialbean.uc012;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@MyPartialBeanBinding\n@ApplicationScoped\npublic interface PartialBean\n{\n   String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/MethodLevelInterceptorTest.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\r\n\r\nimport jakarta.enterprise.inject.spi.Extension;\r\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\r\nimport org.apache.deltaspike.core.util.ClassUtils;\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\nimport org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;\r\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\r\nimport org.jboss.arquillian.container.test.api.Deployment;\r\nimport org.jboss.arquillian.junit.Arquillian;\r\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\r\nimport org.jboss.shrinkwrap.api.asset.Asset;\r\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\r\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\r\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\r\nimport org.junit.Assert;\r\nimport org.junit.Assume;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\n\r\nimport java.util.List;\r\n\r\n@RunWith(Arquillian.class)\r\npublic class MethodLevelInterceptorTest\r\n{\r\n    public static final String CONTAINER_WELD = \"weld-.*\";\r\n\r\n    @Deployment\r\n    public static WebArchive war()\r\n    {\r\n        Asset beansXml = new StringAsset(\r\n            \"<beans bean-discover-mode=\\\"all\\\"><interceptors><class>\" +\r\n                    SimpleCacheInterceptor.class.getName() +\r\n            \"</class></interceptors></beans>\"\r\n        );\r\n\r\n        String simpleName = MethodLevelInterceptorTest.class.getSimpleName();\r\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\r\n\r\n        //don't create a completely empty web-archive\r\n        if (CdiContainerUnderTest.is(CONTAINER_WELD))\r\n        {\r\n            return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                    .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive());\r\n        }\r\n\r\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\")\r\n                .addPackage(MethodLevelInterceptorTest.class.getPackage())\r\n                .addPackage(TestPartialBeanBinding.class.getPackage())\r\n                .addAsManifestResource(beansXml, \"beans.xml\");\r\n\r\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\r\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())\r\n                .addAsLibraries(testJar)\r\n                .addAsServiceProvider(Extension.class, SimpleCacheExtension.class)\r\n                .addAsWebInfResource(beansXml, \"beans.xml\");\r\n    }\r\n\r\n    @Test\r\n    public void testMethodLevelInterceptor() throws Exception\r\n    {\r\n        // this test is known to not work under weld\r\n        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD));\r\n\r\n        // workaround as payara doesnt pass cdicontainer.version to the arquillian process\r\n        if (ClassUtils.tryToLoadClassForName(\"org.apache.deltaspike.test.core.api.partialbean.uc013.MyRepository\") == null)\r\n        {\r\n            return;\r\n        }\r\n\r\n        MyRepository myRepository = BeanProvider.getContextualReference(MyRepository.class);\r\n\r\n        List<String> users = myRepository.getAllUsers();\r\n        \r\n        Assert.assertNotNull(users);\r\n        Assert.assertEquals(3, users.size());\r\n\r\n        Assert.assertSame(users, myRepository.getAllUsers());\r\n    }\r\n    \r\n  \r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/MyRepository.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\n\n@TestPartialBeanBinding\n@ApplicationScoped\npublic abstract class MyRepository\n{\n    @SimpleCache\n    public List<String> getAllUsers()\n    {\n        ArrayList<String> users = new ArrayList<>();\n        \n        users.add(\"Me\");\n        users.add(\"You\");\n        users.add(\"Anyone\");\n        \n        return users;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/SimpleCache.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Documented\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.TYPE, ElementType.METHOD })\npublic @interface SimpleCache\n{\n    \n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/SimpleCacheExtension.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\r\n\r\nimport jakarta.enterprise.event.Observes;\r\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\r\nimport jakarta.enterprise.inject.spi.Extension;\r\n\r\npublic class SimpleCacheExtension implements Extension\r\n{\r\n    void discoverInterceptorBindings(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent)\r\n    {\r\n        beforeBeanDiscoveryEvent.addInterceptorBinding(SimpleCache.class);\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/SimpleCacheInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\n\nimport java.io.Serializable;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\n\n@Interceptor\n@SimpleCache\npublic class SimpleCacheInterceptor implements Serializable\n{\n    @Inject\n    private SimpleCacheManager scm;\n    \n    @AroundInvoke\n    public Object wrapBeanCandidate(InvocationContext invocationContext) throws Exception\n    {\n        if (scm.getSingletonCache().containsKey(invocationContext.getMethod()))\n        {\n            return scm.getSingletonCache().get(invocationContext.getMethod());\n        }\n        \n        Object result = invocationContext.proceed();\n        scm.getSingletonCache().put(invocationContext.getMethod(), result);\n        \n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/SimpleCacheManager.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\r\n\r\nimport java.lang.reflect.Method;\r\nimport java.util.HashMap;\r\nimport java.util.Map;\r\nimport jakarta.annotation.PostConstruct;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\n@ApplicationScoped\r\npublic class SimpleCacheManager {\r\n    \r\n    private Map<Method, Object> singletonCache;\r\n    \r\n    @PostConstruct\r\n    public void init()\r\n    {\r\n        singletonCache = new HashMap<>();\r\n    }\r\n\r\n    public Map<Method, Object> getSingletonCache()\r\n    {\r\n        return singletonCache;\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/TestPartialBeanHandler.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\r\npackage org.apache.deltaspike.test.core.api.partialbean.uc013;\r\n\r\nimport org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;\r\n\r\nimport java.lang.reflect.InvocationHandler;\r\nimport java.lang.reflect.Method;\r\nimport jakarta.enterprise.context.ApplicationScoped;\r\n\r\n@TestPartialBeanBinding\r\n@ApplicationScoped\r\npublic class TestPartialBeanHandler implements InvocationHandler\r\n{\r\n    @Override\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {        \r\n        return \"partial\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.core.api.partialbean.util;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\npublic abstract class ArchiveUtils\n{\n    private ArchiveUtils()\n    {\n    }\n\n    public static JavaArchive[] getDeltaSpikeCoreAndPartialBeanArchive()\n    {\n        ArrayList<JavaArchive> result = new ArrayList<JavaArchive>();\n\n        JavaArchive[] temp;\n\n        temp = ShrinkWrapArchiveUtil.getArchives(null,\n                \"META-INF/beans.xml\",\n                new String[] { \"org.apache.deltaspike.core\",\n                        \"org.apache.deltaspike.proxy\",\n                        \"org.apache.deltaspike.test.category\",\n                        \"org.apache.deltaspike.partialbean\" },\n                new String[] { \"META-INF.apache-deltaspike.properties\" },\n                \"ds-core_proxy_and_partial-bean\");\n        result.addAll(Arrays.asList(temp));\n\n        return result.toArray(new JavaArchive[result.size()]);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/partial-bean/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>partial-bean-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Partial-Bean-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>parent-code</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../parent/code/pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>modules-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Modules</name>\n\n    <modules>\n        <module>proxy</module>\n        <module>security</module>\n        <module>jsf</module>\n        <module>partial-bean</module>\n        <module>jpa</module>\n        <module>data</module>\n        <module>scheduler</module>\n        <module>test-control</module>\n        <module>test-control5</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>proxy-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <artifactId>deltaspike-proxy-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Proxy-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.proxy.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.felix</groupId>\n                <artifactId>maven-bundle-plugin</artifactId>\n                <configuration>\n                    <instructions>\n                        <Service-Component>OSGI-INF/*</Service-Component>\n                    </instructions>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyBeanConfigurator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.api;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.util.Set;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.enterprise.inject.spi.PassivationCapable;\nimport jakarta.enterprise.inject.spi.configurator.BeanConfigurator;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxy;\nimport org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler;\n\n/**\n * {@link ContextualLifecycle} which handles a complete lifecycle of a proxy:\n * - creates a proxy via a {@link DeltaSpikeProxyFactory}\n * - handles the instantiation and injection of the proxy\n * - handles the instantiation via CDI of the delegate {@link InvocationHandler} and assign it to the proxy\n * - handles the release/destruction of both proxy and delegate {@link InvocationHandler}\n *\n * @param <T> The class of the original class.\n * @param <H> The class of the delegate {@link InvocationHandler}.\n */\npublic class DeltaSpikeProxyBeanConfigurator<T, H extends InvocationHandler>\n{\n    private final Class<T> proxyClass;\n    private final Class<H> delegateInvocationHandlerClass;\n    private final Method[] delegateMethods;\n    private final Class<T> targetClass;\n    private final BeanManager beanManager;\n    private final BeanConfigurator<T> beanConfigurator;\n    \n    private volatile DeltaSpikeProxyInvocationHandler deltaSpikeProxyInvocationHandler;\n    \n    private volatile InjectionTarget<T> injectionTarget;\n    private volatile Bean<H> handlerBean;\n    private volatile CreationalContext<?> creationalContextOfDependentHandler;\n\n    public DeltaSpikeProxyBeanConfigurator(Class<T> targetClass,\n                                              Class<H> delegateInvocationHandlerClass,\n                                              DeltaSpikeProxyFactory proxyFactory,\n                                              BeanManager beanManager,\n                                              BeanConfigurator<T> beanConfigurator)\n    {\n        this.targetClass = targetClass;\n        this.delegateInvocationHandlerClass = delegateInvocationHandlerClass;\n        this.proxyClass = proxyFactory.getProxyClass(beanManager, targetClass);\n        this.delegateMethods = proxyFactory.getDelegateMethods(targetClass);\n        this.beanManager = beanManager;\n        \n        if (!targetClass.isInterface())\n        {\n            AnnotatedType<T> annotatedType = beanManager.createAnnotatedType(this.targetClass);\n            this.injectionTarget = beanManager.getInjectionTargetFactory(annotatedType).createInjectionTarget(null);\n        }\n\n        this.beanConfigurator = beanConfigurator;\n    }\n\n    public DeltaSpikeProxyBeanConfigurator delegateCreateWith()\n    {\n        beanConfigurator.createWith((c) -> create(c));\n        return this;\n    }\n\n    public DeltaSpikeProxyBeanConfigurator delegateDestroyWith()\n    {\n        beanConfigurator.destroyWith((i, c) -> destroy(i, c));\n        return this;\n    }\n\n    protected T create(CreationalContext creationalContext)\n    {        \n        try\n        {\n            lazyInit();\n            \n            T instance = proxyClass.newInstance();\n\n            DeltaSpikeProxy deltaSpikeProxy = ((DeltaSpikeProxy) instance);\n            deltaSpikeProxy.setInvocationHandler(deltaSpikeProxyInvocationHandler);\n\n            // optional \n            if (delegateInvocationHandlerClass != null)\n            {\n                H delegateInvocationHandler = instantiateDelegateInvocationHandler();\n                deltaSpikeProxy.setDelegateInvocationHandler(delegateInvocationHandler);\n                deltaSpikeProxy.setDelegateMethods(delegateMethods);\n            }\n\n            if (this.injectionTarget != null)\n            {\n                this.injectionTarget.inject(instance, creationalContext);\n                this.injectionTarget.postConstruct(instance);\n            }\n\n            return instance;\n        }\n        catch (Exception e)\n        {\n            ExceptionUtils.throwAsRuntimeException(e);\n        }\n\n        // can't happen\n        return null;\n    }\n\n    protected void destroy(T instance, CreationalContext<T> creationalContext)\n    {\n        if (this.injectionTarget != null)\n        {\n            this.injectionTarget.preDestroy(instance);\n        }\n        \n        if (this.creationalContextOfDependentHandler != null)\n        {\n            this.creationalContextOfDependentHandler.release();\n        }\n\n        creationalContext.release();\n    }\n    \n    private void lazyInit()\n    {\n        if (this.deltaSpikeProxyInvocationHandler == null)\n        {\n            init();\n        }\n    }\n\n    private synchronized void init()\n    {\n        if (this.deltaSpikeProxyInvocationHandler == null)\n        {\n            Set<Bean<H>> handlerBeans = BeanProvider.getBeanDefinitions(\n                    delegateInvocationHandlerClass, false, true, beanManager);\n            if (handlerBeans.size() != 1)\n            {\n                StringBuilder beanInfo = new StringBuilder();\n                for (Bean<H> bean : handlerBeans)\n                {\n                    if (beanInfo.length() != 0)\n                    {\n                        beanInfo.append(\", \");\n                    }\n                    beanInfo.append(bean);\n\n                    if (bean instanceof PassivationCapable)\n                    {\n                        beanInfo.append(\" bean-id: \").append(((PassivationCapable) bean).getId());\n                    }\n                }\n\n                throw new IllegalStateException(handlerBeans.size() + \" beans found for \"\n                        + delegateInvocationHandlerClass + \" found beans: \" + beanInfo.toString());\n            }\n            this.handlerBean = handlerBeans.iterator().next();\n\n            this.deltaSpikeProxyInvocationHandler = BeanProvider.getContextualReference(\n                    beanManager, DeltaSpikeProxyInvocationHandler.class, false);\n        }\n    }\n    \n    protected H instantiateDelegateInvocationHandler()\n    {\n        CreationalContext<?> creationalContext = beanManager.createCreationalContext(handlerBean);\n        \n        H handlerInstance = (H) beanManager.getReference(handlerBean,\n                this.delegateInvocationHandlerClass, creationalContext);\n        \n        if (handlerBean.getScope().equals(Dependent.class))\n        {\n            this.creationalContextOfDependentHandler = creationalContext;\n        }\n\n        return handlerInstance;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.api;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.util.Set;\n\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ReflectionUtils;\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGenerator;\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGeneratorHolder;\n\npublic abstract class DeltaSpikeProxyFactory\n{\n    private static final String SUPER_ACCESSOR_METHOD_SUFFIX = \"$super\";\n\n    private <T> Class<T> resolveAlreadyDefinedProxyClass(Class<T> targetClass)\n    {\n        Class<T> proxyClass = ClassUtils.tryToLoadClassForName(constructProxyClassName(targetClass),\n                targetClass,\n                targetClass.getClassLoader());\n\n        return proxyClass;\n    }\n    \n    public <T> Class<T> getProxyClass(BeanManager beanManager, Class<T> targetClass)\n    {\n        // check if a proxy is already defined for this class\n        Class<T> proxyClass = resolveAlreadyDefinedProxyClass(targetClass);\n        if (proxyClass == null)\n        {\n            proxyClass = createProxyClass(beanManager, targetClass.getClassLoader(), targetClass);\n        }\n\n        return proxyClass;\n    }\n\n    private synchronized <T> Class<T> createProxyClass(BeanManager beanManager, ClassLoader classLoader,\n            Class<T> targetClass)\n    {\n        Class<T> proxyClass = resolveAlreadyDefinedProxyClass(targetClass);\n        if (proxyClass == null)\n        {\n            ArrayList<Method> allMethods = collectAllMethods(targetClass);\n            ArrayList<Method> interceptMethods = filterInterceptMethods(targetClass, allMethods);\n            Method[] delegateMethods = getDelegateMethods(targetClass);\n\n            // check if a interceptor is defined on class level. if not, skip interceptor methods\n            if (interceptMethods != null\n                    && !interceptMethods.isEmpty()\n                    && !containsInterceptorBinding(beanManager, targetClass.getDeclaredAnnotations()))\n            {\n                // loop every method and check if a interceptor is defined on the method -> otherwise don't overwrite\n                // interceptMethods\n                Iterator<Method> iterator = interceptMethods.iterator();\n                while (iterator.hasNext())\n                {\n                    Method method = iterator.next();\n                    if (!containsInterceptorBinding(beanManager, method.getDeclaredAnnotations()))\n                    {\n                        iterator.remove();\n                    }\n                }\n            }\n\n            DeltaSpikeProxyClassGenerator proxyClassGenerator = DeltaSpikeProxyClassGeneratorHolder.lookup();\n\n            proxyClass = proxyClassGenerator.generateProxyClass(classLoader,\n                    targetClass,\n                    getProxyClassSuffix(),\n                    SUPER_ACCESSOR_METHOD_SUFFIX,\n                    getAdditionalInterfacesToImplement(targetClass),\n                    delegateMethods,\n                    interceptMethods == null ? new Method[0]\n                            : interceptMethods.toArray(new Method[interceptMethods.size()]));\n        }\n\n        return proxyClass;\n    }\n\n    private boolean containsInterceptorBinding(BeanManager beanManager, Annotation[] annotations)\n    {\n        for (Annotation annotation : annotations)\n        {            \n            Class<? extends Annotation> annotationType = annotation.annotationType();\n            \n            if (beanManager.isInterceptorBinding(annotationType))\n            {\n                return true;\n            }\n\n            if (beanManager.isStereotype(annotationType))\n            {                \n                boolean containsInterceptorBinding = containsInterceptorBinding(\n                        beanManager,\n                        annotationType.getDeclaredAnnotations());\n                \n                if (containsInterceptorBinding)\n                {\n                    return true;\n                }\n            }\n        }\n        \n        return false;\n    }\n        \n    private String constructProxyClassName(Class<?> clazz)\n    {\n        return clazz.getName() + getProxyClassSuffix();\n    }\n\n    private static String constructSuperAccessorMethodName(Method method)\n    {\n        return method.getName() + SUPER_ACCESSOR_METHOD_SUFFIX;\n    }\n    \n    public static Method getSuperAccessorMethod(Object proxy, Method method) throws NoSuchMethodException\n    {\n        return proxy.getClass().getMethod(\n                constructSuperAccessorMethodName(method),\n                method.getParameterTypes());\n    }\n    \n    /**\n     * Checks if the given class is DS proxy class.\n     *\n     * @param clazz\n     * @return\n     */\n    public boolean isProxyClass(Class<?> clazz)\n    {\n        return clazz.getName().endsWith(getProxyClassSuffix());\n    }\n\n    private boolean ignoreMethod(Method method, List<Method> methods)\n    {\n        // we have no interest in generics bridge methods\n        if (method.isBridge())\n        {\n            return true;\n        }\n\n        // we do not proxy finalize()\n        if (\"finalize\".equals(method.getName()))\n        {\n            return true;\n        }\n\n        // same method...\n        if (methods.contains(method))\n        {\n            return true;\n        }\n\n        // check if a method with the same signature is already available\n        for (Method currentMethod : methods)\n        {\n            if (ReflectionUtils.hasSameSignature(currentMethod, method))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n    \n    protected ArrayList<Method> collectAllMethods(Class<?> clazz)\n    {\n        ArrayList<Method> methods = new ArrayList<>();\n        Set<Method> abstractMethodLeaves = new HashSet<>();\n        for (Method method : clazz.getMethods())\n        {\n            if (!ignoreMethod(method, methods))\n            {\n                methods.add(method);\n                if (Modifier.isAbstract(method.getModifiers()))\n                {\n                    abstractMethodLeaves.add(method);\n                }\n            }\n        }\n        for (Method method : clazz.getDeclaredMethods())\n        {\n            if (!ignoreMethod(method, methods))\n            {\n                methods.add(method);\n            }\n        }\n\n        // collect methods from abstract super classes...\n        Class currentSuperClass = clazz.getSuperclass();\n        while (currentSuperClass != null)\n        {\n            if (Modifier.isAbstract(currentSuperClass.getModifiers()))\n            {\n                for (Method method : currentSuperClass.getDeclaredMethods())\n                {\n                    if (!ignoreMethod(method, methods))\n                    {\n                        methods.add(method);\n                    }\n                }\n                for (Method method : currentSuperClass.getMethods())\n                {\n                    if (!ignoreMethod(method, methods))\n                    {\n                        methods.add(method);\n                    }\n                }\n            }\n            currentSuperClass = currentSuperClass.getSuperclass();\n        }\n\n        // sort out somewhere implemented abstract methods\n        Class currentClass = clazz;\n        while (currentClass != null)\n        {\n            Iterator<Method> methodIterator = methods.iterator();\n            while (methodIterator.hasNext())\n            {\n                Method method = methodIterator.next();\n                if (Modifier.isAbstract(method.getModifiers()) && !abstractMethodLeaves.contains(method))\n                {\n                    try\n                    {\n                        Method foundMethod = currentClass.getMethod(method.getName(), method.getParameterTypes());\n                        // if method is implementent in the current class -> remove it\n                        if (foundMethod != null && !Modifier.isAbstract(foundMethod.getModifiers()))\n                        {\n                            methodIterator.remove();\n                        }\n                    }\n                    catch (Exception e)\n                    {\n                        // ignore...\n                    }\n                }\n            }\n\n            currentClass = currentClass.getSuperclass();\n        }\n\n        return methods;\n    }\n    \n    protected ArrayList<Method> filterInterceptMethods(Class<?> targetClass, ArrayList<Method> allMethods)\n    {\n        ArrayList<Method> methods = new ArrayList<>();\n        \n        Iterator<Method> it = allMethods.iterator();\n        while (it.hasNext())\n        {\n            Method method = it.next();\n\n            if (Modifier.isPublic(method.getModifiers())\n                    && !Modifier.isFinal(method.getModifiers())\n                    && !Modifier.isAbstract(method.getModifiers()))\n            {\n                methods.add(method);\n            }\n        }\n        \n        return methods;\n    }\n    \n    protected Class<?>[] getAdditionalInterfacesToImplement(Class<?> targetClass)\n    {\n        return null;\n    }\n    \n    protected abstract ArrayList<Method> getDelegateMethods(Class<?> targetClass, ArrayList<Method> allMethods);\n    \n    protected abstract String getProxyClassSuffix();\n    \n    \n    public Method[] getDelegateMethods(Class<?> targetClass)\n    {\n        ArrayList<Method> allMethods = collectAllMethods(targetClass);\n        ArrayList<Method> delegateMethods = getDelegateMethods(targetClass, allMethods);\n        \n        if (delegateMethods == null)\n        {\n            return new Method[0];\n        }\n\n        return delegateMethods.toArray(new Method[delegateMethods.size()]);\n    }\n}\n\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/DeltaSpikeProxy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler;\n\n/**\n * Interface which will automatically be implemented by the proxy instance.\n */\npublic interface DeltaSpikeProxy\n{\n    void setInvocationHandler(DeltaSpikeProxyInvocationHandler invocationHandler);\n\n    DeltaSpikeProxyInvocationHandler getInvocationHandler();\n    \n    \n    void setDelegateInvocationHandler(InvocationHandler delegateInvocationHandler);\n\n    InvocationHandler getDelegateInvocationHandler();\n    \n    \n    void setDelegateMethods(Method[] methods);\n\n    Method[] getDelegateMethods();\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/DeltaSpikeProxyClassGenerator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi;\n\npublic interface DeltaSpikeProxyClassGenerator\n{\n    /**\n     * Generates a proxy class from the given source class, which also implements {@link DeltaSpikeProxy}.\n     * The proxy class will be generated in the same package as the original class\n     * and the suffix will be appended to the name of the class.\n     * \n     * @param <T> The target class.\n     * @param classLoader The {@link ClassLoader} to be used to define the proxy class.\n     * @param targetClass The class to proxy.\n     * @param suffix The classname suffix.\n     * @param superAccessorMethodSuffix It's required to generate methods which just invokes the original method.\n     *                                  We generate them with the same name as the original method\n     *                                  and append the suffix.\n     * @param additionalInterfaces Additional interfaces which should be implemented.\n     *                             Please note that you must also pass new methods via <code>delegateMethods</code>.\n     * @param delegateMethods Methods which should be delegated to the\n     *                        {@link DeltaSpikeProxy#getDelegateInvocationHandler()}\n     *                        instead of invoking the original method.\n     * @param interceptMethods Methods which should be intercepted (to call interceptors or decorators)\n     *                         before invoking the original method.\n     * @return The generated proxy class.\n     */\n    <T> Class<T> generateProxyClass(ClassLoader classLoader,\n                                    Class<T> targetClass,\n                                    String suffix,\n                                    String superAccessorMethodSuffix,\n                                    Class<?>[] additionalInterfaces,\n                                    java.lang.reflect.Method[] delegateMethods,\n                                    java.lang.reflect.Method[] interceptMethods);\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/DeltaSpikeProxyClassGeneratorHolder.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi;\n\nimport java.util.List;\nimport org.apache.deltaspike.core.util.ServiceUtils;\n\n// TODO it would be great if we could just rewrite it to an AppScoped bean\npublic class DeltaSpikeProxyClassGeneratorHolder\n{\n    private static DeltaSpikeProxyClassGenerator generator;\n\n    /**\n     * Setter invoked by OSGi Service Component Runtime.\n     *\n     * @param generator generator service\n     */\n    public void setGenerator(DeltaSpikeProxyClassGenerator generator)\n    {\n        this.generator = generator;\n    }\n    \n    /**\n     * Looks up a unique service implementation.\n     *\n     * @return ProxyClassGenerator service\n     */\n    public static DeltaSpikeProxyClassGenerator lookup()\n    {\n        if (generator == null)\n        {\n            List<DeltaSpikeProxyClassGenerator> proxyClassGeneratorList =\n                    ServiceUtils.loadServiceImplementations(DeltaSpikeProxyClassGenerator.class);\n\n            if (proxyClassGeneratorList.size() != 1)\n            {\n                throw new IllegalStateException(proxyClassGeneratorList.size()\n                    + \" implementations of \" + DeltaSpikeProxyClassGenerator.class.getName()\n                    + \" found. Expected exactly one implementation.\");\n            }\n\n            generator = proxyClassGeneratorList.get(0);\n        }\n\n        return generator;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/invocation/DeltaSpikeProxyInterceptorLookup.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi.invocation;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InterceptionType;\nimport jakarta.enterprise.inject.spi.Interceptor;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\n\n/**\n * Utility which stores the information about configured interceptors for each method.\n */\n@ApplicationScoped\npublic class DeltaSpikeProxyInterceptorLookup\n{\n    private final Map<Method, List<Interceptor<?>>> cache = new HashMap<>();\n    \n    public List<Interceptor<?>> lookup(Object instance, Method method)\n    {\n        List<Interceptor<?>> interceptors = cache.get(method);\n        \n        if (interceptors == null)\n        {\n            interceptors = resolveInterceptors(instance, method);\n            cache.put(method, interceptors);\n        }\n        \n        return interceptors;\n    }\n    \n    private List<Interceptor<?>> resolveInterceptors(Object instance, Method method)\n    {\n        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n        \n        Annotation[] interceptorBindings = extractInterceptorBindings(beanManager, instance, method);\n        if (interceptorBindings.length > 0)\n        {\n            return beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, interceptorBindings);\n        }\n\n        return new ArrayList<>();\n    }\n\n    private Annotation[] extractInterceptorBindings(BeanManager beanManager, Object instance, Method method)\n    {\n        ArrayList<Annotation> bindings = new ArrayList<>();\n\n        addInterceptorBindings(beanManager, bindings, instance.getClass().getDeclaredAnnotations());\n        addInterceptorBindings(beanManager, bindings, method.getDeclaredAnnotations());\n\n        return bindings.toArray(new Annotation[bindings.size()]);\n    }\n    \n    private void addInterceptorBindings(BeanManager beanManager, ArrayList<Annotation> bindings,\n            Annotation[] declaredAnnotations)\n    {\n        for (Annotation annotation : declaredAnnotations)\n        {\n            if (bindings.contains(annotation))\n            {\n                continue;\n            }\n            \n            Class<? extends Annotation> annotationType = annotation.annotationType();\n            \n            if (beanManager.isInterceptorBinding(annotationType))\n            {\n                bindings.add(annotation);\n            }\n            \n            if (beanManager.isStereotype(annotationType))\n            {\n                for (Annotation subAnnotation : annotationType.getDeclaredAnnotations())\n                {                    \n                    if (bindings.contains(subAnnotation))\n                    {\n                        continue;\n                    }\n\n                    if (beanManager.isInterceptorBinding(subAnnotation.annotationType()))\n                    {\n                        bindings.add(subAnnotation);\n                    }  \n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/invocation/DeltaSpikeProxyInvocationContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi.invocation;\n\nimport java.lang.reflect.Method;\nimport java.util.List;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InterceptionType;\nimport jakarta.enterprise.inject.spi.Interceptor;\n\nimport org.apache.deltaspike.core.util.interceptor.AbstractInvocationContext;\n\n/**\n * {@link jakarta.interceptor.InvocationContext} implementation to support interceptor invocation\n * before proceed with the original method or delegation.\n */\n@Vetoed\npublic class DeltaSpikeProxyInvocationContext<T, H> extends AbstractInvocationContext<T>\n{\n    protected List<Interceptor<H>> interceptors;\n    protected int interceptorIndex;\n    protected DeltaSpikeProxyInvocationHandler invocationHandler;\n\n    protected BeanManager beanManager;\n\n    protected boolean proceedOriginal;\n    protected Object proceedOriginalReturnValue;\n\n    public DeltaSpikeProxyInvocationContext(DeltaSpikeProxyInvocationHandler invocationHandler,\n            BeanManager beanManager, List<Interceptor<H>> interceptors, \n            T target, Method method, Object[] parameters, Object timer)\n    {\n        super(target, method, parameters, timer);\n\n        this.invocationHandler = invocationHandler;\n        this.interceptors = interceptors;\n        this.beanManager = beanManager;\n\n        this.interceptorIndex = 0;\n    }\n\n    @Override\n    public Object proceed() throws Exception\n    {\n        if (proceedOriginal)\n        {\n            return null;\n        }\n\n        if (interceptors.size() > interceptorIndex)\n        {\n            Interceptor<H> interceptor = null;\n            CreationalContext<H> creationalContext = null;\n            H interceptorInstance = null;\n\n            try\n            {\n                interceptor = interceptors.get(interceptorIndex++);\n                creationalContext = beanManager.createCreationalContext(interceptor);\n                interceptorInstance = interceptor.create(creationalContext);\n\n                return interceptor.intercept(InterceptionType.AROUND_INVOKE, interceptorInstance, this);\n            }\n            finally\n            {\n                if (creationalContext != null)\n                {\n                    if (interceptorInstance != null && interceptor != null)\n                    {\n                        interceptor.destroy(interceptorInstance, creationalContext);\n                    }\n\n                    creationalContext.release();\n                }\n            }\n        }\n\n\n        // workaround for OWB 1.1, otherwise we could just return the proceedOriginalReturnValue here\n        try\n        {\n            proceedOriginal = true;\n            proceedOriginalReturnValue = invocationHandler.proceed(target, method, parameters);\n        }\n        catch (Exception e)\n        {\n            throw e;\n        }\n        catch (Throwable e)\n        {\n            // wrap the Throwable here as interceptors declared only \"throws Exception\"\n            throw new DeltaSpikeProxyInvocationWrapperException(e);\n        }\n\n        return proceedOriginalReturnValue;\n    }\n\n    public boolean isProceedOriginal()\n    {\n        return proceedOriginal;\n    }\n\n    public Object getProceedOriginalReturnValue()\n    {\n        return proceedOriginalReturnValue;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/invocation/DeltaSpikeProxyInvocationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi.invocation;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.List;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.Interceptor;\nimport jakarta.inject.Inject;\nimport org.apache.deltaspike.core.util.ReflectionUtils;\nimport org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory;\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxy;\n\n/**\n * The {@link InvocationHandler} which will be called directly by the proxy methods.\n * For both <code>delegateMethods</code> and <code>interceptMethods</code>\n * (See: {@link org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGenerator}).\n * \n * This {@link InvocationHandler} first executes CDI interceptors (if defined on method or class level) and\n * after that the original method or the {@link DeltaSpikeProxy#getDelegateInvocationHandler()} will be executed,\n * depending if the invoked method is a <code>intercept</code> or <code>delegate</code> method.\n */\n@ApplicationScoped\npublic class DeltaSpikeProxyInvocationHandler implements InvocationHandler\n{\n    @Inject\n    private BeanManager beanManager;\n    \n    @Inject\n    private DeltaSpikeProxyInterceptorLookup interceptorLookup;\n\n    @Override\n    public Object invoke(Object proxy, Method method, Object[] parameters) throws Throwable\n    {\n        // check if interceptors are defined, otherwise just call the original logik\n        List<Interceptor<?>> interceptors = interceptorLookup.lookup(proxy, method);\n        if (interceptors != null && !interceptors.isEmpty())\n        {\n            try\n            {\n                DeltaSpikeProxyInvocationContext invocationContext = new DeltaSpikeProxyInvocationContext(\n                        this, beanManager, interceptors, proxy, method, parameters, null);\n\n                Object returnValue = invocationContext.proceed();\n\n                if (invocationContext.isProceedOriginal())\n                {\n                    return invocationContext.getProceedOriginalReturnValue();\n                }\n\n                return returnValue;\n            }\n            catch (DeltaSpikeProxyInvocationWrapperException e)\n            {\n                throw e.getCause();\n            }\n        }\n\n        return proceed(proxy, method, parameters);\n    }\n\n    /**\n     * Calls the original method or delegates to {@link DeltaSpikeProxy#getDelegateInvocationHandler()}\n     * after invoking the interceptor chain.\n     *\n     * @param proxy The current proxy instance.\n     * @param method The current invoked method.\n     * @param parameters The method parameter.\n     * @return The original value from the original method.\n     * @throws Throwable\n     */\n    protected Object proceed(Object proxy, Method method, Object[] parameters) throws Throwable\n    {\n        DeltaSpikeProxy deltaSpikeProxy = (DeltaSpikeProxy) proxy;\n\n        if (contains(deltaSpikeProxy.getDelegateMethods(), method))\n        {\n            return deltaSpikeProxy.getDelegateInvocationHandler().invoke(proxy, method, parameters);\n        }\n        else\n        {\n            try\n            {\n                Method superAccessorMethod = DeltaSpikeProxyFactory.getSuperAccessorMethod(proxy, method);\n                return superAccessorMethod.invoke(proxy, parameters);\n            }\n            catch (InvocationTargetException e)\n            {\n                // rethrow original exception\n                throw e.getCause();\n            }\n        }\n    }\n    \n    protected boolean contains(Method[] methods, Method method)\n    {\n        if (methods == null || methods.length == 0)\n        {\n            return false;\n        }\n        \n        for (Method current : methods)\n        {\n            if (ReflectionUtils.hasSameSignature(method, current))\n            {\n                return true;\n            }\n        }\n        \n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/invocation/DeltaSpikeProxyInvocationWrapperException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.spi.invocation;\n\n/**\n * Wrapper exception to wrap and pass trough the original {@link Throwable} because\n * the {@link jakarta.interceptor.InvocationContext#proceed()} method only declares \"throws Exception\".\n */\npublic class DeltaSpikeProxyInvocationWrapperException extends Exception\n{\n    public DeltaSpikeProxyInvocationWrapperException(Throwable e)\n    {\n        super(e);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsProxyFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.util;\n\nimport java.io.Serializable;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory;\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxy;\nimport org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler;\n\npublic class EnableInterceptorsProxyFactory extends DeltaSpikeProxyFactory\n{\n    private static final EnableInterceptorsProxyFactory INSTANCE = new EnableInterceptorsProxyFactory();\n\n    private EnableInterceptorsProxyFactory()\n    {\n        \n    }\n\n    public static <T> T wrap(T obj, BeanManager beanManager)\n    {\n        if (obj == null)\n        {\n            throw new IllegalArgumentException(\"obj must not be null!\");\n        }\n        \n        // generate proxy\n        Class proxyClass = INSTANCE.getProxyClass(beanManager, obj.getClass());\n\n        // delegate method calls to our original instance from the wrapped producer method\n        EnableInterceptorsDelegate delegate = new EnableInterceptorsDelegate(obj);\n\n        try\n        {\n            // instantiate proxy\n            T proxy = (T) proxyClass.newInstance();\n            \n            DeltaSpikeProxy deltaSpikeProxy = (DeltaSpikeProxy) proxy;\n            \n            // TODO this can be optimized by caching this in a appscoped bean\n            deltaSpikeProxy.setInvocationHandler(\n                    BeanProvider.getContextualReference(DeltaSpikeProxyInvocationHandler.class));\n            deltaSpikeProxy.setDelegateInvocationHandler(delegate);\n            deltaSpikeProxy.setDelegateMethods(INSTANCE.getDelegateMethods(obj.getClass()));\n            \n            return proxy;\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Could not create proxy instance by class \" + obj.getClass(), e);\n        }\n    }\n    \n    @Override\n    protected ArrayList<Method> getDelegateMethods(Class<?> targetClass, ArrayList<Method> allMethods)\n    {\n        // the default #filterInterceptMethods filters all non-public, final and abstract methods\n        // which means actually every publich proxyable method\n        // as we need to delegate method call to the original object instance -> proxy all public methods\n        ArrayList<Method> delegateMethods = super.filterInterceptMethods(targetClass, allMethods);\n        return delegateMethods;\n    }\n\n    @Override\n    protected ArrayList<Method> filterInterceptMethods(Class<?> targetClass, ArrayList<Method> allMethods)\n    {\n        // we don't need to overwrite methods to just execute interceptors\n        // all method call are delegated to our EnableInterceptorsDelegate, to delegate to the original object instance\n        return null;\n    }\n\n    @Override\n    protected String getProxyClassSuffix()\n    {\n        return \"$$DSInterceptorProxy\";\n    }\n    \n    /**\n     * {@link InvocationHandler} to delegate every method call to an provided object instance.\n     */\n    private static class EnableInterceptorsDelegate implements InvocationHandler, Serializable\n    {\n        private final Object instance;\n\n        public EnableInterceptorsDelegate(Object instance)\n        {\n            this.instance = instance;\n        }\n\n        @Override\n        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n        {\n            return method.invoke(instance, args);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/DeltaSpikeProxyClassGeneratorHolder.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.1.0\" name=\"DeltaSpikeProxyClassGeneratorHolder\" immediate=\"true\">\n   <implementation class=\"org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGeneratorHolder\"/>\n   <reference bind=\"setGenerator\" cardinality=\"1..1\" interface=\"org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGenerator\" \n       name=\"Generator\" policy=\"static\" unbind=\"setGenerator\"/>\n</scr:component>\n"
  },
  {
    "path": "deltaspike/modules/proxy/api/src/test/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactoryTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.api;\n\nimport static org.junit.Assert.assertTrue;\n\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class DeltaSpikeProxyFactoryTest\n{\n    public static class DeltaSpikeProxyFactoryForCollectTest extends DeltaSpikeProxyFactory\n    {\n        @Override\n        protected ArrayList<Method> getDelegateMethods(Class<?> targetClass, ArrayList<Method> allMethods)\n        {\n            return null;\n        }\n\n        @Override\n        protected String getProxyClassSuffix()\n        {\n            return null;\n        }\n\n        public ArrayList<Method> collectAllMethodsDelegate(Class<?> clazz)\n        {\n           return collectAllMethods(clazz); \n        }\n    }\n    \n    private DeltaSpikeProxyFactoryForCollectTest proxyFactory;\n\n    @Before\n    public void setUp() throws Exception\n    {\n        proxyFactory = new DeltaSpikeProxyFactoryForCollectTest();\n    }\n\n    public class Class_NonAbstract\n    {\n        public void test()\n        {\n        }\n    }\n    \n    public abstract class Class_NonAbstractToAbstract extends Class_NonAbstract\n    {\n        public abstract void test();\n    }\n\n    public abstract static class Class_C1\n    {\n        protected abstract void protectedAbstract_C1_C2(); // will be overridden in Class_C2\n        protected abstract void protectedAbstract_C1_C3(); // will be overridden in Class_C3\n        protected abstract void protectedAbstract_C1_C2_C3(); // will be overridden in Class_C2, Class_C3\n        protected abstract void protectedAbstract_C1(); // will not be overridden\n        \n        public abstract void publicAbstract_C1_C2(); // will be overridden in Class_C2\n        public abstract void publicAbstract_C1_C3(); // will be overridden in Class_C3\n        public abstract void publicAbstract_C1_C2_C3(); // will be overridden in Class_C2, Class_C3\n        public abstract void publicAbstract_C1(); // will not be overriden at all\n       \n        public void test(List l) { }\n    }\n    \n    public abstract static class Class_C2 extends Class_C1\n    {\n        protected void protectedAbstract_C1_C2() // Leave in Class_C2\n        {\n        }\n        \n        public void publicAbstract_C1_C2() // Leave in Class_C2\n        {\n        }\n        \n        protected abstract void protectedAbstract_C2_C3(); // will be overridden in Class_C3 \n        protected abstract void protectedAbstract_C2(); // will not  be overridden\n        \n        public abstract void publicAbstract_C2_C3(); // will be overridden in Class_C3\n        public abstract void publicAbstract_C2(); // will not  be overridden\n        \n        public abstract void test(List list);\n    }\n    \n    public abstract static class Class_C3 extends Class_C2\n    {\n        public void protectedAbstract_C1_C3()\n        {\n        }\n        \n        public void publicAbstract_C1_C3()\n        {\n        }\n        \n        public void protectedAbstract_C2_C3()\n        {\n        }\n        \n        public void publicAbstract_C2_C3()\n        {\n        }\n    }\n    \n    private boolean containsMethod(List<Method> collectedMethods, Class<?> declaringClass, String methodName)\n    {\n        for(Method m: collectedMethods)\n        {\n            if (m.getDeclaringClass() == declaringClass && methodName.equals(m.getName()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n    \n    private void printCollectedMethods(List<Method> collectedMethods)\n    {\n        for(Method m: collectedMethods)\n        {\n            if (m.getDeclaringClass() != Object.class)\n            {\n                System.out.println(m.getDeclaringClass().getName() + \" \" + m.getName());\n            }\n        }\n    }\n    \n    @Test\n    public void testCollection_NonAbstractToAbstract()\n    {\n        ArrayList<Method> collectedMethods = proxyFactory.collectAllMethods(Class_NonAbstractToAbstract.class);\n        printCollectedMethods(collectedMethods);\n    }\n    \n    @Test\n    public void testMethCollection_C1()\n    {\n        ArrayList<Method> collectedMethods = proxyFactory.collectAllMethods(Class_C1.class);\n        // System.out.println(\"testCollectitOn0\");\n        // printCollectedMethods(collectedMethods);\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1\"));\n        \n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1\"));\n    }\n    \n    @Test\n    public void testMethCollection_C2()\n    {\n        ArrayList<Method> collectedMethods = proxyFactory.collectAllMethods(Class_C2.class);\n        // System.out.println(\"testMethCollection_C2\");\n        // printCollectedMethods(collectedMethods);\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"protectedAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1\"));\n        \n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"publicAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"publicAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1\"));\n    \n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"protectedAbstract_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"protectedAbstract_C2\"));\n        \n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"publicAbstract_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"publicAbstract_C2\"));\n    }\n    \n\n    @Test\n    public void testMethCollection_C3()\n    {\n        ArrayList<Method> collectedMethods = proxyFactory.collectAllMethods(Class_C3.class);\n        // System.out.println(\"testCollectitOn02\");\n        // printCollectedMethods(collectedMethods);\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"protectedAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C3.class, \"protectedAbstract_C1_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"protectedAbstract_C1\"));\n        \n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"publicAbstract_C1_C2\"));\n        assertTrue(containsMethod(collectedMethods, Class_C3.class, \"publicAbstract_C1_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C1.class, \"publicAbstract_C1\"));\n        \n        assertTrue(containsMethod(collectedMethods, Class_C3.class, \"protectedAbstract_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"protectedAbstract_C2\"));\n        \n        assertTrue(containsMethod(collectedMethods, Class_C3.class, \"publicAbstract_C2_C3\"));\n        assertTrue(containsMethod(collectedMethods, Class_C2.class, \"publicAbstract_C2\"));\n        \n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>proxy-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>deltaspike-proxy-module-impl-asm</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Proxy-Module Impl ASM</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.proxy.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-shade-plugin</artifactId>\n                <version>3.2.1</version>\n                <executions>\n                    <execution>\n                        <id>shade-asm</id>\n                        <phase>package</phase>\n                        <goals>\n                            <goal>shade</goal>\n                        </goals>\n                        <configuration>\n                            <shadedArtifactAttached>false</shadedArtifactAttached>\n                            <createDependencyReducedPom>false</createDependencyReducedPom>\n                            <promoteTransitiveDependencies>true</promoteTransitiveDependencies>\n                            <relocations>\n                                <relocation>\n                                    <pattern>org.objectweb.asm</pattern>\n                                    <shadedPattern>org.apache.deltaspike.proxy.asm</shadedPattern>\n                                </relocation>\n                            </relocations>\n                            <artifactSet>\n                                <includes>\n                                    <include>org.ow2.asm:asm</include>\n                                    <include>org.ow2.asm:asm-commons</include>\n                                    <include>org.ow2.asm:asm-tree</include>\n                                </includes>\n                            </artifactSet>\n                        </configuration>\n                    </execution>\n                </executions>\n                <dependencies>\n                    <dependency>\n                        <groupId>org.ow2.asm</groupId>\n                        <artifactId>asm</artifactId>\n                        <version>${asm.version}</version>\n                    </dependency>\n                    <dependency>\n                        <groupId>org.ow2.asm</groupId>\n                        <artifactId>asm-commons</artifactId>\n                        <version>${asm.version}</version>\n                    </dependency>\n                </dependencies>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.felix</groupId>\n                <artifactId>maven-bundle-plugin</artifactId>\n                <configuration>\n                    <instructions>\n                        <Service-Component>OSGI-INF/*</Service-Component>\n                    </instructions>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-proxy-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.ow2.asm</groupId>\n            <artifactId>asm</artifactId>\n            <version>${asm.version}</version>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.ow2.asm</groupId>\n            <artifactId>asm-commons</artifactId>\n            <version>${asm.version}</version>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.ow2.asm</groupId>\n            <artifactId>asm-tree</artifactId>\n            <version>${asm.version}</version>\n            <optional>true</optional>\n        </dependency>\n\n        <!-- Allows to easily create beans.xml files with certain content -->\n        <dependency>\n            <groupId>org.jboss.shrinkwrap.descriptors</groupId>\n            <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/main/java/org/apache/deltaspike/proxy/impl/AsmDeltaSpikeProxyClassGenerator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxy;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.UndeclaredThrowableException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\nimport jakarta.enterprise.inject.Vetoed;\n\nimport org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler;\nimport org.objectweb.asm.AnnotationVisitor;\nimport org.objectweb.asm.ClassReader;\nimport org.objectweb.asm.ClassVisitor;\nimport org.objectweb.asm.ClassWriter;\nimport org.objectweb.asm.Label;\nimport org.objectweb.asm.Opcodes;\nimport org.objectweb.asm.Type;\nimport org.objectweb.asm.commons.GeneratorAdapter;\nimport org.objectweb.asm.commons.Method;\nimport org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGenerator;\n\n@Vetoed\npublic class AsmDeltaSpikeProxyClassGenerator implements DeltaSpikeProxyClassGenerator\n{\n    private static final String FIELDNAME_INVOCATION_HANDLER = \"invocationHandler\";\n    private static final String FIELDNAME_DELEGATE_INVOCATION_HANDLER = \"delegateInvocationHandler\";\n    private static final String FIELDNAME_DELEGATE_METHODS = \"delegateMethods\";\n\n    private static final Type TYPE_CLASS = Type.getType(Class.class);\n    private static final Type TYPE_OBJECT = Type.getType(Object.class);\n    private static final Type TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER =\n            Type.getType(DeltaSpikeProxyInvocationHandler.class);\n    private static final Type TYPE_METHOD_ARRAY = Type.getType(java.lang.reflect.Method[].class);\n    private static final Type TYPE_INVOCATION_HANDLER = Type.getType(InvocationHandler.class);\n\n    @Override\n    public <T> Class<T> generateProxyClass(ClassLoader classLoader,\n            Class<T> targetClass,\n            String suffix,\n            String superAccessorMethodSuffix,\n            Class<?>[] additionalInterfaces,\n            java.lang.reflect.Method[] delegateMethods,\n            java.lang.reflect.Method[] interceptMethods)\n    {\n        String proxyName = targetClass.getName() + suffix;\n        String classFileName = proxyName.replace('.', '/');\n\n        byte[] proxyBytes = generateProxyClassBytes(targetClass,\n                classFileName, superAccessorMethodSuffix, additionalInterfaces, delegateMethods, interceptMethods);\n\n        Class<T> proxyClass = (Class<T>) ClassDefiner.defineClass(classLoader, proxyName, proxyBytes,\n                targetClass, targetClass.getProtectionDomain());\n\n        return proxyClass;\n    }\n\n    private static byte[] generateProxyClassBytes(Class<?> targetClass,\n            String proxyName,\n            String superAccessorMethodSuffix,\n            Class<?>[] additionalInterfaces,\n            java.lang.reflect.Method[] delegateMethods,\n            java.lang.reflect.Method[] interceptMethods)\n    {\n        Class<?> superClass = targetClass;\n        String[] interfaces = new String[] { };\n\n        if (targetClass.isInterface())\n        {\n            superClass = Object.class;\n            interfaces = new String[] { Type.getInternalName(targetClass) };\n        }\n\n        // add DeltaSpikeProxy as interface\n        interfaces = Arrays.copyOf(interfaces, interfaces.length + 1);\n        interfaces[interfaces.length - 1] = Type.getInternalName(DeltaSpikeProxy.class);\n\n        if (additionalInterfaces != null && additionalInterfaces.length > 0)\n        {\n            interfaces = Arrays.copyOf(interfaces, interfaces.length + additionalInterfaces.length);\n            for (int i = 0; i < additionalInterfaces.length; i++)\n            {\n                interfaces[(interfaces.length - 1) + i] = Type.getInternalName(additionalInterfaces[i]);\n            }\n        }\n\n        Type superType = Type.getType(superClass);\n        Type proxyType = Type.getObjectType(proxyName);\n\n        final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);\n        cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, proxyType.getInternalName(), null,\n                superType.getInternalName(), interfaces);\n\n        \n        defineDefaultConstructor(cw, proxyType, superType);\n        defineDeltaSpikeProxyFields(cw);\n        defineDeltaSpikeProxyMethods(cw, proxyType);\n\n        if (delegateMethods != null)\n        {\n            for (java.lang.reflect.Method method : delegateMethods)\n            {\n                defineMethod(cw, method, proxyType);\n            }\n        }\n\n        if (interceptMethods != null)\n        {\n            for (java.lang.reflect.Method method : interceptMethods)\n            {\n                defineSuperAccessorMethod(cw, method, superType, superAccessorMethodSuffix);\n                defineMethod(cw, method, proxyType);\n            }\n        }\n\n        // copy all annotations from the source class\n        try\n        {\n            // ClassVisitor to intercept all annotation visits on the class\n            ClassVisitor cv = new ClassVisitor(Opcodes.ASM7)\n            {\n                @Override\n                public AnnotationVisitor visitAnnotation(String desc, boolean visible)\n                {\n                    return new CopyAnnotationVisitorAdapter(\n                            super.visitAnnotation(desc, visible),\n                            cw.visitAnnotation(desc, visible));\n                }\n            };\n\n            // visit class to proxy with our visitor to copy all annotations from the source class to our ClassWriter\n            String sourceClassFilename = targetClass.getName().replace('.', '/') + \".class\";\n            ClassReader cr = new ClassReader(targetClass.getClassLoader().getResourceAsStream(sourceClassFilename));\n            cr.accept(cv, 0);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n\n        return cw.toByteArray();\n    }\n    \n    private static void defineDefaultConstructor(ClassWriter cw, Type proxyType, Type superType)\n    {\n        GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC,\n                new Method(\"<init>\", Type.VOID_TYPE, new Type[]{ }),\n                null,\n                null,\n                cw);\n\n        mg.visitCode();\n\n        // invoke super constructor\n        mg.loadThis();\n        mg.invokeConstructor(superType, Method.getMethod(\"void <init> ()\"));\n        mg.returnValue();\n        mg.endMethod();\n\n        mg.visitEnd();\n    }\n    \n    private static void defineDeltaSpikeProxyFields(ClassWriter cw)\n    {\n        // generates\n        // private DeltaSpikeProxyInvocationHandler invocationHandler;\n        cw.visitField(Opcodes.ACC_PRIVATE, FIELDNAME_INVOCATION_HANDLER,\n                TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER.getDescriptor(), null, null).visitEnd();\n        \n        // generates\n        // private MyInvocationHandler delegateInvocationHandler;\n        cw.visitField(Opcodes.ACC_PRIVATE, FIELDNAME_DELEGATE_INVOCATION_HANDLER,\n                TYPE_INVOCATION_HANDLER.getDescriptor(), null, null).visitEnd();\n        \n        // generates\n        // private Method[] delegateMethods;\n        cw.visitField(Opcodes.ACC_PRIVATE, FIELDNAME_DELEGATE_METHODS,\n                TYPE_METHOD_ARRAY.getDescriptor(), null, null).visitEnd();\n    }\n\n    private static void defineDeltaSpikeProxyMethods(ClassWriter cw, Type proxyType)\n    {\n        try\n        {\n            // implement #setInvocationHandler\n            Method asmMethod = Method.getMethod(DeltaSpikeProxy.class.getDeclaredMethod(\n                    \"setInvocationHandler\", DeltaSpikeProxyInvocationHandler.class));\n            GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);\n\n            mg.visitCode();\n\n            mg.loadThis();\n            mg.loadArg(0);\n            mg.checkCast(TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER);\n            mg.putField(proxyType, FIELDNAME_INVOCATION_HANDLER, TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER);\n            mg.returnValue();\n\n            mg.visitMaxs(2, 1);\n            mg.visitEnd();\n\n\n            // implement #getInvocationHandler\n            asmMethod = Method.getMethod(DeltaSpikeProxy.class.getDeclaredMethod(\"getInvocationHandler\"));\n            mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);\n\n            mg.visitCode();\n\n            mg.loadThis();\n            mg.getField(proxyType, FIELDNAME_INVOCATION_HANDLER, TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER);\n            mg.returnValue();\n\n            mg.visitMaxs(2, 1);\n            mg.visitEnd();\n            \n            \n            \n            \n            // implement #setDelegateInvocationHandler\n            asmMethod = Method.getMethod(DeltaSpikeProxy.class.getDeclaredMethod(\n                    \"setDelegateInvocationHandler\", InvocationHandler.class));\n            mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);\n\n            mg.visitCode();\n\n            mg.loadThis();\n            mg.loadArg(0);\n            mg.checkCast(TYPE_INVOCATION_HANDLER);\n            mg.putField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, TYPE_INVOCATION_HANDLER);\n            mg.returnValue();\n\n            mg.visitMaxs(2, 1);\n            mg.visitEnd();\n\n\n            // implement #getDelegateInvocationHandler\n            asmMethod = Method.getMethod(DeltaSpikeProxy.class.getDeclaredMethod(\"getDelegateInvocationHandler\"));\n            mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);\n\n            mg.visitCode();\n\n            mg.loadThis();\n            mg.getField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, TYPE_INVOCATION_HANDLER);\n            mg.returnValue();\n\n            mg.visitMaxs(2, 1);\n            mg.visitEnd();\n            \n            \n            \n            \n            // implement #setDelegateMethods\n            asmMethod = Method.getMethod(DeltaSpikeProxy.class.getDeclaredMethod(\n                    \"setDelegateMethods\", java.lang.reflect.Method[].class));\n            mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);\n\n            mg.visitCode();\n\n            mg.loadThis();\n            mg.loadArg(0);\n            mg.checkCast(TYPE_METHOD_ARRAY);\n            mg.putField(proxyType, FIELDNAME_DELEGATE_METHODS, TYPE_METHOD_ARRAY);\n            mg.returnValue();\n\n            mg.visitMaxs(2, 1);\n            mg.visitEnd();\n\n\n            // implement #getDelegateMethods\n            asmMethod = Method.getMethod(DeltaSpikeProxy.class.getDeclaredMethod(\"getDelegateMethods\"));\n            mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);\n\n            mg.visitCode();\n\n            mg.loadThis();\n            mg.getField(proxyType, FIELDNAME_DELEGATE_METHODS, TYPE_METHOD_ARRAY);\n            mg.returnValue();\n\n            mg.visitMaxs(2, 1);\n            mg.visitEnd();\n        }\n        catch (NoSuchMethodException e)\n        {\n            throw new IllegalStateException(\"Unable to implement \" + DeltaSpikeProxy.class.getName(), e);\n        }\n    }\n\n    private static void defineSuperAccessorMethod(ClassWriter cw, java.lang.reflect.Method method, Type superType,\n            String superAccessorMethodSuffix) \n    {\n        Method originalAsmMethod = Method.getMethod(method);\n        Method newAsmMethod = new Method(method.getName() + superAccessorMethodSuffix,\n                originalAsmMethod.getReturnType(),\n                originalAsmMethod.getArgumentTypes());\n        GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, newAsmMethod, null, null, cw);\n        \n        mg.visitCode();\n        \n        // call super method\n        mg.loadThis();\n        mg.loadArgs();\n        mg.visitMethodInsn(Opcodes.INVOKESPECIAL,\n                superType.getInternalName(),\n                method.getName(),\n                Type.getMethodDescriptor(method),\n                false);\n        mg.returnValue();\n        \n        // finish the method\n        mg.endMethod();\n        mg.visitMaxs(10, 10);\n        mg.visitEnd();\n    }\n    \n    private static void defineMethod(ClassWriter cw, java.lang.reflect.Method method, Type proxyType)\n    {\n        Type methodType = Type.getType(method);\n        \n        ArrayList<Type> exceptionsToCatch = new ArrayList<Type>();\n        for (Class<?> exception : method.getExceptionTypes())\n        {\n            if (!RuntimeException.class.isAssignableFrom(exception))\n            {\n                exceptionsToCatch.add(Type.getType(exception));\n            }\n        }\n        \n        // push the method definition\n        int modifiers = (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED) & method.getModifiers();\n        Method asmMethod = Method.getMethod(method);\n        GeneratorAdapter mg = new GeneratorAdapter(modifiers,\n                asmMethod,\n                null,\n                getTypes(method.getExceptionTypes()),\n                cw);\n\n        // copy annotations\n        for (Annotation annotation : method.getDeclaredAnnotations())\n        {\n            mg.visitAnnotation(Type.getDescriptor(annotation.annotationType()), true).visitEnd();\n        }\n\n        mg.visitCode();\n\n        Label tryBlockStart = mg.mark();\n\n        mg.loadThis();\n        mg.getField(proxyType, FIELDNAME_INVOCATION_HANDLER, TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER);\n        mg.loadThis();\n        loadCurrentMethod(mg, method, methodType);\n        loadArguments(mg, method, methodType);\n        \n        mg.invokeVirtual(TYPE_DELTA_SPIKE_PROXY_INVOCATION_HANDLER,\n                Method.getMethod(\"Object invoke(Object, java.lang.reflect.Method, Object[])\"));\n\n        // cast the result\n        mg.unbox(methodType.getReturnType());\n\n        // build try catch\n        Label tryBlockEnd = mg.mark();\n        \n        // push return\n        mg.returnValue();\n\n        // catch runtime exceptions and rethrow it\n        Label rethrow = mg.mark();\n        mg.visitVarInsn(Opcodes.ASTORE, 1);\n        mg.visitVarInsn(Opcodes.ALOAD, 1);\n        mg.throwException();\n        mg.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrow, Type.getInternalName(RuntimeException.class));\n\n        // catch checked exceptions and rethrow it\n        boolean throwableCatched = false;\n        if (!exceptionsToCatch.isEmpty())\n        {\n            rethrow = mg.mark();\n            mg.visitVarInsn(Opcodes.ASTORE, 1);\n            mg.visitVarInsn(Opcodes.ALOAD, 1);\n            mg.throwException();\n\n            // catch declared exceptions and rethrow it...\n            for (Type exceptionType : exceptionsToCatch)\n            {\n                if (exceptionType.getClassName().equals(Throwable.class.getName()))\n                {\n                    throwableCatched = true;\n                }\n                mg.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrow, exceptionType.getInternalName());\n            }\n        }\n\n        // if throwable isn't alreached cachted, catch it and wrap it with an UndeclaredThrowableException and throw it\n        if (!throwableCatched)\n        {\n            Type uteType = Type.getType(UndeclaredThrowableException.class);\n            Label wrapAndRethrow = mg.mark();\n\n            mg.visitVarInsn(Opcodes.ASTORE, 1);\n            mg.newInstance(uteType);\n            mg.dup();\n            mg.visitVarInsn(Opcodes.ALOAD, 1);\n            mg.invokeConstructor(uteType,\n                    Method.getMethod(\"void <init>(java.lang.Throwable)\"));\n            mg.throwException();\n\n            mg.visitTryCatchBlock(tryBlockStart, tryBlockEnd, wrapAndRethrow, Type.getInternalName(Throwable.class));\n        }\n\n        // finish the method\n        mg.endMethod();\n        mg.visitMaxs(12, 12);\n        mg.visitEnd();\n    }\n\n    /**\n     * Generates:\n     * <pre>\n     * Method method =\n     *      method.getDeclaringClass().getMethod(\"methodName\", new Class[] { args... });\n     * </pre>\n     * @param mg\n     * @param method\n     * @param methodType\n     */\n    private static void loadCurrentMethod(GeneratorAdapter mg, java.lang.reflect.Method method, Type methodType)\n    {\n        mg.push(Type.getType(method.getDeclaringClass()));\n        mg.push(method.getName());\n\n        // create the Class[]\n        mg.push(methodType.getArgumentTypes().length);\n        mg.newArray(TYPE_CLASS);\n\n        // push parameters into array\n        for (int i = 0; i < methodType.getArgumentTypes().length; i++)\n        {\n            // keep copy of array on stack\n            mg.dup();\n\n            // push index onto stack\n            mg.push(i);\n            mg.push(methodType.getArgumentTypes()[i]);\n            mg.arrayStore(TYPE_CLASS);\n        }\n\n        // invoke getMethod() with the method name and the array of types\n        mg.invokeVirtual(TYPE_CLASS, Method.getMethod(\"java.lang.reflect.Method getDeclaredMethod(String, Class[])\"));\n    }\n\n    /**\n     * Defines a new Object[] and push all method argmuments into the array.\n     *\n     * @param mg\n     * @param method\n     * @param methodType\n     */\n    private static void loadArguments(GeneratorAdapter mg, java.lang.reflect.Method method, Type methodType)\n    {\n        // create the Object[]\n        mg.push(methodType.getArgumentTypes().length);\n        mg.newArray(TYPE_OBJECT);\n\n        // push parameters into array\n        for (int i = 0; i < methodType.getArgumentTypes().length; i++)\n        {\n            // keep copy of array on stack\n            mg.dup();\n\n            // push index onto stack\n            mg.push(i);\n\n            mg.loadArg(i);\n            mg.valueOf(methodType.getArgumentTypes()[i]);\n            mg.arrayStore(TYPE_OBJECT);\n        }\n    }\n\n    private static Type[] getTypes(Class<?>... src)\n    {\n        Type[] result = new Type[src.length];\n        for (int i = 0; i < result.length; i++)\n        {\n            result[i] = Type.getType(src[i]);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/main/java/org/apache/deltaspike/proxy/impl/ClassDefiner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport java.lang.invoke.MethodHandles;\nimport java.lang.reflect.Method;\nimport java.security.ProtectionDomain;\n\nclass ClassDefiner\n{\n    private static final Method CLASS_LOADER_DEFINE_CLASS;\n    private static final Method GET_MODULE;\n    private static final Method CAN_READ;\n    private static final Method ADD_READS;\n    private static final Method PRIVATE_LOOKUP_IN;\n    private static final Method DEFINE_CLASS;\n\n    static\n    {\n        Method classLoaderDefineClass = null;\n        try\n        {\n            java.lang.reflect.Method method = ClassLoader.class.getDeclaredMethod(\n                \"defineClass\", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);\n            method.setAccessible(true);\n            classLoaderDefineClass = method;\n        }\n        catch (Exception ex)\n        {\n            // Ignore\n        }\n        CLASS_LOADER_DEFINE_CLASS = classLoaderDefineClass;\n\n        Method getModule = null;\n        Method canRead = null;\n        Method addReads = null;\n        Method privateLookupIn = null;\n        Method defineClass = null;\n        try\n        {\n            getModule = Class.class.getMethod(\"getModule\");\n            Class<?> moduleClass = getModule.getReturnType();\n            canRead = moduleClass.getMethod(\"canRead\", moduleClass);\n            addReads = moduleClass.getMethod(\"addReads\", moduleClass);\n            privateLookupIn = MethodHandles.class.getMethod(\"privateLookupIn\", Class.class, MethodHandles.Lookup.class);\n            defineClass = MethodHandles.Lookup.class.getMethod(\"defineClass\", byte[].class);\n        }\n        catch (Exception ex)\n        {\n            // Ignore\n        }\n        GET_MODULE = getModule;\n        CAN_READ = canRead;\n        ADD_READS = addReads;\n        PRIVATE_LOOKUP_IN = privateLookupIn;\n        DEFINE_CLASS = defineClass;\n    }\n\n    private ClassDefiner()\n    {\n\n    }\n\n    static Class<?> defineClass(ClassLoader loader, String className, byte[] b,\n            Class<?> originalClass, ProtectionDomain protectionDomain)\n    {\n        if (CLASS_LOADER_DEFINE_CLASS == null)\n        {\n            return defineClassMethodHandles(loader, className, b, originalClass, protectionDomain);\n        }\n        else\n        {\n            return defineClassClassLoader(loader, className, b, originalClass, protectionDomain);\n        }\n    }\n    /**\n     * Adapted from http://asm.ow2.org/doc/faq.html#Q5\n     *\n     * @param b\n     *\n     * @return Class<?>\n     */\n    static Class<?> defineClassClassLoader(ClassLoader loader, String className, byte[] b,\n                                Class<?> originalClass, ProtectionDomain protectionDomain)\n    {\n        try\n        {\n            return (Class<?>) CLASS_LOADER_DEFINE_CLASS.invoke(\n                loader, className, b, Integer.valueOf(0), Integer.valueOf(b.length), protectionDomain);\n        }\n        catch (Exception e)\n        {\n            throw e instanceof RuntimeException ? ((RuntimeException) e) : new RuntimeException(e);\n        }\n    }\n\n    /**\n     * Implementation based on MethodHandles.Lookup.\n     *\n     * @return Class<?>\n     */\n    static Class<?> defineClassMethodHandles(ClassLoader loader, String className, byte[] b,\n                                             Class<?> originalClass, ProtectionDomain protectionDomain)\n    {\n        try\n        {\n            Object thisModule = GET_MODULE.invoke(AsmDeltaSpikeProxyClassGenerator.class);\n            Object lookupClassModule = GET_MODULE.invoke(originalClass);\n            if (!(boolean) CAN_READ.invoke(thisModule, lookupClassModule))\n            {\n                // we need to read the other module in order to have privateLookup access\n                // see javadoc for MethodHandles.privateLookupIn()\n                ADD_READS.invoke(thisModule, lookupClassModule);\n            }\n            Object lookup = PRIVATE_LOOKUP_IN.invoke(null, originalClass, MethodHandles.lookup());\n            return (Class<?>) DEFINE_CLASS.invoke(lookup, b);\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n//    static Class<?> defineClassMethodHandles(ClassLoader loader, String className, byte[] b,\n//                                Class<?> originalClass, ProtectionDomain protectionDomain)\n//    {\n//        Module thisModule = AsmDeltaSpikeProxyClassGenerator.class.getModule();\n//        try\n//        {\n//            Module lookupClassModule = originalClass.getModule();\n//            if (!thisModule.canRead(lookupClassModule))\n//            {\n//                // we need to read the other module in order to have privateLookup access\n//                // see javadoc for MethodHandles.privateLookupIn()\n//                thisModule.addReads(lookupClassModule);\n//            }\n//            MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(originalClass, MethodHandles.lookup());\n//            return lookup.defineClass(b);\n//        }\n//        catch (IllegalAccessException e)\n//        {\n//            throw new RuntimeException(e);\n//        }\n//    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/main/java/org/apache/deltaspike/proxy/impl/CopyAnnotationVisitorAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport org.objectweb.asm.AnnotationVisitor;\nimport org.objectweb.asm.Opcodes;\n\npublic class CopyAnnotationVisitorAdapter extends AnnotationVisitor\n{\n    private final AnnotationVisitor from;\n    private final AnnotationVisitor to;\n\n    public CopyAnnotationVisitorAdapter(AnnotationVisitor from, AnnotationVisitor copyTo)\n    {\n        super(Opcodes.ASM7);\n\n        this.from = from;\n        this.to = copyTo;\n    }\n\n    @Override\n    public void visit(String name, Object value)\n    {\n        if (from != null)\n        {\n            from.visit(name, value);\n        }\n        to.visit(name, value);\n    }\n\n    @Override\n    public void visitEnum(String name, String desc, String value)\n    {\n        if (from != null)\n        {\n            from.visitEnum(name, desc, value);\n        }\n        to.visitEnum(name, desc, value);\n    }\n\n    @Override\n    public AnnotationVisitor visitAnnotation(String name, String desc)\n    {\n        if (from == null)\n        {\n            return new CopyAnnotationVisitorAdapter(\n                    null,\n                    to.visitAnnotation(name, desc));\n        }\n\n        return new CopyAnnotationVisitorAdapter(\n                from.visitAnnotation(name, desc),\n                to.visitAnnotation(name, desc));\n    }\n\n    @Override\n    public AnnotationVisitor visitArray(String name)\n    {\n        if (from == null)\n        {\n            return new CopyAnnotationVisitorAdapter(\n                    null,\n                    to.visitArray(name));\n        }\n\n        return new CopyAnnotationVisitorAdapter(\n                from.visitArray(name),\n                to.visitArray(name));\n    }\n\n    @Override\n    public void visitEnd()\n    {\n        if (from != null)\n        {\n            from.visitEnd();\n        }\n        to.visitEnd();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/main/resources/META-INF/services/org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGenerator",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.proxy.impl.AsmDeltaSpikeProxyClassGenerator"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/main/resources/OSGI-INF/AsmDeltaSpikeProxyClassGenerator.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.1.0\" name=\"AsmDeltaSpikeProxyClassGenerator\">\n   <implementation class=\"org.apache.deltaspike.proxy.impl.AsmDeltaSpikeProxyClassGenerator\"/>\n   <service>\n      <provide interface=\"org.apache.deltaspike.proxy.spi.DeltaSpikeProxyClassGenerator\"/>\n   </service>\n</scr:component>\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/test/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGeneratorTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport jakarta.inject.Named;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\n\npublic class AsmProxyClassGeneratorTest\n{\n    private static Class<? extends TestClass> proxyClass;\n    \n    @BeforeClass\n    public static void init()\n    {\n        AsmDeltaSpikeProxyClassGenerator asmProxyClassGenerator = new AsmDeltaSpikeProxyClassGenerator();\n        proxyClass = asmProxyClassGenerator.generateProxyClass(TestClass.class.getClassLoader(),\n                TestClass.class,\n                \"$Test\",\n                \"$super\",\n                null,\n                null,\n                null); \n    }\n    \n    @Test\n    public void testCopyAnnotationValues()\n    {\n        Assert.assertEquals(\n                TestClass.class.getAnnotations().length,\n                proxyClass.getAnnotations().length);\n        \n        Assert.assertEquals(\n                TestClass.class.getAnnotation(Named.class).value(),\n                proxyClass.getAnnotation(Named.class).value());\n        \n        Assert.assertEquals(\n                TestClass.class.getAnnotation(TestAnnotation.class).value1(),\n                proxyClass.getAnnotation(TestAnnotation.class).value1());\n        Assert.assertEquals(\n                TestClass.class.getAnnotation(TestAnnotation.class).value2(),\n                proxyClass.getAnnotation(TestAnnotation.class).value2());\n        Assert.assertEquals(\n                TestClass.class.getAnnotation(TestAnnotation.class).value3(),\n                proxyClass.getAnnotation(TestAnnotation.class).value3());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/test/java/org/apache/deltaspike/proxy/impl/TestAnnotation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n@Documented\n@Retention(value = RetentionPolicy.RUNTIME)\npublic @interface TestAnnotation\n{\n    int value1() default 13;\n    \n    Class value2() default TestAnnotation.class;\n    \n    String value3() default \"tester\";\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/test/java/org/apache/deltaspike/proxy/impl/TestClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport jakarta.inject.Named;\n\n@Named(\"test\")\n@TestAnnotation(value2 = TestClass.class, value1 = 15)\npublic class TestClass\n{\n    \n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/test/java/org/apache/deltaspike/proxy/impl/TestInvocationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.proxy.impl;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\n\npublic class TestInvocationHandler implements InvocationHandler\n{\n    @Override\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/impl-asm/src/test/java/org/apache/deltaspike/test/proxy/impl/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.proxy.impl.util;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\npublic abstract class ArchiveUtils\n{\n    private ArchiveUtils()\n    {\n    }\n\n    public static JavaArchive[] getDeltaSpikeCoreAndProxyArchive()\n    {\n        ArrayList<JavaArchive> result = new ArrayList<JavaArchive>();\n\n        JavaArchive[] temp;\n\n        temp = ShrinkWrapArchiveUtil.getArchives(null,\n                \"META-INF/beans.xml\",\n                new String[] { \"org.apache.deltaspike.core\",\n                        \"org.apache.deltaspike.proxy\",\n                        \"org.apache.deltaspike.test.category\"},\n                new String[] { \"META-INF.apache-deltaspike.properties\" },\n                \"ds-core_and_proxy\");\n        result.addAll(Arrays.asList(temp));\n\n        // add asm - it isn't shaded yet in the test phase\n        result.add(ShrinkWrap.create(JavaArchive.class, \"ds-asm.jar\")\n                    .addPackages(true, \"org.objectweb.asm\"));\n\n        return result.toArray(new JavaArchive[result.size()]);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/proxy/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>proxy-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Proxy-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl-asm</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/scheduler/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>scheduler-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-scheduler-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Scheduler-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.scheduler.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.enterprise.inject,\n            !org.apache.deltaspike.scheduler.*,\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/scheduler/api/src/main/java/org/apache/deltaspike/scheduler/api/Scheduled.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.api;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ TYPE })\n@Retention(RUNTIME)\n@Documented\npublic @interface Scheduled\n{\n    String cronExpression();\n\n    boolean overrideOnStartup() default false; //'true' triggers a re-schedule if the job exists already\n\n    Class<? extends Annotation>[] startScopes() default { SessionScoped.class, RequestScoped.class };\n\n    Class group() default Scheduled.class; //type-safe group\n\n    String description() default \"\";\n\n    boolean onStartup() default true; //use false to schedule it manually (after the bootstrapping-process)\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/api/src/main/java/org/apache/deltaspike/scheduler/spi/Scheduler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.spi;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\npublic interface Scheduler<T> extends Deactivatable\n{\n    void start();\n\n    void stop();\n\n    void pauseJob(Class<? extends T> jobClass);\n\n    void resumeJob(Class<? extends T> jobClass);\n\n    void interruptJob(Class<? extends T> jobClass);\n\n    boolean deleteJob(Class<? extends T> jobClass);\n\n    boolean isExecutingJob(Class<? extends T> jobClass);\n\n    void registerNewJob(Class<? extends T> jobClass);\n\n    void startJobManually(Class<? extends T> jobClass);\n\n    <S> S unwrap(Class<? extends S> schedulerClass);\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/api/src/main/java/org/apache/deltaspike/scheduler/spi/SchedulerControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.spi;\n\n/**\n * This interface provides high-level controls for the scheduler.\n *\n * It allows to control the scheduler as a whole ({@link #isSchedulerEnabled()}()) and on a per-job basis\n * ({@link #vetoJobExecution(Class)}.\n *\n * The interface is meant to be implemented by a CDI bean.\n */\npublic interface SchedulerControl\n{\n    /**\n     * Control whether or not the scheduler should be started.\n     *\n     * @return if {@code true} the scheduler will be started, else not.\n     */\n    default boolean isSchedulerEnabled()\n    {\n        return true;\n    }\n\n    /**\n     * Invoked each time a job is triggered, this controls whether the given job shall be started or not.\n     *\n     * NOTE: This only applies if the scheduler is actually running (see {@link #isSchedulerEnabled()}).\n     *\n     *  @param jobClass the job which was triggered\n     * @return if {@code false} the job will be executed, else not.\n     */\n    default boolean vetoJobExecution(Class<?> jobClass)\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>scheduler-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-scheduler-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Scheduler-Module Impl</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.scheduler.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.scheduler.impl.*,\n            *\n        </deltaspike.osgi.import>\n        <shrinkwrap.version>3.2.1</shrinkwrap.version>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>org.jboss.shrinkwrap.resolver</groupId>\n                <artifactId>shrinkwrap-resolver-bom</artifactId>\n                <version>${shrinkwrap.version}</version>\n                <type>pom</type>\n                <scope>import</scope>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-scheduler-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.quartz-scheduler</groupId>\n            <artifactId>quartz</artifactId>\n            <version>2.3.2</version>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.el</groupId>\n            <artifactId>jakarta.el-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>test</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.jboss.shrinkwrap.resolver</groupId>\n            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n\n    <profiles>\n        <profile>\n            <id>OWB</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-owb</artifactId>\n                    <version>${project.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n        <profile>\n            <id>Weld</id>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-weld</artifactId>\n                    <version>${project.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.jboss.weld.se</groupId>\n                    <artifactId>weld-se-core</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/AbstractJobAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.scheduler.spi.SchedulerControl;\nimport org.quartz.Job;\nimport org.quartz.JobExecutionContext;\nimport org.quartz.JobExecutionException;\n\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\npublic abstract class AbstractJobAdapter<T> implements Job\n{\n    private static final Logger LOG = Logger.getLogger(AbstractJobAdapter.class.getName());\n\n    @Inject\n    private BeanManager beanManager;\n\n    @Override\n    public void execute(JobExecutionContext context)\n    {\n        Class<? extends T> jobClass =\n                ClassUtils.tryToLoadClassForName(context.getJobDetail().getKey().getName(), getJobBaseClass());\n\n        SchedulerControl schedulerControl = BeanProvider.getContextualReference(SchedulerControl.class, true);\n        if (schedulerControl != null && schedulerControl.vetoJobExecution(jobClass))\n        {\n            LOG.info(\"Execution of job \" + jobClass + \" has been vetoed by \" +\n                    ProxyUtils.getUnproxiedClass(schedulerControl.getClass()));\n            return;\n        }\n\n        T job = BeanProvider.getContextualReference(jobClass);\n\n        try\n        {\n            execute(job, context);\n        }\n        catch (Throwable t)\n        {\n            LOG.log(Level.SEVERE, \"Error while executing job \" + jobClass, t);\n        }\n    }\n\n    protected abstract Class<T> getJobBaseClass();\n\n    public abstract void execute(T job, JobExecutionContext context) throws JobExecutionException;\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/AbstractQuartzScheduler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.api.provider.DependentProvider;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.core.util.PropertyFileUtils;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.scheduler.api.Scheduled;\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\nimport org.quartz.CronScheduleBuilder;\nimport org.quartz.Job;\nimport org.quartz.JobBuilder;\nimport org.quartz.JobDetail;\nimport org.quartz.JobExecutionContext;\nimport org.quartz.JobExecutionException;\nimport org.quartz.JobKey;\nimport org.quartz.JobListener;\nimport org.quartz.SchedulerException;\nimport org.quartz.SchedulerFactory;\nimport org.quartz.Trigger;\nimport org.quartz.TriggerBuilder;\nimport org.quartz.impl.StdSchedulerFactory;\n\nimport java.io.InputStream;\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Enumeration;\nimport java.util.List;\nimport java.util.Properties;\nimport java.util.ResourceBundle;\nimport java.util.Stack;\nimport java.util.UUID;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\npublic abstract class AbstractQuartzScheduler<T> implements Scheduler<T>\n{\n    private static final Logger LOG = Logger.getLogger(AbstractQuartzScheduler.class.getName());\n    private static final Scheduled DEFAULT_SCHEDULED_LITERAL = AnnotationInstanceProvider.of(Scheduled.class);\n\n    private static ThreadLocal<JobListenerContext> currentJobListenerContext = new ThreadLocal<JobListenerContext>();\n\n    protected org.quartz.Scheduler scheduler;\n\n    @Override\n    public void start()\n    {\n        if (this.scheduler != null)\n        {\n            throw new UnsupportedOperationException(\"the scheduler is started already\");\n        }\n\n        SchedulerFactory schedulerFactory = null;\n        try\n        {\n            Properties properties = new Properties();\n            properties.put(StdSchedulerFactory.PROP_SCHED_JOB_FACTORY_CLASS, CdiAwareJobFactory.class.getName());\n\n            try\n            {\n                ResourceBundle config = loadCustomQuartzConfig();\n\n                Enumeration<String> keys = config.getKeys();\n                String key;\n                while (keys.hasMoreElements())\n                {\n                    key = keys.nextElement();\n                    properties.put(key, config.getString(key));\n                }\n            }\n            catch (Exception e1)\n            {\n                LOG.info(\"no custom quartz-config file found. falling back to the default config provided by quartz.\");\n\n                InputStream inputStream = null;\n                try\n                {\n                    inputStream = ClassUtils.getClassLoader(null).getResourceAsStream(\"org/quartz/quartz.properties\");\n                    properties.load(inputStream);\n                }\n                catch (Exception e2)\n                {\n                    LOG.warning(\"failed to load quartz default-config\");\n                    schedulerFactory = new StdSchedulerFactory();\n                }\n                finally\n                {\n                    if (inputStream != null)\n                    {\n                        inputStream.close();\n                    }\n                }\n            }\n            if (schedulerFactory == null)\n            {\n                schedulerFactory = new StdSchedulerFactory(properties);\n            }\n        }\n        catch (Exception e)\n        {\n            LOG.log(Level.WARNING, \"fallback to default scheduler-factory\", e);\n            schedulerFactory = new StdSchedulerFactory();\n        }\n\n        try\n        {\n            this.scheduler = schedulerFactory.getScheduler();\n            if (SchedulerBaseConfig.LifecycleIntegration.START_SCOPES_PER_JOB)\n            {\n                this.scheduler.getListenerManager().addJobListener(new InjectionAwareJobListener());\n            }\n            if (!this.scheduler.isStarted())\n            {\n                this.scheduler.startDelayed(SchedulerBaseConfig.LifecycleIntegration.DELAYED_START_IN_SECONDS);\n            }\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    protected ResourceBundle loadCustomQuartzConfig()\n    {\n        //don't use quartz.properties as default-value\n        String configFile = SchedulerBaseConfig.SCHEDULER_CONFIG_FILE;\n        return PropertyFileUtils.getResourceBundle(configFile);\n    }\n\n    @Override\n    public void stop()\n    {\n        try\n        {\n            if (this.scheduler != null && this.scheduler.isStarted())\n            {\n                this.scheduler.shutdown(!SchedulerBaseConfig.LifecycleIntegration.FORCE_STOP);\n                this.scheduler = null;\n            }\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    @Override\n    public void registerNewJob(Class<? extends T> jobClass)\n    {\n        JobKey jobKey = createJobKey(jobClass);\n\n        try\n        {\n            Scheduled scheduled = jobClass.getAnnotation(Scheduled.class);\n\n            String description = scheduled.description();\n\n            if (\"\".equals(scheduled.description()))\n            {\n                description = jobClass.getName();\n            }\n\n            JobDetail jobDetail = this.scheduler.getJobDetail(jobKey);\n            Trigger trigger;\n\n            if (jobDetail == null)\n            {\n                Class<? extends Job> jobClassToAdd = createFinalJobClass(jobClass);\n                jobDetail = JobBuilder.newJob(jobClassToAdd)\n                        .withDescription(description)\n                        .withIdentity(jobKey)\n                        .build();\n\n                scheduleNewJob(scheduled, jobKey, jobDetail);\n            }\n            else if (scheduled.overrideOnStartup())\n            {\n                List<? extends Trigger> existingTriggers = this.scheduler.getTriggersOfJob(jobKey);\n\n                if (existingTriggers == null || existingTriggers.isEmpty())\n                {\n                    scheduleNewJob(scheduled, jobKey, jobDetail);\n                    return;\n                }\n\n                if (existingTriggers.size() > 1)\n                {\n                    throw new IllegalStateException(\"multiple triggers found for \" + jobKey + \" ('\" + jobDetail + \"')\" +\n                        \", but aren't supported by @\" + Scheduled.class.getName() + \"#overrideOnStartup\");\n                }\n\n                trigger = existingTriggers.iterator().next();\n\n                if (scheduled.cronExpression().startsWith(\"{\") && scheduled.cronExpression().endsWith(\"}\"))\n                {\n                    this.scheduler.unscheduleJobs(Arrays.asList(trigger.getKey()));\n\n                    scheduleNewJob(scheduled, jobKey, jobDetail);\n                }\n                else\n                {\n                    trigger = TriggerBuilder.newTrigger()\n                            .withIdentity(trigger.getKey())\n                            .withSchedule(CronScheduleBuilder.cronSchedule(scheduled.cronExpression()))\n                            .build();\n\n                    this.scheduler.rescheduleJob(trigger.getKey(), trigger);\n                }\n            }\n            else\n            {\n                Logger.getLogger(AbstractQuartzScheduler.class.getName()).info(\n                    jobKey + \" exists already and will be ignored.\");\n            }\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    private void scheduleNewJob(Scheduled scheduled, JobKey jobKey, JobDetail jobDetail) throws SchedulerException\n    {\n        String cronExpression = evaluateExpression(scheduled);\n        this.scheduler.scheduleJob(jobDetail, createTrigger(scheduled, jobKey, cronExpression));\n    }\n\n    private Trigger createTrigger(Scheduled scheduled, JobKey jobKey, String cronExpression) throws SchedulerException\n    {\n        UUID triggerKey = UUID.randomUUID();\n\n        if (!scheduled.cronExpression().endsWith(cronExpression))\n        {\n            createExpressionObserverJob(jobKey, triggerKey, scheduled.cronExpression(), cronExpression);\n        }\n\n        Trigger trigger = TriggerBuilder.newTrigger()\n                .forJob(jobKey)\n                .withIdentity(triggerKey.toString())\n                .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression))\n                .build();\n        return trigger;\n    }\n\n    private void createExpressionObserverJob(\n        JobKey jobKey, UUID triggerKey, String configExpression, String cronExpression) throws SchedulerException\n    {\n        if (!ClassDeactivationUtils.isActivated(DynamicExpressionObserverJob.class))\n        {\n            return;\n        }\n\n        JobKey observerJobKey =\n                new JobKey(jobKey.getName() + DynamicExpressionObserverJob.OBSERVER_POSTFIX, jobKey.getGroup());\n\n        JobDetail jobDetail  = JobBuilder.newJob(DynamicExpressionObserverJob.class)\n                .usingJobData(DynamicExpressionObserverJob.CONFIG_EXPRESSION_KEY, configExpression)\n                .usingJobData(DynamicExpressionObserverJob.TRIGGER_ID_KEY, triggerKey.toString())\n                .usingJobData(DynamicExpressionObserverJob.ACTIVE_CRON_EXPRESSION_KEY, cronExpression)\n                .withDescription(\"Config observer for: \" + jobKey)\n                .withIdentity(observerJobKey)\n                .build();\n\n        Trigger trigger = TriggerBuilder.newTrigger()\n                .forJob(observerJobKey)\n                .withSchedule(CronScheduleBuilder.cronSchedule(\n                    SchedulerBaseConfig.JobCustomization.DYNAMIC_EXPRESSION_OBSERVER_INTERVAL))\n                .build();\n\n        this.scheduler.scheduleJob(jobDetail, trigger);\n    }\n\n    private String evaluateExpression(Scheduled scheduled)\n    {\n        String expression = scheduled.cronExpression();\n\n        if (expression.startsWith(\"{\") && expression.endsWith(\"}\"))\n        {\n            String configKey = expression.substring(1, expression.length() - 1);\n            expression = ConfigResolver.getProjectStageAwarePropertyValue(configKey, null);\n\n            if (expression == null)\n            {\n                throw new IllegalStateException(\"No config-value found for config-key: \" + configKey);\n            }\n        }\n        return expression;\n    }\n\n    protected abstract Class<? extends Job> createFinalJobClass(Class<? extends T> jobClass);\n\n    @Override\n    public void startJobManually(Class<? extends T> jobClass)\n    {\n        try\n        {\n            this.scheduler.triggerJob(createJobKey(jobClass));\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    @Override\n    public void interruptJob(Class<? extends T> jobClass)\n    {\n        try\n        {\n            this.scheduler.interrupt(createJobKey(jobClass));\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean deleteJob(Class<? extends T> jobClass)\n    {\n        try\n        {\n            return this.scheduler.deleteJob(createJobKey(jobClass));\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    @Override\n    public void pauseJob(Class<? extends T> jobClass)\n    {\n        try\n        {\n            this.scheduler.pauseJob(createJobKey(jobClass));\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    @Override\n    public void resumeJob(Class<? extends T> jobClass)\n    {\n        try\n        {\n            this.scheduler.resumeJob(createJobKey(jobClass));\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean isExecutingJob(Class<? extends T> jobClass)\n    {\n        try\n        {\n            JobKey jobKey = createJobKey(jobClass);\n            JobDetail jobDetail = this.scheduler.getJobDetail(jobKey);\n\n            if (jobDetail == null)\n            {\n                return false;\n            }\n\n            for (JobExecutionContext jobExecutionContext : this.scheduler.getCurrentlyExecutingJobs())\n            {\n                if (jobKey.equals(jobExecutionContext.getJobDetail().getKey()))\n                {\n                    return true;\n                }\n            }\n\n            return false;\n        }\n        catch (SchedulerException e)\n        {\n            throw ExceptionUtils.throwAsRuntimeException(e);\n        }\n    }\n\n    private JobKey createJobKey(Class<?> jobClass)\n    {\n        Scheduled scheduled = jobClass.getAnnotation(Scheduled.class);\n\n        if (scheduled == null)\n        {\n            throw new IllegalStateException(\"@\" + Scheduled.class.getName() + \" is missing on \" + jobClass.getName());\n        }\n\n        String groupName = scheduled.group().getSimpleName();\n        String jobName = getJobName(jobClass);\n\n        if (!Scheduled.class.getSimpleName().equals(groupName))\n        {\n            return new JobKey(jobName, groupName);\n        }\n        return new JobKey(jobName);\n    }\n\n    protected String getJobName(Class<?> jobClass)\n    {\n        return jobClass.getSimpleName();\n    }\n\n    private class InjectionAwareJobListener implements JobListener\n    {\n        @Override\n        public String getName()\n        {\n            return getClass().getName();\n        }\n\n        @Override\n        public void jobToBeExecuted(JobExecutionContext jobExecutionContext)\n        {\n            Class<?> jobClass = ProxyUtils.getUnproxiedClass(jobExecutionContext.getJobInstance().getClass());\n            Scheduled scheduled = jobClass.getAnnotation(Scheduled.class);\n\n            //can happen with manually registered job-instances (via #unwrap)\n            if (scheduled == null && !jobClass.equals(DynamicExpressionObserverJob.class))\n            {\n                scheduled = DEFAULT_SCHEDULED_LITERAL;\n            }\n\n            if (scheduled == null)\n            {\n                return;\n            }\n\n            JobListenerContext jobListenerContext = new JobListenerContext();\n            currentJobListenerContext.set(jobListenerContext);\n            jobListenerContext.startContexts(scheduled);\n\n            boolean jobInstanceIsBean;\n\n            try\n            {\n                jobInstanceIsBean =\n                    Boolean.TRUE.equals(jobExecutionContext.getScheduler().getContext().get(jobClass.getName()));\n            }\n            catch (SchedulerException e)\n            {\n                jobInstanceIsBean = false;\n            }\n\n            if (!jobInstanceIsBean)\n            {\n                BeanProvider.injectFields(jobExecutionContext.getJobInstance());\n            }\n        }\n\n        @Override\n        public void jobExecutionVetoed(JobExecutionContext context)\n        {\n            stopStartedScopes();\n        }\n\n        @Override\n        public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException)\n        {\n            stopStartedScopes();\n        }\n\n        private void stopStartedScopes()\n        {\n            JobListenerContext jobListenerContext = currentJobListenerContext.get();\n            if (jobListenerContext != null)\n            {\n                jobListenerContext.stopStartedScopes();\n                currentJobListenerContext.set(null);\n                currentJobListenerContext.remove();\n            }\n        }\n    }\n\n    private static class JobListenerContext\n    {\n        private Stack<Class<? extends Annotation>> scopes = new Stack<Class<? extends Annotation>>();\n        private DependentProvider<ContextControl> contextControl;\n\n        public void startContexts(Scheduled scheduled)\n        {\n            Collections.addAll(this.scopes, scheduled.startScopes());\n\n            if (!this.scopes.isEmpty())\n            {\n                this.contextControl = BeanProvider.getDependent(ContextControl.class);\n\n                for (Class<? extends Annotation> scopeAnnotation : this.scopes)\n                {\n                    contextControl.get().startContext(scopeAnnotation);\n                }\n            }\n        }\n\n        private void stopStartedScopes()\n        {\n            if (this.contextControl == null)\n            {\n                return;\n            }\n\n            while (!this.scopes.empty())\n            {\n                this.contextControl.get().stopContext(this.scopes.pop());\n            }\n            this.contextControl.destroy();\n        }\n    }\n\n    @Override\n    public <S> S unwrap(Class<? extends S> schedulerClass)\n    {\n        if (schedulerClass.isAssignableFrom(this.scheduler.getClass()))\n        {\n            return (S)this.scheduler;\n        }\n\n        throw new IllegalArgumentException(schedulerClass.getName() +\n            \" isn't compatible with \" + this.scheduler.getClass().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/CdiAwareJobFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.quartz.Job;\nimport org.quartz.Scheduler;\nimport org.quartz.SchedulerException;\nimport org.quartz.spi.JobFactory;\nimport org.quartz.spi.TriggerFiredBundle;\n\npublic class CdiAwareJobFactory implements JobFactory\n{\n    private final JobFactory defaultFactory;\n\n    public CdiAwareJobFactory()\n    {\n        String defaultJobFactoryName = SchedulerBaseConfig.JobCustomization.DEFAULT_JOB_FACTORY_CLASS_NAME;\n\n        defaultFactory = ClassUtils.tryToInstantiateClassForName(defaultJobFactoryName, JobFactory.class);\n    }\n\n    @Override\n    public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException\n    {\n        Job result = null;\n        try\n        {\n            Class<? extends Job> jobClass = bundle.getJobDetail().getJobClass();\n            result = BeanProvider.getContextualReference(jobClass);\n            scheduler.getContext().put(jobClass.getName(), Boolean.TRUE);\n        }\n        catch (Exception e)\n        {\n            if (result == null)\n            {\n                result = defaultFactory.newJob(bundle, scheduler);\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/DynamicExpressionObserverJob.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\nimport org.quartz.CronScheduleBuilder;\nimport org.quartz.DisallowConcurrentExecution;\nimport org.quartz.Job;\nimport org.quartz.JobDataMap;\nimport org.quartz.JobExecutionContext;\nimport org.quartz.JobExecutionException;\nimport org.quartz.JobKey;\nimport org.quartz.PersistJobDataAfterExecution;\nimport org.quartz.SchedulerException;\nimport org.quartz.Trigger;\nimport org.quartz.TriggerBuilder;\n\nimport jakarta.inject.Inject;\nimport java.util.logging.Logger;\n\n/**\n * This job is only active, if configurable cron-expressions are used - e.g.: @Scheduled(cronExpression = \"{myKey}\").\n * It observes jobs with configurable cron-expressions and updates their job-triggers once a config-change was detected.\n * Per default this job gets executed once per minute. That can be changed via config-entry:\n * deltaspike.scheduler.dynamic-expression.observer-interval=[any valid cron-expression]\n */\n@DisallowConcurrentExecution\n@PersistJobDataAfterExecution\npublic class DynamicExpressionObserverJob implements Deactivatable, Job\n{\n    static final String CONFIG_EXPRESSION_KEY = \"ds_configExpression\";\n    static final String ACTIVE_CRON_EXPRESSION_KEY = \"ds_activeCronExpression\";\n    static final String TRIGGER_ID_KEY = \"ds_triggerKey\";\n    static final String OBSERVER_POSTFIX = \"_observer\";\n\n    private static final Logger LOG = Logger.getLogger(DynamicExpressionObserverJob.class.getName());\n\n    @Inject\n    private Scheduler<Job> scheduler;\n\n    @Override\n    public void execute(JobExecutionContext context) throws JobExecutionException\n    {\n        JobDataMap jobDataMap = context.getMergedJobDataMap();\n        String configExpression = jobDataMap.getString(CONFIG_EXPRESSION_KEY);\n        String triggerId = jobDataMap.getString(TRIGGER_ID_KEY);\n        String activeCronExpression = jobDataMap.getString(ACTIVE_CRON_EXPRESSION_KEY);\n\n        String configKey = configExpression.substring(1, configExpression.length() - 1);\n        String configuredValue = ConfigResolver.getPropertyAwarePropertyValue(configKey, activeCronExpression);\n\n        if (!activeCronExpression.equals(configuredValue))\n        {\n            //both #put calls are needed currently\n            context.getJobDetail().getJobDataMap().put(ACTIVE_CRON_EXPRESSION_KEY, configuredValue);\n            context.getTrigger().getJobDataMap().put(ACTIVE_CRON_EXPRESSION_KEY, configuredValue);\n\n            BeanProvider.injectFields(this);\n\n            JobKey observerJobKey = context.getJobDetail().getKey();\n            String observedJobName = observerJobKey.getName()\n                .substring(0, observerJobKey.getName().length() - OBSERVER_POSTFIX.length());\n            JobKey observedJobKey = new JobKey(observedJobName, observerJobKey.getGroup());\n\n            Trigger trigger = TriggerBuilder.newTrigger()\n                    .withIdentity(triggerId)\n                    .forJob(observedJobName, observedJobKey.getGroup())\n                    .withSchedule(CronScheduleBuilder.cronSchedule(configuredValue))\n                    .build();\n\n            //use rescheduleJob instead of delete + add\n            //(unwrap is ok here, because this class will only get active in case of a quartz-scheduler)\n            org.quartz.Scheduler quartzScheduler = scheduler.unwrap(org.quartz.Scheduler.class);\n            try\n            {\n                quartzScheduler.rescheduleJob(trigger.getKey(), trigger);\n            }\n            catch (SchedulerException e)\n            {\n                LOG.warning(\"failed to updated cron-expression for \" + observedJobKey);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/JobAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.quartz.Job;\nimport org.quartz.JobExecutionContext;\nimport org.quartz.JobExecutionException;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n//configured via SchedulerBaseConfig\n@Vetoed\npublic class JobAdapter extends AbstractJobAdapter<Job>\n{\n    @Override\n    protected Class<Job> getJobBaseClass()\n    {\n        return Job.class;\n    }\n\n    @Override\n    public void execute(Job job, JobExecutionContext context) throws JobExecutionException\n    {\n        job.execute(context);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/JobQuartzScheduler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.quartz.Job;\n\n//vetoed class (see SchedulerExtension)\npublic class JobQuartzScheduler extends AbstractQuartzScheduler<Job>\n{\n    @Override\n    protected String getJobName(Class<?> jobClass)\n    {\n        return jobClass.getName();\n    }\n\n    @Override\n    protected Class<? extends Job> createFinalJobClass(Class<? extends Job> jobClass)\n    {\n        return JobAdapter.class;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/JobRunnableAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.quartz.JobExecutionContext;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n//configured via SchedulerBaseConfig\n@Vetoed\npublic class JobRunnableAdapter extends AbstractJobAdapter<Runnable>\n{\n    @Override\n    protected Class<Runnable> getJobBaseClass()\n    {\n        return Runnable.class;\n    }\n\n    @Override\n    public void execute(Runnable job, JobExecutionContext context)\n    {\n        job.run();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/QuartzSchedulerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\nimport org.quartz.Job;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.inject.Produces;\n\n@Alternative\npublic class QuartzSchedulerProducer extends SchedulerProducer\n{\n    @Produces\n    @ApplicationScoped\n    protected Scheduler<Job> produceScheduler()\n    {\n        return super.produceScheduler();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/RunnableQuartzScheduler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.quartz.Job;\n\n//vetoed class (see SchedulerExtension)\npublic class RunnableQuartzScheduler extends AbstractQuartzScheduler<Runnable>\n{\n    private Class<? extends Job> runnableAdapter;\n\n    @Override\n    public void start()\n    {\n        String configuredAdapterClassName = SchedulerBaseConfig.JobCustomization.RUNNABLE_ADAPTER_CLASS_NAME;\n        this.runnableAdapter = ClassUtils.tryToLoadClassForName(configuredAdapterClassName, Job.class);\n\n        super.start();\n    }\n\n    @Override\n    protected String getJobName(Class<?> jobClass)\n    {\n        return jobClass.getName();\n    }\n\n    @Override\n    protected Class<? extends Job> createFinalJobClass(Class<? extends Runnable> jobClass)\n    {\n        return runnableAdapter;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig;\n\n//keep it in the impl. module for now, because it's mainly quartz specific config\npublic interface SchedulerBaseConfig extends DeltaSpikeBaseConfig\n{\n    interface JobCustomization\n    {\n        String JOB_CLASS_NAME_KEY = \"deltaspike.scheduler.job-class\";\n        String RUNNABLE_ADAPTER_CLASS_NAME_KEY = \"deltaspike.scheduler.runnable-adapter-class\";\n        String DYNAMIC_EXPRESSION_OBSERVER_INTERVAL_KEY =\n            \"deltaspike.scheduler.dynamic-expression.observer-interval\";\n\n        //don't type it to class to keep quartz optional\n        String DEFAULT_JOB_FACTORY_CLASS_NAME = ConfigResolver.resolve(\"deltaspike.scheduler.DefaultJobFactory\")\n                .withCurrentProjectStage(true)\n                .withDefault(\"org.quartz.simpl.PropertySettingJobFactory\")\n                .getValue();\n\n        //don't type it to class to keep quartz optional\n        String JOB_CLASS_NAME = ConfigResolver.resolve(JOB_CLASS_NAME_KEY)\n                .withCurrentProjectStage(true)\n                .withDefault(\"org.quartz.Job\")\n                .getValue();\n\n        //don't type it to class to keep quartz optional (JobRunnableAdapter imports classes from quartz)\n        String RUNNABLE_ADAPTER_CLASS_NAME = ConfigResolver.resolve(RUNNABLE_ADAPTER_CLASS_NAME_KEY)\n                .withCurrentProjectStage(true)\n                .withDefault(\"org.apache.deltaspike.scheduler.impl.JobRunnableAdapter\")\n                .getValue();\n\n        String DYNAMIC_EXPRESSION_OBSERVER_INTERVAL =\n                ConfigResolver.resolve(DYNAMIC_EXPRESSION_OBSERVER_INTERVAL_KEY)\n                .withCurrentProjectStage(true)\n                .withDefault(\"0 0/1 * * * ?\")\n                .getValue();\n    }\n\n    String SCHEDULER_CONFIG_FILE = ConfigResolver.resolve(\"deltaspike.scheduler.quartz_config-file\")\n            .withCurrentProjectStage(true)\n            .withDefault(\"quartz\")\n            .getValue();\n\n    interface LifecycleIntegration\n    {\n        String START_SCOPES_PER_JOB_KEY = \"deltaspike.scheduler.start_scopes_for_jobs\";\n\n        Boolean START_SCOPES_PER_JOB = ConfigResolver.resolve(START_SCOPES_PER_JOB_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.TRUE)\n                .getValue();\n\n        Boolean FORCE_STOP = ConfigResolver.resolve(\"deltaspike.scheduler.force_stop\")\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        Integer DELAYED_START_IN_SECONDS = ConfigResolver.resolve(\"deltaspike.scheduler.delayed_start_in_seconds\")\n                .as(Integer.class)\n                .withCurrentProjectStage(true)\n                .withDefault(1)\n                .getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.apache.deltaspike.scheduler.api.Scheduled;\nimport org.apache.deltaspike.scheduler.spi.SchedulerControl;\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.*;\n\nimport java.lang.reflect.ParameterizedType;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\npublic class SchedulerExtension implements Extension, Deactivatable\n{\n    private static final Logger LOG = Logger.getLogger(SchedulerExtension.class.getName());\n\n    //keep it as a string (needed by some containers - due to the imports)\n    private static Set<String> classNamesToVeto = new HashSet<String>();\n\n    private Boolean isActivated = true;\n\n    private Set<Class> foundManagedJobClasses = new HashSet<Class>();\n\n    private Scheduler scheduler;\n\n    private Class jobClass;\n\n    public SchedulerExtension()\n    {\n        classNamesToVeto.add(\"org.apache.deltaspike.scheduler.impl.DynamicExpressionObserverJob\");\n    }\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        this.isActivated = ClassDeactivationUtils.isActivated(getClass());\n\n        if (this.isActivated)\n        {\n            String jobClassName = SchedulerBaseConfig.JobCustomization.JOB_CLASS_NAME;\n\n            this.jobClass = ClassUtils.tryToLoadClassForName(jobClassName);\n\n            if (this.jobClass == null)\n            {\n                this.isActivated = false;\n            }\n        }\n    }\n\n    public <X> void findScheduledJobs(@Observes ProcessAnnotatedType<X> pat, BeanManager beanManager)\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        Class<X> beanClass = pat.getAnnotatedType().getJavaClass();\n\n        //see SchedulerProducer\n        if (Scheduler.class.isAssignableFrom(beanClass) || isInternalUnmanagedClass(beanClass))\n        {\n            pat.veto();\n            return;\n        }\n\n        if (!jobClass.isAssignableFrom(beanClass) && !Runnable.class.isAssignableFrom(beanClass))\n        {\n            return;\n        }\n\n        Scheduled scheduled = pat.getAnnotatedType().getAnnotation(Scheduled.class);\n        if (scheduled != null && scheduled.onStartup())\n        {\n            this.foundManagedJobClasses.add(beanClass);\n        }\n    }\n\n    private <X> boolean isInternalUnmanagedClass(Class<X> beanClass)\n    {\n        return classNamesToVeto.contains(beanClass.getName());\n    }\n\n    public <X> void validateJobs(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        Class configuredJobClass = this.jobClass;\n\n        this.jobClass = resolveFinalJobType();\n\n        if (this.jobClass == null)\n        {\n            afterBeanDiscovery.addDefinitionError(new IllegalStateException(\"Please only annotate classes with @\" +\n                Scheduled.class.getName() + \" of type \" +\n                configuredJobClass.getName() + \" or of type \" + Runnable.class.getName() + \", but not both!\"));\n            return;\n        }\n\n    }\n\n    public <X> void scheduleJobs(@Observes AfterDeploymentValidation afterDeploymentValidation, BeanManager beanManager)\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        SchedulerControl schedulerControl = BeanProvider.getContextualReference(SchedulerControl.class, true);\n        if (schedulerControl != null && !schedulerControl.isSchedulerEnabled())\n        {\n            LOG.info(\"Scheduler has been disabled by \" + ProxyUtils.getUnproxiedClass(schedulerControl.getClass()));\n            return;\n        }\n\n        initScheduler(afterDeploymentValidation);\n\n        if (this.scheduler == null)\n        {\n            return;\n        }\n\n\n        List<String> foundJobNames = new ArrayList<String>();\n\n        for (Class jobClass : this.foundManagedJobClasses)\n        {\n            if (foundJobNames.contains(jobClass.getSimpleName()))\n            {\n                afterDeploymentValidation.addDeploymentProblem(\n                    new IllegalStateException(\"Multiple Job-Classes found with name \" + jobClass.getSimpleName()));\n            }\n\n            foundJobNames.add(jobClass.getSimpleName());\n            this.scheduler.registerNewJob(jobClass);\n        }\n    }\n\n    /**\n     * Allows to support implementations of {@link java.lang.Runnable}\n     * annotated with {@link Scheduled} >without< explicit config.\n     * @return the job-type which will be used to select the scheduler\n     */\n    protected Class resolveFinalJobType()\n    {\n        Set<Class> foundTypes = new HashSet<Class>();\n\n        for (Class foundJobClass : this.foundManagedJobClasses)\n        {\n            if (jobClass.isAssignableFrom(foundJobClass))\n            {\n                foundTypes.add(jobClass);\n            }\n            else if (Runnable.class.isAssignableFrom(foundJobClass))\n            {\n                foundTypes.add(Runnable.class);\n            }\n        }\n\n        if (foundTypes.size() > 1)\n        {\n            return null;\n        }\n        else if (foundTypes.size() == 1)\n        {\n            return foundTypes.iterator().next();\n        }\n        else\n        {\n            //use the configured type\n            //it's still useful if there is no annotated job-class, but a dyn. usage of the scheduler is still possible\n            return jobClass;\n        }\n    }\n\n    public <X> void stopScheduler(@Observes BeforeShutdown beforeShutdown)\n    {\n        if (!this.isActivated)\n        {\n            return;\n        }\n\n        if (this.scheduler != null)\n        {\n            this.scheduler.stop();\n            this.scheduler = null;\n        }\n    }\n\n    private void initScheduler(AfterDeploymentValidation afterDeploymentValidation)\n    {\n        List<Scheduler> availableSchedulers = ServiceUtils.loadServiceImplementations(Scheduler.class, true);\n\n        this.scheduler = findScheduler(availableSchedulers, this.jobClass);\n\n        if (this.scheduler != null)\n        {\n            try\n            {\n                this.scheduler.start();\n            }\n            catch (Throwable t)\n            {\n                afterDeploymentValidation.addDeploymentProblem(t);\n            }\n        }\n        else if (!this.foundManagedJobClasses.isEmpty())\n        {\n            LOG.warning(\n                this.foundManagedJobClasses.size() + \" scheduling-jobs found, but there is no configured scheduler\");\n        }\n    }\n\n    private static Scheduler findScheduler(List<Scheduler> availableSchedulers, Class jobClass)\n    {\n        for (Scheduler scheduler : availableSchedulers)\n        {\n            //in case of implementing the Scheduler interface directly\n            for (Type interfaceClass : scheduler.getClass().getGenericInterfaces())\n            {\n                if (!(interfaceClass instanceof ParameterizedType) ||\n                        !Scheduler.class.isAssignableFrom((Class)((ParameterizedType)interfaceClass).getRawType()))\n                {\n                    continue;\n                }\n\n                if (jobClass.isAssignableFrom(((Class)((ParameterizedType)interfaceClass).getActualTypeArguments()[0])))\n                {\n                    return scheduler;\n                }\n            }\n\n            //in case of extending e.g. AbstractQuartzScheduler\n            if (scheduler.getClass().getGenericSuperclass() instanceof ParameterizedType)\n            {\n                ParameterizedType parameterizedType = (ParameterizedType) scheduler.getClass().getGenericSuperclass();\n                for (Type typeArgument : parameterizedType.getActualTypeArguments())\n                {\n                    if (jobClass.isAssignableFrom((Class)typeArgument))\n                    {\n                        return scheduler;\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    Scheduler getScheduler()\n    {\n        return scheduler;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.scheduler.impl;\n\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class SchedulerProducer\n{\n    @Inject\n    private SchedulerExtension schedulerExtension;\n\n    @Produces\n    @ApplicationScoped\n    protected Scheduler produceScheduler()\n    {\n        return this.schedulerExtension.getScheduler();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.scheduler.impl.SchedulerExtension"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/main/resources/META-INF/services/org.apache.deltaspike.scheduler.spi.Scheduler",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#only one of the following schedulers will get active\n\n#default scheduler:\norg.apache.deltaspike.scheduler.impl.JobQuartzScheduler\n\n#alternative scheduler - add\n# deltaspike.scheduler.job-class=java.lang.Runnable\n#to META-INF/apache-deltaspike.properties\norg.apache.deltaspike.scheduler.impl.RunnableQuartzScheduler"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/AutoRegisteredJob.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.scheduler.api.Scheduled;\n\n@Scheduled(cronExpression = \"*/1 * * * * ?\")\npublic class AutoRegisteredJob implements CustomJob\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.scheduler.impl.SchedulerBaseConfig;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class CustomConfigSource implements ConfigSource\n{\n    private Map<String, String> config = new HashMap<String, String>()\n    {{\n        put(SchedulerBaseConfig.JobCustomization.JOB_CLASS_NAME_KEY, CustomJob.class.getName());\n        put(ClassDeactivator.class.getName(), QuartzDeactivator.class.getName());\n    }};\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1001;\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        return this.config;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return this.config.get(key);\n    }\n\n    @Override\n    public String getConfigName()\n    {\n        return \"scheduler-test-config\";\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomDeactivatedConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.scheduler.impl.SchedulerBaseConfig;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class CustomDeactivatedConfigSource implements ConfigSource\n{\n    private Map<String, String> config = new HashMap<String, String>()\n    {{\n            put(SchedulerBaseConfig.JobCustomization.JOB_CLASS_NAME_KEY, CustomJob.class.getName());\n            put(SchedulerBaseConfig.LifecycleIntegration.START_SCOPES_PER_JOB_KEY, Boolean.FALSE.toString());\n            put(ClassDeactivator.class.getName(), QuartzDeactivator.class.getName());\n    }};\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1001;\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        return this.config;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return this.config.get(key);\n    }\n\n    @Override\n    public String getConfigName()\n    {\n        return \"scheduler-test-config\";\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomJob.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\npublic interface CustomJob\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class CustomSchedulerEarFileTest extends CustomSchedulerTest\n{\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = CustomSchedulerWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsModule(CustomSchedulerWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\nimport org.junit.Test;\n\nimport jakarta.inject.Inject;\n\npublic abstract class CustomSchedulerTest\n{\n    @Inject\n    private Scheduler scheduler;\n    //workaround for weld-se - as an alternative it's possible to use:\n    /*\n    private Scheduler<CustomJob> scheduler;\n\n    @Before\n    public void init()\n    {\n        this.scheduler = BeanProvider.getContextualReference(Scheduler.class);\n    }\n    */\n\n    @Inject\n    private TestJobManager testJobManager;\n\n    @Test\n    public void checkAutoRegisteredSchedulerJob()\n    {\n        Assert.assertTrue(testJobManager.isStarted());\n        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRegisteredJobs().iterator().next());\n        Assert.assertEquals(1, testJobManager.getRunningJobs().size());\n        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRunningJobs().iterator().next());\n    }\n\n    @Test\n    public void checkManualSchedulerJobManagement()\n    {\n        Assert.assertTrue(testJobManager.isStarted());\n        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRegisteredJobs().iterator().next());\n        Assert.assertEquals(1, testJobManager.getRunningJobs().size());\n        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRunningJobs().iterator().next());\n\n        this.scheduler.registerNewJob(ManualJob.class);\n\n        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(2, testJobManager.getRunningJobs().size());\n\n        this.scheduler.interruptJob(ManualJob.class);\n        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(1, testJobManager.getRunningJobs().size());\n\n        this.scheduler.pauseJob(ManualJob.class);\n        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(1, testJobManager.getRunningJobs().size());\n\n        this.scheduler.resumeJob(ManualJob.class);\n        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(1, testJobManager.getRunningJobs().size());\n\n        this.scheduler.startJobManually(ManualJob.class);\n        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(2, testJobManager.getRunningJobs().size());\n\n        this.scheduler.interruptJob(ManualJob.class);\n        this.scheduler.pauseJob(ManualJob.class);\n\n        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(1, testJobManager.getRunningJobs().size());\n    }\n\n    @Test\n    public void checkDeleteJob() {\n\n        this.scheduler.registerNewJob(DeleteJob.class);\n        Assert.assertTrue(testJobManager.getRegisteredJobs().contains(DeleteJob.class));\n\n        this.scheduler.interruptJob(DeleteJob.class);\n        this.scheduler.deleteJob(DeleteJob.class);\n        Assert.assertFalse(testJobManager.getRegisteredJobs().contains(DeleteJob.class));\n    }\n\n    @Test\n    public void unwrap()\n    {\n        Assert.assertEquals(TestJobManager.class, this.scheduler.unwrap(TestJobManager.class).getClass());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void invalidUnwrap()\n    {\n        this.scheduler.unwrap(MockedScheduler.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.BeansXmlUtil;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.jboss.shrinkwrap.resolver.api.maven.Maven;\nimport org.junit.runner.RunWith;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class CustomSchedulerWarFileTest extends CustomSchedulerTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = CustomSchedulerWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"customSchedulerTest.jar\")\n                .addPackage(CustomSchedulerWarFileTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsResource(new StringAsset(MockedScheduler.class.getName()),\n                        \"META-INF/services/\" + Scheduler.class.getName())\n                .addAsResource(new StringAsset(CustomConfigSource.class.getName()),\n                        \"META-INF/services/\" + ConfigSource.class.getName());\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSchedulerArchive())\n                .addAsLibraries(ArchiveUtils.getContextControlForDeployment())\n                .addAsLibraries(Maven.resolver().loadPomFromFile(\"pom.xml\").resolve(\n                        \"org.quartz-scheduler:quartz\")\n                        .withTransitivity()\n                        .asFile())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/DeleteJob.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.scheduler.api.Scheduled;\n\n@Scheduled(cronExpression = \"*/1 * * * * ?\", onStartup = false)\npublic class DeleteJob implements CustomJob\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/ManualJob.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.scheduler.api.Scheduled;\n\n@Scheduled(cronExpression = \"*/1 * * * * ?\", onStartup = false)\npublic class ManualJob implements CustomJob\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/MockedScheduler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\n\npublic class MockedScheduler implements Scheduler<CustomJob>\n{\n    @Override\n    public void start()\n    {\n        TestJobManager.getInstance().start();\n    }\n\n    @Override\n    public void stop()\n    {\n        TestJobManager.getInstance().stop();\n    }\n\n    public void pauseJob(Class<? extends CustomJob> jobClass)\n    {\n        TestJobManager.getInstance().pauseJob(jobClass);\n    }\n\n    public void resumeJob(Class<? extends CustomJob> jobClass)\n    {\n        TestJobManager.getInstance().resumeJob(jobClass);\n    }\n\n    public void interruptJob(Class<? extends CustomJob> jobClass)\n    {\n        TestJobManager.getInstance().interruptJob(jobClass);\n    }\n\n    public boolean deleteJob(Class<? extends CustomJob> jobClass) {\n        return TestJobManager.getInstance().deleteJob(jobClass);\n    }\n\n    public boolean isExecutingJob(Class<? extends CustomJob> jobClass)\n    {\n        return TestJobManager.getInstance().isExecutingJob(jobClass);\n    }\n\n    public void registerNewJob(Class<? extends CustomJob> jobClass)\n    {\n        TestJobManager.getInstance().registerNewJob(jobClass);\n    }\n\n    public void startJobManually(Class<? extends CustomJob> jobClass)\n    {\n        TestJobManager.getInstance().startJobManually(jobClass);\n    }\n\n    @Override\n    public <S> S unwrap(Class<? extends S> schedulerClass)\n    {\n        if (schedulerClass.isAssignableFrom(TestJobManager.getInstance().getClass()))\n        {\n            return (S)TestJobManager.getInstance();\n        }\n\n        throw new IllegalArgumentException(schedulerClass.getName() +\n            \" isn't compatible with \" + TestJobManager.getInstance().getClass().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/QuartzDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\npublic class QuartzDeactivator implements ClassDeactivator\n{\n    private static final long serialVersionUID = 6185043496640765473L;\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        return !\"QuartzScheduler\".equals(targetClass.getSimpleName()) &&\n                !\"RunnableQuartzScheduler\".equals(targetClass.getSimpleName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/RequestScopedJob.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport org.apache.deltaspike.scheduler.api.Scheduled;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\n@Scheduled(cronExpression = \"*/1 * * * * ?\", onStartup = false)\npublic class RequestScopedJob implements CustomJob\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/ScopeNotStartedTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.scheduler.spi.Scheduler;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.apache.deltaspike.test.utils.BeansXmlUtil;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.jboss.shrinkwrap.resolver.api.maven.Maven;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\n@RunWith(Arquillian.class)\npublic class ScopeNotStartedTest\n{\n    //TODO even though this test exists, the tests in this module don't execute for quartz.\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = ScopeNotStartedTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, \"scopeNotStartedTest.jar\")\n                .addPackage(CustomSchedulerWarFileTest.class.getPackage().getName())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\")\n                .addAsResource(new StringAsset(MockedScheduler.class.getName()),\n                        \"META-INF/services/\" + Scheduler.class.getName())\n                .addAsResource(new StringAsset(CustomDeactivatedConfigSource.class.getName()),\n                        \"META-INF/services/\" + ConfigSource.class.getName());\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSchedulerArchive())\n                .addAsLibraries(ArchiveUtils.getContextControlForDeployment())\n                .addAsLibraries(Maven.resolver().loadPomFromFile(\"pom.xml\").resolve(\n                        \"org.quartz-scheduler:quartz\")\n                        .withTransitivity()\n                        .asFile())\n                .addAsLibraries(testJar)\n                .addAsWebInfResource(EmptyAsset.INSTANCE, \"beans.xml\");\n    }\n\n    @Inject\n    private Scheduler scheduler;\n\n    @Inject\n    private TestJobManager testJobManager;\n\n    @Test\n    public void testRegisterBadJob()\n    {\n        Assert.assertTrue(testJobManager.isStarted());\n\n        this.scheduler.registerNewJob(ManualJob.class);\n        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());\n        Assert.assertEquals(2, testJobManager.getRunningJobs().size());\n\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/TestJobManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.scheduler.custom;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Typed;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n\n@Typed() // This bean doesn't get vetoed because it contains producer methods. But we don't want it to be injected with this type\npublic class TestJobManager\n{\n    private static TestJobManager currentManager = new TestJobManager();\n\n    private boolean started;\n\n    private List<Class<? extends CustomJob>> registeredJobs = new ArrayList<Class<? extends CustomJob>>();\n    private List<Class<? extends CustomJob>> runningJobs = new ArrayList<Class<? extends CustomJob>>();\n\n    public static TestJobManager getInstance()\n    {\n        return currentManager;\n    }\n\n    @Produces\n    @ApplicationScoped\n    protected TestJobManager expose()\n    {\n        return currentManager;\n    }\n\n    public void start()\n    {\n        this.started = true;\n    }\n\n    public void stop()\n    {\n        currentManager = new TestJobManager();\n    }\n\n    public void pauseJob(Class<? extends CustomJob> jobClass)\n    {\n        this.registeredJobs.remove(jobClass);\n    }\n\n    public void resumeJob(Class<? extends CustomJob> jobClass)\n    {\n        this.registeredJobs.add(jobClass);\n    }\n\n    public void interruptJob(Class<? extends CustomJob> jobClass)\n    {\n        this.runningJobs.remove(jobClass);\n    }\n\n    public boolean deleteJob(Class<? extends CustomJob> jobClass)\n    {\n        return this.registeredJobs.remove(jobClass);\n    }\n\n    public boolean isExecutingJob(Class<? extends CustomJob> jobClass)\n    {\n        return this.runningJobs.contains(jobClass);\n    }\n\n    public void registerNewJob(Class<? extends CustomJob> jobClass)\n    {\n        this.registeredJobs.add(jobClass);\n        this.runningJobs.add(jobClass);\n    }\n\n    public void startJobManually(Class<? extends CustomJob> jobClass)\n    {\n        this.runningJobs.add(jobClass);\n    }\n\n    public boolean isStarted()\n    {\n        return started;\n    }\n\n    public List<Class<? extends CustomJob>> getRegisteredJobs()\n    {\n        return registeredJobs;\n    }\n\n    public List<Class<? extends CustomJob>> getRunningJobs()\n    {\n        return runningJobs;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.util;\n\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\n/**\n * This class contains helpers for building frequently used archives\n */\npublic class ArchiveUtils\n{\n    private ArchiveUtils()\n    {\n    }\n\n    public static JavaArchive[] getDeltaSpikeCoreAndSchedulerArchive()\n    {\n        return ShrinkWrapArchiveUtil.getArchives(\n                null,\n                \"META-INF/beans.xml\",\n                new String[]{\"org.apache.deltaspike.core\",\n                        \"org.apache.deltaspike.test.category\",\n                        \"org.apache.deltaspike.scheduler\"},\n                null,\n                \"ds-core_and_scheduler\");\n    }\n\n    public static JavaArchive getContextControlForDeployment()\n    {\n        JavaArchive jar = ShrinkWrap.create(JavaArchive.class, \"cdi-control.jar\")\n                .addClass(ContextControl.class);\n\n        if (CdiContainerUnderTest.is(\"owb\"))\n        {\n            jar.addPackage(\"org.apache.deltaspike.cdise.owb\");\n        }\n        return jar;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource",
    "content": "#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n\norg.apache.deltaspike.test.scheduler.custom.CustomConfigSource"
  },
  {
    "path": "deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.scheduler.spi.Scheduler",
    "content": "#####################################################################################\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#####################################################################################\n\norg.apache.deltaspike.test.scheduler.custom.MockedScheduler"
  },
  {
    "path": "deltaspike/modules/scheduler/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>scheduler-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Scheduler-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/security/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>security-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-security-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Security-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.security.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n    </dependencies>\n\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/SecurityException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.api;\n\n/**\n * Any exception that is raised by the security module extends from this runtime\n * exception class, making it easy for other modules and extensions to catch all\n * security-related exceptions in a single catch block, if need be.\n */\npublic abstract class SecurityException extends RuntimeException \n{\n    private static final long serialVersionUID = 789326682407249952L;\n\n    public SecurityException() \n    {\n        super();\n    }\n\n    public SecurityException(String message, Throwable cause) \n    {\n        super(message, cause);\n    }\n\n    public SecurityException(String message) \n    {\n        super(message);\n    }\n\n    public SecurityException(Throwable cause) \n    {\n        super(cause);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/AbstractAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Base implementation which provides helper methods.\n */\npublic abstract class AbstractAccessDecisionVoter extends AbstractDecisionVoter implements AccessDecisionVoter\n{\n    private static final long serialVersionUID = -9145021044568668681L;\n\n    /**\n     * It should be final - but proxy-libs won't support it.\n     */\n    @Override\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)\n    {\n        Set<SecurityViolation> result = new HashSet<SecurityViolation>();\n\n        checkPermission(accessDecisionVoterContext, result);\n\n        return result;\n    }\n\n    /**\n     * Allows an easier implementation in combination with {@link #newSecurityViolation(String)}.\n     *\n     * @param accessDecisionVoterContext current accessDecisionVoterContext\n     * @param violations set for adding violations\n     */\n    protected abstract void checkPermission(AccessDecisionVoterContext accessDecisionVoterContext,\n                                            Set<SecurityViolation> violations);\n}"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/AbstractDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\n/**\n * Base class for decision-voters\n */\n//can be used also for similar parts\n//e.g. for custom scopes. like it was done in CODI (see AbstractBeanCreationDecisionVoter)\npublic abstract class AbstractDecisionVoter\n{\n    /**\n     * Creates an instance of {@link SecurityViolation} for a given\n     * string which will be used as reason to describe the violation.\n     *\n     * @param reason description of the violation\n     * @return A new instance of {@link SecurityViolation}\n     * which provides details about the found restriction.\n     */\n    protected SecurityViolation newSecurityViolation(String reason)\n    {\n        return new SimpleSecurityViolation(reason);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/AccessDecisionState.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\n/**\n * State-enum for {@link AccessDecisionVoterContext}\n */\npublic enum AccessDecisionState\n{\n    INITIAL, VOTE_IN_PROGRESS, VIOLATION_FOUND, NO_VIOLATION_FOUND\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/AccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\n\nimport java.io.Serializable;\nimport java.util.Set;\n\n/**\n * Interface for implementing concrete voters.\n * A voter has to add an instance of\n * {@link SecurityViolation} to the given result-set,\n * if a restriction is detected.<p/>\n * A voter has to be used in combination with\n * {@link Secured}.<p/>\n * A voter can use every scope which is active. It's recommended to use\n * {@link jakarta.enterprise.context.ApplicationScoped} for stateless voters and e.g.\n * {@link jakarta.enterprise.context.RequestScoped} otherwise.\n */\npublic interface AccessDecisionVoter extends Serializable\n{\n    /**\n     * Checks the permission for the given {@link jakarta.interceptor.InvocationContext}.\n     * If a violation is detected, it should be added to a set which gets returned by the method.\n     *\n     * @param accessDecisionVoterContext current access-decision-voter-context\n     * @return a set which contains violations which have been detected\n     */\n    @DefaultCallback\n    Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext);\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/AccessDecisionVoterContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * Optional context which allows to get the current state as well as the results of the security check.\n * (Optional because it requires a useful scope which depends on the environment.)\n */\npublic interface AccessDecisionVoterContext\n{\n    /**\n     * Exposes the current state\n     * @return current state\n     */\n    AccessDecisionState getState();\n\n    /**\n     * Exposes the found violations\n     * @return found violations\n     */\n    List<SecurityViolation> getViolations();\n\n    /**\n     * TODO review it (this method is new)\n     * Exposes the source e.g. {@link jakarta.interceptor.InvocationContext}\n     * @return the source which triggered the\n     */\n    <T> T getSource();\n\n    /**\n     * Exposes the found meta-data\n     * @return found meta-data\n     */\n    Map<String, Object> getMetaData();\n\n    /**\n     * Exposes meta-data for the given key\n     * @param key meta-data key\n     * @param targetType target type\n     * @param <T> target type\n     * @return meta-data for the given key or null if there is no value for the given key\n     */\n    <T> T getMetaDataFor(String key, Class<T> targetType);\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/AccessDeniedException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.util.Set;\n\n/**\n * Exception occurs in case of a security-violation.\n * It's aware of the reason for the violation as well as the error-view which should be used to display the restriction.\n */\npublic class AccessDeniedException extends SecurityException\n{\n    private static final long serialVersionUID = -4066763895951237969L;\n\n    private Set<SecurityViolation> violations;\n\n    /**\n     * Constructor for creating the exception for the given violations and error-view\n     * @param violations current violations\n     */\n    public AccessDeniedException(Set<SecurityViolation> violations)\n    {\n        this.violations = violations;\n    }\n\n    /**\n     * All {@link SecurityViolation} which were found by a {@link AccessDecisionVoter}\n     *\n     * @return all security-violations\n     */\n    public Set<SecurityViolation> getViolations()\n    {\n        return violations;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/ErrorViewAwareAccessDeniedException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\n\nimport java.util.Set;\n\npublic class ErrorViewAwareAccessDeniedException extends AccessDeniedException\n{\n    private static final long serialVersionUID = 3292231690460417731L;\n\n    private final Class<? extends ViewConfig> errorView;\n\n    public ErrorViewAwareAccessDeniedException(Set<SecurityViolation> violations, Class<? extends ViewConfig> errorView)\n    {\n        super(violations);\n        this.errorView = errorView;\n    }\n\n    public Class<? extends ViewConfig> getErrorView()\n    {\n        return errorView;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/Secured.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport org.apache.deltaspike.core.api.config.view.DefaultErrorView;\nimport org.apache.deltaspike.core.api.config.view.ViewConfig;\nimport org.apache.deltaspike.core.api.config.view.metadata.ExecutableCallbackDescriptor;\nimport org.apache.deltaspike.core.api.config.view.metadata.DefaultCallback;\nimport org.apache.deltaspike.core.api.config.view.metadata.ViewMetaData;\nimport org.apache.deltaspike.core.spi.config.view.ConfigPreProcessor;\nimport org.apache.deltaspike.core.spi.config.view.ViewConfigNode;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.List;\nimport java.util.Set;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Interceptor for securing beans.\n * It's also possible to use it as meta-annotation for type-safe view-configs.\n */\n@Target({ TYPE, METHOD, ANNOTATION_TYPE })\n@Retention(RUNTIME)\n@Documented\n\n//cdi annotations\n@SecurityBindingType\n\n//don't use @Aggregated(true) - we need to support different error-pages (per folder/page)\n@ViewMetaData(preProcessor = Secured.AnnotationPreProcessor.class)\npublic @interface Secured\n{\n    /**\n     * {@link AccessDecisionVoter}s which will be invoked before accessing the intercepted instance or in case of\n     * view-configs before a view gets used.\n     *\n     * @return the configured access-decision-voters which should be used for the voting process\n     */\n    @Nonbinding\n    Class<? extends AccessDecisionVoter>[] value();\n\n    /**\n     * Optional inline error-view if it is required to show an error-page\n     * which is different from the default error page.\n     * @return type-safe view-config of the page which should be used as error-view\n     */\n    @Nonbinding\n    Class<? extends ViewConfig> errorView() default DefaultErrorView.class;\n\n    class AnnotationPreProcessor implements ConfigPreProcessor<Secured>\n    {\n        @Override\n        public Secured beforeAddToConfig(Secured metaData, ViewConfigNode viewConfigNode)\n        {\n            viewConfigNode.registerCallbackDescriptors(Secured.class, new Descriptor(metaData.value()));\n            return metaData; //no change needed\n        }\n    }\n\n    //can be used from outside to get a typed result\n    static class Descriptor extends ExecutableCallbackDescriptor<Set<SecurityViolation>>\n    {\n        public Descriptor(Class<? extends AccessDecisionVoter>[] accessDecisionVoterBeanClasses)\n        {\n            super(accessDecisionVoterBeanClasses, DefaultCallback.class);\n        }\n\n        public List<Set<SecurityViolation>> execute(AccessDecisionVoterContext accessDecisionVoterContext)\n        {\n            return super.execute(accessDecisionVoterContext);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/SecuredReturn.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks an argument of a {@link Secures} method to be the result of the secured business method invocation.\n * If present, forces the {@link Secures} check to occure after invocation of the business method.\n */\n@Target(ElementType.PARAMETER)\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface SecuredReturn \n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/Secures.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * This annotation is used to delegate a method as the provider for a specific authorization check\n */\n@Target(ElementType.METHOD)\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface Secures \n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/SecurityBindingType.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Applied to an annotation to indicate that it is a security binding type\n */\n@Target(ElementType.TYPE)\n@Retention(RetentionPolicy.RUNTIME)\n@Documented\npublic @interface SecurityBindingType \n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/SecurityDefinitionException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.api.authorization;\n\n/**\n * This exception is thrown when a security-related configuration error is detected,\n * such as a missing or ambiguous security binding type\n */\npublic class SecurityDefinitionException extends org.apache.deltaspike.security.api.SecurityException\n{\n    private static final long serialVersionUID = -5683365417825375411L;\n\n    public SecurityDefinitionException(String message) \n    {\n        super(message);\n    }\n\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public SecurityDefinitionException(Throwable cause)\n    {\n        super(cause);\n    }\n\n    public SecurityDefinitionException(String message, Throwable cause) \n    {\n        super(message, cause);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/SecurityParameterBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Applied to an {@link java.lang.annotation.Annotation} to declare it as a security parameter binding; to use business\n * method invocation values as {@link Secures} method arguments.\n */\n@Documented\n@Target({ ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface SecurityParameterBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/SecurityViolation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\nimport java.io.Serializable;\n\n/**\n * Provides the concrete reason for the restriction.\n */\npublic interface SecurityViolation extends Serializable\n{\n    /**\n     * Provides a description of the violation.\n     *\n     * @return description of the violation\n     */\n    String getReason();\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/api/authorization/SimpleSecurityViolation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.api.authorization;\n\n/**\n * Implementation which just returns the given reason\n */\nclass SimpleSecurityViolation implements SecurityViolation\n{\n    private static final long serialVersionUID = -5017812464381395966L;\n\n    private final String reason;\n\n    SimpleSecurityViolation(String reason)\n    {\n        this.reason = reason;\n    }\n\n    @Override\n    public String getReason()\n    {\n        return reason;\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (!(o instanceof SimpleSecurityViolation))\n        {\n            return false;\n        }\n\n        SimpleSecurityViolation that = (SimpleSecurityViolation) o;\n\n        return reason != null ? reason.equals(that.reason) : that.reason == null;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return reason != null ? reason.hashCode() : 0;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/EditableAccessDecisionVoterContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.spi.authorization;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionState;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\n/**\n * Interface which allows to provide a custom {@link AccessDecisionVoterContext} implementation\n */\npublic interface EditableAccessDecisionVoterContext extends AccessDecisionVoterContext\n{\n    /**\n     * Allows to add custom meta-data. The default security strategy adds custom annotations of the intercepted method\n     * as well as class-level annotations. (Currently inherited annotations aren't supported)\n     * @param key key for the meta-data\n     * @param metaData meta-data which should be added\n     */\n    void addMetaData(String key, Object metaData);\n\n    /**\n     * Updates the state of the context\n     * @param accessDecisionVoterState current state\n     */\n    void setState(AccessDecisionState accessDecisionVoterState);\n\n    /**\n     * TODO review it (this method is new)\n     * @param source e.g. the invocation-context\n     */\n    void setSource(Object source);\n\n    /**\n     * Adds a new {@link SecurityViolation} to the context\n     * @param securityViolation security-violation which should be added\n     */\n    void addViolation(SecurityViolation securityViolation);\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/SecurityStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.spi.authorization;\n\nimport org.apache.deltaspike.core.spi.InterceptorStrategy;\n\n/**\n * Marker interface for a pluggable strategy for\n * {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\npublic interface SecurityStrategy extends InterceptorStrategy\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/java/org/apache/deltaspike/security/spi/authorization/SecurityViolationHandler.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.spi.authorization;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\nimport java.util.Set;\n\n/**\n * Allows to handle custom implementations of {@link SecurityViolation}\n */\npublic interface SecurityViolationHandler\n{\n    /**\n     * Instead of adding the violations as message for the user, it's possible to implement a custom behaviour\n     * (e.g. something like an InternalViolation which won't get added)\n     * @param securityViolations current violations\n     */\n    void processSecurityViolations(Set<SecurityViolation> securityViolations);\n}\n"
  },
  {
    "path": "deltaspike/modules/security/api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/security/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>security-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-security-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Security-Module Impl</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.security.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            *\n        </deltaspike.osgi.import>\n        <deltaspike.osgi.require.capability>\n            osgi.extender; filter:=\"(osgi.extender=pax.cdi)\"\n        </deltaspike.osgi.require.capability>\n        <deltaspike.osgi.provide.capability>\n            org.ops4j.pax.cdi.extension;\n            extension=deltaspike-security-module-impl\n        </deltaspike.osgi.provide.capability>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-security-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n    </dependencies>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/AccessDeniedExceptionBroadcaster.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.authorization;\n\n//X TODO import org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\n\n//this broadcaster just allows to change the default behavior (if needed)\n//needed because it needs to be possible to 'consume' exceptions of type AccessDeniedException.\n//instead of ignoring the result of exception-control and throwing them in any case (like we have to do it per default).\n@Dependent\npublic class AccessDeniedExceptionBroadcaster\n{\n    @Inject\n    private BeanManager beanManager;\n\n    public void broadcastAccessDeniedException(AccessDeniedException accessDeniedException)\n    {\n/* TODO: gpetracek please\n        ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(accessDeniedException);\n\n        try\n        {\n            this.beanManager.fireEvent(exceptionToCatchEvent);\n        }\n        catch (AccessDeniedException e)\n        {\n            throw new SkipInternalProcessingException(accessDeniedException);\n        }\n*/\n\n        //we have to throw it in any case to support \"observers\" for AccessDeniedException (see DELTASPIKE-636)\n        //however, currently we can't do it based on the exception-control api (see DELTASPIKE-638)\n        throw new SkipInternalProcessingException(accessDeniedException);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/DefaultAccessDecisionVoterContext.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.authorization;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionState;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\nimport org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * {@inheritDoc}\n */\n@RequestScoped //TODO we might need a different scope for it\npublic class DefaultAccessDecisionVoterContext implements EditableAccessDecisionVoterContext\n{\n    private AccessDecisionState state = AccessDecisionState.INITIAL;\n\n    private List<SecurityViolation> securityViolations;\n\n    private Map<String, Object> metaData = new HashMap<String, Object>();\n\n    private Object source;\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public AccessDecisionState getState()\n    {\n        return state;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public List<SecurityViolation> getViolations()\n    {\n        if (securityViolations == null)\n        {\n            return Collections.emptyList();\n        }\n        return Collections.unmodifiableList(securityViolations);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public <T> T getSource()\n    {\n        return (T) source;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public void setSource(Object source)\n    {\n        this.source = source;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Map<String, Object> getMetaData()\n    {\n        return Collections.unmodifiableMap(metaData);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public <T> T getMetaDataFor(String key, Class<T> targetType)\n    {\n        return (T) metaData.get(key);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public void addMetaData(String key, Object metaData)\n    {\n        //TODO specify nested security calls\n        this.metaData.put(key, metaData);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public void setState(AccessDecisionState accessDecisionVoterState)\n    {\n        if (AccessDecisionState.VOTE_IN_PROGRESS.equals(accessDecisionVoterState))\n        {\n            securityViolations = new ArrayList<SecurityViolation>(); //lazy init\n        }\n\n        state = accessDecisionVoterState;\n\n        if (AccessDecisionState.INITIAL.equals(accessDecisionVoterState) ||\n                AccessDecisionState.VOTE_IN_PROGRESS.equals(accessDecisionVoterState))\n        {\n            return;\n        }\n\n        //meta-data is only needed until the end of a voting process\n        metaData.clear();\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public void addViolation(SecurityViolation securityViolation)\n    {\n        if (securityViolations == null)\n        {\n            throw new IllegalStateException(\n                    AccessDecisionState.VOTE_IN_PROGRESS.name() + \" is required for adding security-violations\");\n        }\n        securityViolations.add(securityViolation);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.authorization;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionState;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.security.api.authorization.Secured;\nimport org.apache.deltaspike.security.api.authorization.Secures;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\nimport org.apache.deltaspike.security.impl.util.SecurityUtils;\nimport org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.*;\n\n/**\n * Authorizer implementation for the {@link @Secured} annotation\n */\n@Dependent\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class SecuredAnnotationAuthorizer\n{\n    @Inject\n    private AccessDecisionVoterContext voterContext;\n\n    @Inject\n    private AccessDeniedExceptionBroadcaster exceptionBroadcaster;\n\n    @Secures\n    @Secured({ })\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public boolean doSecuredCheck(InvocationContext invocationContext) throws Exception\n    {\n        List<Class<? extends AccessDecisionVoter>> voterClasses = new ArrayList<Class<? extends AccessDecisionVoter>>();\n\n        List<Annotation> annotatedTypeMetadata = extractMetadata(invocationContext);\n\n        for (Annotation annotation : annotatedTypeMetadata)\n        {\n            if (Secured.class.isAssignableFrom(annotation.annotationType()))\n            {\n                voterClasses.addAll(Arrays.asList(((Secured) annotation).value()));\n            }\n            else if (voterContext instanceof EditableAccessDecisionVoterContext)\n            {\n                ((EditableAccessDecisionVoterContext) voterContext)\n                        .addMetaData(annotation.annotationType().getName(), annotation);\n            }\n        }\n\n        invokeVoters(invocationContext, voterClasses);\n\n        //needed by @SecurityBindingType\n        //X TODO check the use-cases for it\n        return true;\n    }\n\n    protected List<Annotation> extractMetadata(InvocationContext invocationContext)\n    {\n        List<Annotation> result = new ArrayList<Annotation>();\n\n        Method method = invocationContext.getMethod();\n\n        // some very old EE6 containers have a bug in resolving the target\n        // so we fall back on the declaringClass of the method.\n        Class<?> targetClass =\n                invocationContext.getTarget() != null\n                        ? ProxyUtils.getUnproxiedClass(invocationContext.getTarget().getClass())\n                        : method.getDeclaringClass();\n\n\n        result.addAll(SecurityUtils.getAllAnnotations(targetClass.getAnnotations(),\n            new HashSet<Integer>()));\n        //later on method-level annotations need to overrule class-level annotations -> don't change the order\n        result.addAll(SecurityUtils.getAllAnnotations(method.getAnnotations(),\n                new HashSet<Integer>()));\n\n        return result;\n    }\n\n    /**\n     * Helper for invoking the given {@link AccessDecisionVoter}s\n     *\n     * @param invocationContext    current invocation-context (might be null in case of secured views)\n     * @param accessDecisionVoters current access-decision-voters\n     */\n    private void invokeVoters(InvocationContext invocationContext,\n                              List<Class<? extends AccessDecisionVoter>> accessDecisionVoters)\n    {\n        if (accessDecisionVoters.isEmpty())\n        {\n            return;\n        }\n\n        AccessDecisionState voterState = AccessDecisionState.VOTE_IN_PROGRESS;\n        try\n        {\n            if (voterContext instanceof EditableAccessDecisionVoterContext)\n            {\n                ((EditableAccessDecisionVoterContext) voterContext).setState(voterState);\n                ((EditableAccessDecisionVoterContext) voterContext).setSource(invocationContext);\n            }\n\n            Set<SecurityViolation> violations;\n\n            AccessDecisionVoter voter;\n            for (Class<? extends AccessDecisionVoter> voterClass : accessDecisionVoters)\n            {\n                voter = BeanProvider.getContextualReference(voterClass, false);\n\n                violations = voter.checkPermission(voterContext);\n\n                if (violations != null && !violations.isEmpty())\n                {\n                    if (voterContext instanceof EditableAccessDecisionVoterContext)\n                    {\n                        voterState = AccessDecisionState.VIOLATION_FOUND;\n                        for (SecurityViolation securityViolation : violations)\n                        {\n                            ((EditableAccessDecisionVoterContext) voterContext).addViolation(securityViolation);\n                        }\n                    }\n                    this.exceptionBroadcaster.broadcastAccessDeniedException(new AccessDeniedException(violations));\n                }\n            }\n        }\n        finally\n        {\n            if (voterContext instanceof EditableAccessDecisionVoterContext)\n            {\n                if (AccessDecisionState.VOTE_IN_PROGRESS.equals(voterState))\n                {\n                    voterState = AccessDecisionState.NO_VIOLATION_FOUND;\n                }\n\n                ((EditableAccessDecisionVoterContext) voterContext).setState(voterState);\n            }\n        }\n    }\n}"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecurityParameterValueRedefiner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.authorization;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.interceptor.InvocationContext;\n\nimport org.apache.deltaspike.core.util.metadata.builder.ParameterValueRedefiner;\nimport org.apache.deltaspike.security.api.authorization.SecuredReturn;\nimport org.apache.deltaspike.security.api.authorization.SecurityParameterBinding;\n\n/**\n * Responsible for supplying requested method invocation values to the security binding method.\n */\npublic class SecurityParameterValueRedefiner implements ParameterValueRedefiner\n{\n    private final BeanManager beanManager;\n    private CreationalContext<?> creationalContext;\n    private InvocationContext invocation;\n    private Object result;\n\n    public SecurityParameterValueRedefiner(BeanManager beanManager,\n                                           CreationalContext<?> creationalContext,\n                                           InvocationContext invocation,\n                                           Object result)\n    {\n        this.beanManager = beanManager;\n        this.creationalContext = creationalContext;\n        this.invocation = invocation;\n        this.result = result;\n    }\n\n    @Override\n    public Object redefineParameterValue(ParameterValue value)\n    {\n\n        InjectionPoint injectionPoint = value.getInjectionPoint();\n        if (injectionPoint != null)\n        {\n            if (value.getInjectionPoint().getAnnotated().getBaseType().equals(InvocationContext.class))\n            {\n                return invocation;\n            }\n            else if (value.getInjectionPoint().getAnnotated().isAnnotationPresent(SecuredReturn.class))\n            {\n                return result;\n            }\n            else\n            {\n                Annotated securingParameterAnnotatedType = injectionPoint.getAnnotated();\n                Set<Annotation> securingParameterAnnotations = securingParameterAnnotatedType.getAnnotations();\n\n                Set<Annotation> requiredBindingAnnotations = new HashSet<Annotation>();\n                for (Annotation annotation : securingParameterAnnotations)\n                {\n                    if (annotation.annotationType().isAnnotationPresent(SecurityParameterBinding.class))\n                    {\n                        requiredBindingAnnotations.add(annotation);\n                    }\n                }\n\n                if (!requiredBindingAnnotations.isEmpty())\n                {\n                    Method method = invocation.getMethod();\n                    Annotation[][] businessMethodParameterAnnotations = method.getParameterAnnotations();\n                    for (int i = 0; i < businessMethodParameterAnnotations.length; i++)\n                    {\n                        List<Annotation> businessParameterAnnotations = Arrays\n                                    .asList(businessMethodParameterAnnotations[i]);\n                        for (Annotation annotation : requiredBindingAnnotations)\n                        {\n                            if (businessParameterAnnotations.contains(annotation))\n                            {\n                                return invocation.getParameters()[i];\n                            }\n                        }\n\n                        Set<Integer> hashCodesOfBusinessParameterAnnotations =\n                            new HashSet<Integer>(businessParameterAnnotations.size());\n\n                        for (Annotation annotation : businessParameterAnnotations)\n                        {\n                            hashCodesOfBusinessParameterAnnotations.add(beanManager.getQualifierHashCode(annotation));\n                        }\n                        //2nd try (detailed check)\n                        for (Annotation annotation : requiredBindingAnnotations)\n                        {\n                            if (hashCodesOfBusinessParameterAnnotations.contains(beanManager.getQualifierHashCode(annotation)))\n                            {\n                                return invocation.getParameters()[i];\n                            }\n                        }\n                    }\n\n                    throw new IllegalStateException(\"Missing required security parameter binding \"\n                                + requiredBindingAnnotations + \" on method invocation [\"\n                                + method.getDeclaringClass().getName() + \".\" + method.getName()\n                                + Arrays.asList(method.getParameterTypes()).toString().replaceFirst(\"\\\\[\", \"(\")\n                                            .replaceFirst(\"\\\\]$\", \")\") + \"]\");\n\n                }\n            }\n        }\n\n        return value.getDefaultValue(creationalContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SkipInternalProcessingException.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.authorization;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\n\n//just to avoid a 2nd call of the handlers\n//the first one can't be removed, because we need an active AccessDecisionVoterContext\npublic class SkipInternalProcessingException extends RuntimeException\n{\n    private static final long serialVersionUID = 3585306529694592791L;\n\n    private final AccessDeniedException  accessDeniedException;\n\n    public SkipInternalProcessingException(AccessDeniedException accessDeniedException)\n    {\n        this.accessDeniedException = accessDeniedException;\n    }\n\n    public AccessDeniedException getAccessDeniedException()\n    {\n        return accessDeniedException;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/AuthorizationParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.extension;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport jakarta.enterprise.util.Nonbinding;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityDefinitionException;\n\nclass AuthorizationParameter\n{\n\n    private Type type;\n    private Map<Class<? extends Annotation>, Map<Method, Object>> bindings;\n\n    public AuthorizationParameter()\n    {\n    }\n\n    AuthorizationParameter(Type type, Set<Annotation> bindings)\n    {\n        this.type = type;\n        this.bindings = new HashMap<Class<? extends Annotation>, Map<Method, Object>>();\n        for (Annotation bindingAnnotation : bindings)\n        {\n            Map<Method, Object> bindingMembers = new HashMap<Method, Object>();\n            try\n            {\n                for (Method method : bindingAnnotation.annotationType().getDeclaredMethods())\n                {\n                    if (method.isAnnotationPresent(Nonbinding.class))\n                    {\n                        continue;\n                    }\n                    bindingMembers.put(method, method.invoke(bindingAnnotation));\n                }\n            }\n            catch (InvocationTargetException ex)\n            {\n                throw new SecurityDefinitionException(\"Error reading security binding members\", ex);\n            }\n            catch (IllegalAccessException ex)\n            {\n                throw new SecurityDefinitionException(\"Error reading security binding members\", ex);\n            }\n            this.bindings.put(bindingAnnotation.annotationType(), bindingMembers);\n        }\n    }\n\n    /**\n     * TODO comment is no equals!!!\n     * \n     * @param parameter\n     * @return\n     */\n    boolean matches(AuthorizationParameter parameter)\n    {\n        if (!type.equals(parameter.type))\n        {\n            return false;\n        }\n        for (Map.Entry<Class<? extends Annotation>, Map<Method, Object>> bindingEntry : bindings.entrySet())\n        {\n            Map<Method, Object> bindingValues = parameter.bindings.get(bindingEntry.getKey());\n            if (bindingValues == null)\n            {\n                // annotation is not present\n                return false;\n            }\n            for (Map.Entry<Method, Object> value : bindingEntry.getValue().entrySet())\n            {\n                if (!bindingValues.get(value.getKey()).equals(value.getValue()))\n                {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n\n    public String toString()\n    {\n        StringBuilder builder = new StringBuilder();\n        for (Map.Entry<Class<? extends Annotation>, Map<Method, Object>> bindingEntry : bindings.entrySet())\n        {\n            builder.append('@').append(bindingEntry.getKey().getName()).append('(');\n            for (Map.Entry<Method, Object> value : bindingEntry.getValue().entrySet())\n            {\n                builder.append(value.getKey().getName()).append('=').append(value.getValue()).append(',');\n            }\n            if (bindingEntry.getValue().isEmpty())\n            {\n                builder.append(')');\n            }\n            else\n            {\n                builder.setCharAt(builder.length() - 1, ')');\n            }\n        }\n        if (!bindings.isEmpty())\n        {\n            builder.append(' ');\n        }\n        builder.append(type);\n        return builder.toString();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/Authorizer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.extension;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.Stereotype;\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.util.Nonbinding;\nimport jakarta.interceptor.InvocationContext;\n\nimport org.apache.deltaspike.core.util.metadata.builder.InjectableMethod;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.security.api.authorization.SecurityBindingType;\nimport org.apache.deltaspike.security.api.authorization.SecurityDefinitionException;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\nimport org.apache.deltaspike.security.api.authorization.SecuredReturn;\nimport org.apache.deltaspike.security.impl.authorization.SecurityParameterValueRedefiner;\nimport org.apache.deltaspike.security.impl.util.SecurityUtils;\n\n/**\n * Responsible for authorizing method invocations.\n */\n@Vetoed\nclass Authorizer\n{\n    private Annotation bindingAnnotation;\n    private Map<Method, Object> bindingSecurityBindingMembers = new HashMap<Method, Object>();\n    private Set<AuthorizationParameter> authorizationParameters = new HashSet<AuthorizationParameter>();\n    private Class<?> securedReturnType;\n\n    private volatile AnnotatedMethod<?> boundAuthorizerMethod;\n    private volatile Bean<?> boundAuthorizerBean;\n\n    private volatile InjectableMethod<?> boundAuthorizerMethodProxy;\n\n    Authorizer(Annotation bindingAnnotation, AnnotatedMethod<?> boundAuthorizerMethod)\n    {\n        this.bindingAnnotation = bindingAnnotation;\n        this.boundAuthorizerMethod = boundAuthorizerMethod;\n\n        try\n        {\n            for (Method method : bindingAnnotation.annotationType().getDeclaredMethods())\n            {\n                if (method.isAnnotationPresent(Nonbinding.class))\n                {\n                    continue;\n                }\n                bindingSecurityBindingMembers.put(method, method.invoke(bindingAnnotation));\n            }\n        }\n        catch (InvocationTargetException ex)\n        {\n            throw new SecurityDefinitionException(\"Error reading security binding members\", ex);\n        }\n        catch (IllegalAccessException ex)\n        {\n            throw new SecurityDefinitionException(\"Error reading security binding members\", ex);\n        }\n        \n        for (AnnotatedParameter<?> annotatedParameter : boundAuthorizerMethod.getParameters())\n        {\n            Set<Annotation> securityParameterBindings = null;\n            Class<?> securedReturnType = null;\n            for (Annotation annotation : annotatedParameter.getAnnotations())\n            {\n                if (SecurityUtils.isMetaAnnotatedWithSecurityParameterBinding(annotation))\n                {\n                    if (securityParameterBindings == null)\n                    {\n                        securityParameterBindings = new HashSet<Annotation>();\n                    }\n                    securityParameterBindings.add(annotation);\n                }\n                if (annotation.annotationType().equals(SecuredReturn.class))\n                {\n                    securedReturnType\n                        = boundAuthorizerMethod.getJavaMember().getParameterTypes()[annotatedParameter.getPosition()];\n                }\n            }\n            if (securityParameterBindings != null && securedReturnType != null)\n            {\n                StringBuilder errorMessage = new StringBuilder();\n                errorMessage.append(\"@SecurityParameterBinding annotations must not occure \");\n                errorMessage.append(\"at the same parameter with @Result annotation, but parameter \");\n                errorMessage.append(annotatedParameter.getPosition()).append(\" of method \");\n                errorMessage.append(boundAuthorizerMethod.getJavaMember()).append(\" is annotated with @Result and \");\n                boolean first = true;\n                for (Annotation securityParameterBinding : securityParameterBindings)\n                {\n                    if (first)\n                    {\n                        first = false;\n                    }\n                    else\n                    {\n                        errorMessage.append(\" and \");\n                    }\n                    errorMessage.append(securityParameterBinding);\n                }\n                if (securityParameterBindings.size() == 1)\n                {\n                    errorMessage.append(\", which is a @SecurityParameterBinding annotation\");\n                }\n                else\n                {\n                    errorMessage.append(\", which are @SecurityParameterBinding annotations\");\n                }\n                throw new SecurityDefinitionException(errorMessage.toString());\n            }\n            else if (securityParameterBindings != null)\n            {\n                AuthorizationParameter authorizationParameter\n                    = new AuthorizationParameter(annotatedParameter.getBaseType(), securityParameterBindings);\n                authorizationParameters.add(authorizationParameter);\n            }\n            else if (securedReturnType != null)\n            {\n                if (this.securedReturnType != null\n                    && !this.securedReturnType.equals(securedReturnType))\n                {\n                    throw new SecurityDefinitionException(\"More than one parameter of \"\n                                                          + boundAuthorizerMethod.getJavaMember()\n                                                          + \" is annotated with @Result\");\n                }\n                this.securedReturnType = securedReturnType;\n            }\n        }\n    }\n\n    boolean isBeforeMethodInvocationAuthorizer()\n    {\n        return securedReturnType == null;\n    }\n\n    boolean isAfterMethodInvocationAuthorizer()\n    {\n        return securedReturnType != null;\n    }\n\n    void authorize(final InvocationContext ic, final Object returnValue, BeanManager beanManager)\n        throws IllegalAccessException, IllegalArgumentException\n    {\n        if (boundAuthorizerBean == null)\n        {\n            lazyInitTargetBean(beanManager);\n        }\n\n        final CreationalContext<?> creationalContext = beanManager.createCreationalContext(boundAuthorizerBean);\n\n        Object reference = beanManager.getReference(boundAuthorizerBean,\n            boundAuthorizerMethod.getJavaMember().getDeclaringClass(), creationalContext);\n\n        Object result = boundAuthorizerMethodProxy.invoke(reference, creationalContext,\n                new SecurityParameterValueRedefiner(beanManager, creationalContext, ic, returnValue));\n\n        if (Boolean.FALSE.equals(result))\n        {\n            Set<SecurityViolation> violations = new HashSet<SecurityViolation>();\n            violations.add(new SecurityViolation()\n            {\n                private static final long serialVersionUID = 2358753444038521129L;\n\n                @Override\n                public String getReason()\n                {\n                    return \"Authorization check failed\";\n                }\n            });\n\n            throw new AccessDeniedException(violations);\n        }\n    }\n\n    @SuppressWarnings({ \"unchecked\" })\n    private synchronized void lazyInitTargetBean(BeanManager beanManager)\n    {\n        if (boundAuthorizerBean == null)\n        {\n            Method method = boundAuthorizerMethod.getJavaMember();\n\n            Set<Bean<?>> beans = beanManager.getBeans(method.getDeclaringClass());\n            Bean<?> foundBoundAuthorizerBean = beanManager.resolve(beans);\n\n            if (foundBoundAuthorizerBean == null)\n            {\n                throw new IllegalStateException(\"Exception looking up authorizer method bean - \" +\n                        \"no beans found for method [\" + method.getDeclaringClass() + \".\" +\n                        method.getName() + \"]\");\n            }\n\n            boundAuthorizerMethodProxy = new InjectableMethod(\n                boundAuthorizerMethod, foundBoundAuthorizerBean, beanManager);\n            boundAuthorizerBean = foundBoundAuthorizerBean;\n        }\n    }\n\n    boolean matchesBindings(Annotation annotation, Set<AuthorizationParameter> parameterBindings, Class<?> returnType)\n    {\n        if (!annotation.annotationType().isAnnotationPresent(SecurityBindingType.class) &&\n                annotation.annotationType().isAnnotationPresent(Stereotype.class))\n        {\n            annotation = SecurityUtils.resolveSecurityBindingType(annotation);\n        }\n\n        if (!annotation.annotationType().equals(bindingAnnotation.annotationType()))\n        {\n            return false;\n        }\n\n        for (Method method : annotation.annotationType().getDeclaredMethods())\n        {\n            if (method.isAnnotationPresent(Nonbinding.class))\n            {\n                continue;\n            }\n\n            if (!bindingSecurityBindingMembers.containsKey(method))\n            {\n                return false;\n            }\n\n            try\n            {\n                Object value = method.invoke(annotation);\n                if (!bindingSecurityBindingMembers.get(method).equals(value))\n                {\n                    return false;\n                }\n            }\n            catch (InvocationTargetException ex)\n            {\n                throw new SecurityDefinitionException(\"Error reading security binding members\", ex);\n            }\n            catch (IllegalAccessException ex)\n            {\n                throw new SecurityDefinitionException(\"Error reading security binding members\", ex);\n            }\n        }\n\n        for (AuthorizationParameter authorizationParameter : authorizationParameters)\n        {\n            boolean found = false;\n            for (AuthorizationParameter parameterBinding : parameterBindings)\n            {\n                if (parameterBinding.matches(authorizationParameter))\n                {\n                    found = true;\n                }\n            }\n            if (!found)\n            {\n                return false;\n            }\n        }\n        \n        if (!matches(returnType))\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    private boolean matches(Class<?> returnType)\n    {\n        if (securedReturnType == null)\n        {\n            return true;\n        }\n        if (securedReturnType.isAssignableFrom(returnType))\n        {\n            return true;\n        }\n        if (securedReturnType.equals(Void.class) && returnType.equals(Void.TYPE))\n        {\n            return true;\n        }\n        return false;\n    }\n\n    Method getBoundAuthorizerMethod()\n    {\n        return boundAuthorizerMethod.getJavaMember();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/DefaultSecurityStrategy.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.extension;\n\nimport org.apache.deltaspike.core.util.ProxyUtils;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.security.impl.authorization.SkipInternalProcessingException;\nimport org.apache.deltaspike.security.spi.authorization.SecurityStrategy;\n\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.reflect.Method;\nimport java.util.Set;\n\n/**\n * {@inheritDoc}\n */\n@Dependent\npublic class DefaultSecurityStrategy implements SecurityStrategy\n{\n    private static final long serialVersionUID = 7992336651801599079L;\n\n    @Inject\n    private BeanManager beanManager;\n\n    @Inject\n    private SecurityExtension securityExtension;\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public Object execute(InvocationContext invocationContext) throws Exception\n    {\n        Method method = invocationContext.getMethod();\n\n        SecurityMetaDataStorage metaDataStorage = securityExtension.getMetaDataStorage();\n\n        Class targetClass = ProxyUtils.getUnproxiedClass(invocationContext.getTarget().getClass()); //see DELTASPIKE-517\n\n        Set<Authorizer> authorizers = metaDataStorage.getAuthorizers(targetClass, method);\n\n        invokeBeforeMethodInvocationAuthorizers(invocationContext, authorizers);\n\n        Object result = invocationContext.proceed();\n\n        invokeAfterMethodInvocationAuthorizers(invocationContext, authorizers, result);\n\n        return result;\n    }\n\n    protected void invokeBeforeMethodInvocationAuthorizers(\n        InvocationContext invocationContext, Set<Authorizer> authorizers) throws IllegalAccessException\n    {\n        try\n        {\n            for (Authorizer authorizer : authorizers)\n            {\n                if (authorizer.isBeforeMethodInvocationAuthorizer())\n                {\n                    authorizer.authorize(invocationContext, null, this.beanManager);\n                }\n            }\n        }\n        catch (SkipInternalProcessingException e)\n        {\n            throw e.getAccessDeniedException();\n        }\n        catch (AccessDeniedException e)\n        {\n            RuntimeException exceptionToThrow = handleAccessDeniedException(e);\n            if (exceptionToThrow != null)\n            {\n                throw exceptionToThrow;\n            }\n        }\n    }\n\n    protected void invokeAfterMethodInvocationAuthorizers(InvocationContext invocationContext,\n        Set<Authorizer> authorizers, Object result) throws IllegalAccessException\n    {\n        try\n        {\n            for (Authorizer authorizer : authorizers)\n            {\n                if (authorizer.isAfterMethodInvocationAuthorizer())\n                {\n                    authorizer.authorize(invocationContext, result, this.beanManager);\n                }\n            }\n        }\n        catch (AccessDeniedException e)\n        {\n            RuntimeException exceptionToThrow = handleAccessDeniedException(e);\n            if (exceptionToThrow != null)\n            {\n                throw exceptionToThrow;\n            }\n        }\n    }\n\n    /**\n     * It also allows to change the default handling.\n     *\n     * @param originalException exception thrown by an authorizer\n     * @return the original exception if the default behavior was changed and the exception is unhandled\n     */\n    protected RuntimeException handleAccessDeniedException(AccessDeniedException originalException)\n    {\n        return originalException;\n    }\n}"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/SecurityExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.security.impl.extension;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.security.api.authorization.Secures;\nimport org.apache.deltaspike.security.api.authorization.SecurityDefinitionException;\nimport org.apache.deltaspike.security.impl.util.SecurityUtils;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AfterBeanDiscovery;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedParameter;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.ProcessAnnotatedType;\n\n/**\n * Extension for processing typesafe security annotations\n */\npublic class SecurityExtension implements Extension, Deactivatable\n{\n    private static final SecurityInterceptorBinding INTERCEPTOR_BINDING = new SecurityInterceptorBindingLiteral();\n\n    private SecurityMetaDataStorage securityMetaDataStorage;\n\n    private Boolean isActivated = null;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n        securityMetaDataStorage = new SecurityMetaDataStorage();\n    }\n\n    //workaround for OWB\n    public SecurityMetaDataStorage getMetaDataStorage()\n    {\n        return securityMetaDataStorage;\n    }\n\n    /**\n     * Handles &#064;Secured beans\n     */\n    public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        AnnotatedType<X> type = event.getAnnotatedType();\n        \n        boolean isSecured = false;\n\n        // Add the security interceptor to the class if the class is annotated\n        // with a security binding type\n        for (final Annotation annotation : type.getAnnotations())\n        {\n            if (SecurityUtils.isMetaAnnotatedWithSecurityBindingType(annotation))\n            {\n                event.configureAnnotatedType()\n                    .add(INTERCEPTOR_BINDING);\n                getMetaDataStorage().addSecuredType(type);\n                isSecured = true;\n                break;\n            }\n        }\n\n        // If the class isn't annotated with a security binding type, check if\n        // any of its methods are, and if so, add the security interceptor to the\n        // method\n        if (!isSecured) \n        {\n            for (final AnnotatedMethod<? super X> m : type.getMethods()) \n            {\n                if (m.isAnnotationPresent(Secures.class))\n                {\n                    registerAuthorizer(m);\n                    continue;\n                }\n\n                for (final Annotation annotation : m.getAnnotations()) \n                {\n                    if (SecurityUtils.isMetaAnnotatedWithSecurityBindingType(annotation))\n                    {\n                        event.configureAnnotatedType()\n                                .filterMethods(cm -> cm.getJavaMember().equals(m.getJavaMember()))\n                                .findFirst()\n                                .get()\n                                .add(INTERCEPTOR_BINDING);\n                        getMetaDataStorage().addSecuredMethod(m);\n                        break;\n                    }\n                }\n            }\n        }\n    }\n\n    public void validateBindings(@Observes AfterBeanDiscovery event, BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        SecurityMetaDataStorage metaDataStorage = getMetaDataStorage();\n\n        metaDataStorage.registerSecuredMethods();\n\n        for (final AnnotatedMethod<?> method : metaDataStorage.getSecuredMethods())\n        {\n            // Here we simply want to validate that each method that is annotated with\n            // one or more security bindings has a valid authorizer for each binding\n\n            Class<?> targetClass = method.getDeclaringType().getJavaClass();\n            Method targetMethod = method.getJavaMember();\n            for (final Annotation annotation : SecurityUtils.getSecurityBindingTypes(targetClass, targetMethod)) \n            {\n                boolean found = false;\n\n                Set<AuthorizationParameter> authorizationParameters = new HashSet<AuthorizationParameter>();\n                for (AnnotatedParameter<?> parameter : (List<AnnotatedParameter<?>>) (List<?>) method.getParameters())\n                {\n                    Set<Annotation> securityParameterBindings = null;\n                    for (Annotation a : parameter.getAnnotations())\n                    {\n                        if (SecurityUtils.isMetaAnnotatedWithSecurityParameterBinding(a))\n                        {\n                            if (securityParameterBindings == null)\n                            {\n                                securityParameterBindings = new HashSet<Annotation>();\n                            }\n                            securityParameterBindings.add(a);\n                        }\n                    }\n                    if (securityParameterBindings != null)\n                    {\n                        AuthorizationParameter authorizationParameter\n                            = new AuthorizationParameter(parameter.getBaseType(), securityParameterBindings);\n                        authorizationParameters.add(authorizationParameter);\n                    }\n                }\n                // Validate the authorizer\n                for (Authorizer auth : metaDataStorage.getAuthorizers())\n                {\n                    if (auth.matchesBindings(annotation, authorizationParameters, targetMethod.getReturnType())) \n                    {\n                        found = true;\n                        break;\n                    }\n                }\n\n                if (!found) \n                {\n                    event.addDefinitionError(new SecurityDefinitionException(\"Secured type \" +\n                            method.getDeclaringType().getJavaClass().getName() +\n                            \" has no matching authorizer method for security binding @\" +\n                            annotation.annotationType().getName()));\n                }\n            }\n\n            for (final Annotation annotation : method.getAnnotations()) \n            {\n                if (SecurityUtils.isMetaAnnotatedWithSecurityBindingType(annotation))\n                {\n                    metaDataStorage.registerSecuredMethod(targetClass, targetMethod);\n                    break;\n                }\n            }\n        }\n\n        // Clear securedTypes, we don't require it any more\n        metaDataStorage.resetSecuredMethods();\n    }\n\n    /**\n     * Registers the specified authorizer method (i.e. a method annotated with\n     * the @Secures annotation)\n     *\n     * @throws SecurityDefinitionException\n     */\n    private void registerAuthorizer(AnnotatedMethod<?> annotatedMethod)\n    {\n        if (!annotatedMethod.getJavaMember().getReturnType().equals(Boolean.class) &&\n                !annotatedMethod.getJavaMember().getReturnType().equals(Boolean.TYPE))\n        {\n            throw new SecurityDefinitionException(\"Invalid authorizer method [\" +\n                    annotatedMethod.getJavaMember().getDeclaringClass().getName() + \".\" +\n                    annotatedMethod.getJavaMember().getName() + \"] - does not return a boolean.\");\n        }\n\n        // Locate the binding type\n        Annotation binding = null;\n\n        for (Annotation annotation : annotatedMethod.getAnnotations())\n        {\n            if (SecurityUtils.isMetaAnnotatedWithSecurityBindingType(annotation))\n            {\n                if (binding != null)\n                {\n                    throw new SecurityDefinitionException(\"Invalid authorizer method [\" +\n                            annotatedMethod.getJavaMember().getDeclaringClass().getName() + \".\" +\n                            annotatedMethod.getJavaMember().getName() + \"] - declares multiple security binding types\");\n                }\n                binding = annotation;\n            }\n        }\n\n        Authorizer authorizer = new Authorizer(binding, annotatedMethod);\n        getMetaDataStorage().addAuthorizer(authorizer);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/SecurityInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.extension;\n\nimport jakarta.annotation.Priority;\nimport org.apache.deltaspike.security.spi.authorization.SecurityStrategy;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n/**\n * Interceptor for {@link SecurityInterceptorBinding} - details see {@link SecurityStrategy}\n */\n@SecurityInterceptorBinding\n@Interceptor\n@Priority(1000)\npublic class SecurityInterceptor implements Serializable\n{\n    private static final long serialVersionUID = -7094673146532371976L;\n\n    @Inject\n    private SecurityStrategy securityStrategy;\n\n    @AroundInvoke\n    public Object filterDeniedInvocations(InvocationContext invocationContext) throws Exception\n    {\n        return securityStrategy.execute(invocationContext);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/SecurityInterceptorBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n\npackage org.apache.deltaspike.security.impl.extension;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Interceptor binding type for SecurityInterceptor.  Users should not apply\n * this binding themselves, it is applied by the security portable extension.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@InterceptorBinding\n@Target({ElementType.TYPE, ElementType.METHOD })\n@interface SecurityInterceptorBinding \n{\n\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/SecurityInterceptorBindingLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n\npackage org.apache.deltaspike.security.impl.extension;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\n\n\n/**\n * Annotation literal for SecurityInterceptorBinding \n */\nclass SecurityInterceptorBindingLiteral extends AnnotationLiteral<SecurityInterceptorBinding> \n    implements SecurityInterceptorBinding\n{\n    private static final long serialVersionUID = 2189092542638784524L;\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/extension/SecurityMetaDataStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.extension;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityDefinitionException;\nimport org.apache.deltaspike.security.impl.util.SecurityUtils;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\n\nclass SecurityMetaDataStorage\n{\n    /**\n     * Contains all known authorizers\n     */\n    private Set<Authorizer> authorizers = new HashSet<Authorizer>();\n\n    /**\n     * Contains all known secured methods.\n     */\n    private Set<AnnotatedMethod<?>> securedMethods = new HashSet<AnnotatedMethod<?>>();\n\n    /**\n     * A mapping between a secured method of a class and its authorizers\n     */\n    private Map<Class<?>, Map<Method, Set<Authorizer>>> methodAuthorizers =\n        new HashMap<Class<?>, Map<Method, Set<Authorizer>>>();\n\n\n    void addAuthorizer(Authorizer authorizer)\n    {\n        authorizers.add(authorizer);\n    }\n\n    void addSecuredType(AnnotatedType<?> annotatedType)\n    {\n        for (AnnotatedMethod<?> securedMethod : annotatedType.getMethods())\n        {\n            addSecuredMethod(securedMethod);\n        }\n    }\n\n    void addSecuredMethod(AnnotatedMethod<?> annotatedMethod)\n    {\n        securedMethods.add(annotatedMethod);\n    }\n\n    Set<AnnotatedMethod<?>> getSecuredMethods()\n    {\n        return securedMethods;\n    }\n\n    void resetSecuredMethods()\n    {\n        securedMethods = null;\n    }\n\n    /**\n     * This method is invoked by the security interceptor to obtain the\n     * authorizer stack for a secured method\n     */\n    Set<Authorizer> getAuthorizers(Class<?> targetClass, Method targetMethod)\n    {\n        if (!isMethodMetaDataAvailable(targetClass, targetMethod))\n        {\n            registerSecuredMethod(targetClass, targetMethod);\n        }\n\n        return getMethodAuthorizers(targetClass, targetMethod);\n    }\n\n    void registerSecuredMethods()\n    {\n        for (AnnotatedMethod<?> method : securedMethods)\n        {\n            registerSecuredMethod(method.getDeclaringType().getJavaClass(), method.getJavaMember());\n        }\n    }\n\n    synchronized <T> void registerSecuredMethod(Class<T> targetClass, Method targetMethod)\n    {\n        ensureInitializedAuthorizersForClass(targetClass);\n\n        if (!containsMethodAuthorizers(targetClass, targetMethod))\n        {\n            Set<AuthorizationParameter> parameterBindings = new HashSet<AuthorizationParameter>();\n            Class<?>[] parameterTypes = targetMethod.getParameterTypes();\n            Annotation[][] parameterAnnotations = targetMethod.getParameterAnnotations();\n            for (int i = 0; i < parameterTypes.length; i++)\n            {\n                Set<Annotation> securityBindings = null;\n                for (final Annotation parameterAnnotation : parameterAnnotations[i])\n                {\n                    if (SecurityUtils.isMetaAnnotatedWithSecurityParameterBinding(parameterAnnotation))\n                    {\n                        if (securityBindings == null)\n                        {\n                            securityBindings = new HashSet<Annotation>();\n                        }\n                        securityBindings.add(parameterAnnotation);\n                    }\n                }\n                if (securityBindings != null)\n                {\n                    parameterBindings.add(new AuthorizationParameter(parameterTypes[i], securityBindings));\n                }\n            }\n            \n            Set<Authorizer> authorizerStack = new HashSet<Authorizer>();\n\n            for (Annotation binding : SecurityUtils.getSecurityBindingTypes(targetClass, targetMethod))\n            {\n                boolean found = false;\n\n                // For each security binding, find a valid authorizer\n                for (Authorizer authorizer : authorizers)\n                {\n                    if (authorizer.matchesBindings(binding, parameterBindings, targetMethod.getReturnType()))\n                    {\n                        if (found)\n                        {\n                            StringBuilder sb = new StringBuilder();\n                            sb.append(\"Matching authorizer methods found: [\");\n                            sb.append(authorizer.getBoundAuthorizerMethod().getDeclaringClass().getName());\n                            sb.append(\".\");\n                            sb.append(authorizer.getBoundAuthorizerMethod().getName());\n                            sb.append(\"]\");\n\n                            for (Authorizer a : authorizerStack)\n                            {\n                                if (a.matchesBindings(binding, parameterBindings, targetMethod.getReturnType()))\n                                {\n                                    sb.append(\", [\");\n                                    sb.append(a.getBoundAuthorizerMethod().getDeclaringClass().getName());\n                                    sb.append(\".\");\n                                    sb.append(a.getBoundAuthorizerMethod().getName());\n                                    sb.append(\"]\");\n                                }\n                            }\n\n                            throw new SecurityDefinitionException(\n                                    \"Ambiguous authorizers found for security binding type [@\" +\n                                            binding.annotationType().getName() + \"] on method [\" +\n                                            targetMethod.getDeclaringClass().getName() + \".\" +\n                                            targetMethod.getName() + \"]. \" + sb.toString());\n                        }\n\n                        authorizerStack.add(authorizer);\n                        found = true;\n                    }\n                }\n\n                if (!found)\n                {\n                    throw new SecurityDefinitionException(\n                            \"No matching authorizer found for security binding type [@\" +\n                                    binding.annotationType().getName() + \"] on method [\" +\n                                    targetMethod.getDeclaringClass().getName() + \".\" +\n                                    targetMethod.getName() + \"].\");\n                }\n            }\n            addMethodAuthorizer(targetClass, targetMethod, authorizerStack);\n        }\n    }\n\n    Set<Authorizer> getAuthorizers()\n    {\n        return authorizers;\n    }\n\n    private boolean containsMethodAuthorizers(Class<?> targetClass, Method targetMethod)\n    {\n        Map<Method, Set<Authorizer>> resultForClass = methodAuthorizers.get(targetClass);\n        return resultForClass.containsKey(targetMethod);\n    }\n\n    private void ensureInitializedAuthorizersForClass(Class<?> targetClass)\n    {\n        Map<Method, Set<Authorizer>> resultForClass = methodAuthorizers.get(targetClass);\n\n        if (resultForClass == null)\n        {\n            methodAuthorizers.put(targetClass, new HashMap<Method, Set<Authorizer>>());\n        }\n    }\n\n    private boolean isMethodMetaDataAvailable(Class<?> targetClass, Method targetMethod)\n    {\n        Map<Method, Set<Authorizer>> result = methodAuthorizers.get(targetClass);\n        return result != null && result.containsKey(targetMethod);\n    }\n\n    private void addMethodAuthorizer(Class<?> targetClass, Method targetMethod, Set<Authorizer> authorizersToAdd)\n    {\n        Map<Method, Set<Authorizer>> authorizerMapping = methodAuthorizers.get(targetClass);\n\n        if (authorizerMapping == null)\n        {\n            authorizerMapping = new HashMap<Method, Set<Authorizer>>();\n            methodAuthorizers.put(targetClass, authorizerMapping);\n        }\n\n        Set<Authorizer> authorizersForMethod = authorizerMapping.get(targetMethod);\n\n        if (authorizersForMethod == null)\n        {\n            authorizersForMethod = new HashSet<Authorizer>();\n            authorizerMapping.put(targetMethod, authorizersForMethod);\n        }\n\n        authorizersForMethod.addAll(authorizersToAdd);\n    }\n\n    private Set<Authorizer> getMethodAuthorizers(Class<?> targetClass, Method targetMethod)\n    {\n        Map<Method, Set<Authorizer>> resultForClass = methodAuthorizers.get(targetClass);\n\n        if (resultForClass == null)\n        {\n            throw new IllegalStateException(\n                    \"no meta-data available for: \" + targetClass.getName() + targetMethod.getName());\n        }\n\n        return resultForClass.get(targetMethod);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/util/SecurityUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.security.impl.util;\n\nimport org.apache.deltaspike.core.util.ReflectionUtils;\nimport org.apache.deltaspike.security.api.authorization.SecurityBindingType;\nimport org.apache.deltaspike.security.api.authorization.SecurityParameterBinding;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\n@Vetoed\npublic abstract class SecurityUtils\n{\n    private SecurityUtils()\n    {\n        // prevent instantiation\n    }\n\n    public static Set<Annotation> getSecurityBindingTypes(Class<?> targetClass, Method targetMethod)\n    {\n        Set<Annotation> securityBindingTypes = new HashSet<Annotation>();\n        Class<?> cls = targetClass;\n        while (cls != null && !cls.equals(Object.class))\n        {\n            for (final Annotation annotation : cls.getAnnotations())\n            {\n                if (SecurityUtils.isMetaAnnotatedWithSecurityBindingType(annotation))\n                {\n                    securityBindingTypes.add(annotation);\n                }\n            }\n            cls = cls.getSuperclass();\n        }\n\n        for (final Annotation annotation : targetMethod.getAnnotations())\n        {\n            if (SecurityUtils.isMetaAnnotatedWithSecurityBindingType(annotation))\n            {\n                securityBindingTypes.add(annotation);\n            }\n        }\n        return securityBindingTypes;\n    }\n\n    public static boolean isMetaAnnotatedWithSecurityBindingType(Annotation annotation)\n    {\n        if (annotation.annotationType().isAnnotationPresent(SecurityBindingType.class))\n        {\n            return true;\n        }\n\n        List<Annotation> result = getAllAnnotations(annotation.annotationType().getAnnotations(),\n            new HashSet<Integer>());\n\n        for (Annotation foundAnnotation : result)\n        {\n            if (SecurityBindingType.class.isAssignableFrom(foundAnnotation.annotationType()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public static Annotation resolveSecurityBindingType(Annotation annotation)\n    {\n        List<Annotation> result = getAllAnnotations(annotation.annotationType().getAnnotations(),\n            new HashSet<Integer>());\n\n        for (Annotation foundAnnotation : result)\n        {\n            if (foundAnnotation.annotationType().isAnnotationPresent(SecurityBindingType.class))\n            {\n                return foundAnnotation;\n            }\n        }\n        throw new IllegalStateException(annotation.annotationType().getName() + \" is a \" + Stereotype.class.getName() +\n                \" but it isn't annotated with \" + SecurityBindingType.class.getName());\n    }\n\n    public static boolean isMetaAnnotatedWithSecurityParameterBinding(Annotation annotation)\n    {\n        if (annotation.annotationType().isAnnotationPresent(SecurityParameterBinding.class))\n        {\n            return true;\n        }\n\n        List<Annotation> result = getAllAnnotations(annotation.annotationType().getAnnotations(),\n            new HashSet<Integer>());\n\n        for (Annotation foundAnnotation : result)\n        {\n            if (SecurityParameterBinding.class.isAssignableFrom(foundAnnotation.annotationType()))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public static List<Annotation> getAllAnnotations(Annotation[] annotations, Set<Integer> annotationPath)\n    {\n        List<Annotation> result = new ArrayList<Annotation>();\n\n        String annotationName;\n        for (Annotation annotation : annotations)\n        {\n            annotationName = annotation.annotationType().getName();\n            if (annotationName.startsWith(\"java.\")\n                    || annotationName.startsWith(\"javax.\")\n                    || annotationName.startsWith(\"jakarta.\"))\n            {\n                continue;\n            }\n\n            int annotationHashCode = hashCodeOfAnnotation(annotation);\n            if (!annotationPath.contains(annotationHashCode))\n            {\n                result.add(annotation);\n                annotationPath.add(annotationHashCode);\n                result.addAll(getAllAnnotations(annotation.annotationType().getAnnotations(), annotationPath));\n            }\n        }\n\n        return result;\n    }\n\n    private static int hashCodeOfAnnotation(Annotation annotation)\n    {\n        //with using System#identityHashCode instead, we could detect the real instances\n        //-> that would lead to multiple entries in the result which look the same (same type and members)\n\n        //to detect real cycles, nonbinding members aren't ignored here\n        return ReflectionUtils.calculateHashCodeOfAnnotation(annotation, false);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.security.impl.extension.SecurityExtension\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/nonbinding/CustomAuthorizer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.nonbinding;\n\nimport org.apache.deltaspike.security.api.authorization.Secures;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.interceptor.InvocationContext;\n\n@ApplicationScoped\npublic class CustomAuthorizer\n{\n    @Secures\n    @CustomSecurityBinding\n    public boolean doSecuredCheck(@ParamBindingWithNonbindingMember(info = \"test\") ParameterValue obj,\n                                  InvocationContext invocationContext)\n        throws Exception\n    {\n        if (invocationContext == null)\n        {\n            throw new IllegalArgumentException(\"no invocation-context found\");\n        }\n\n        return obj.isValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/nonbinding/CustomSecurityBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.nonbinding;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityBindingType;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({ TYPE, METHOD })\n\n@Documented\n\n@SecurityBindingType\npublic @interface CustomSecurityBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/nonbinding/ParamBindingWithNonbindingMember.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.nonbinding;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityParameterBinding;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({ PARAMETER })\n\n@Documented\n\n@SecurityParameterBinding\npublic @interface ParamBindingWithNonbindingMember\n{\n    @Nonbinding\n    String info();\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/nonbinding/ParameterValue.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.nonbinding;\n\npublic class ParameterValue\n{\n    private boolean value;\n\n    public ParameterValue(boolean value)\n    {\n        this.value = value;\n    }\n\n    public boolean isValue()\n    {\n        return value;\n    }\n\n    public void setValue(boolean value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/nonbinding/SecuredBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.nonbinding;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@CustomSecurityBinding\n@ApplicationScoped\npublic class SecuredBean\n{\n    public boolean getResult(@ParamBindingWithNonbindingMember(info = \"test\") ParameterValue parameterValue)\n    {\n        return parameterValue.isValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/nonbinding/SecurityParameterWithNonbindingMemberTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.nonbinding;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\n/**\n * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\n@RunWith(Arquillian.class)\npublic class SecurityParameterWithNonbindingMemberTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = SecurityParameterWithNonbindingMemberTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())\n                .addPackage(SecurityParameterWithNonbindingMemberTest.class.getPackage())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Test\n    //don't use expected = AccessDeniedException.class\n    //(reason: with some adapters it would lead to an ArquillianProxyException)\n    public void securityParameterWithNonbindingMember()\n    {\n        SecuredBean testBean = BeanProvider.getContextualReference(SecuredBean.class, false);\n        try\n        {\n            testBean.getResult(new ParameterValue(false));\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            //expected exception\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"Unexpected Exception: \" + e);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.EnterpriseArchive;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n\n/**\n * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\n@RunWith(Arquillian.class)\n@Category(EnterpriseArchiveProfileCategory.class)\npublic class SecuredAnnotationEarFileTest extends SecuredAnnotationTest\n{\n    public static final String CONFIG = \"deltaspike.bean-manager.delegate_lookup=false\\n\"; // Weld3 bug :(\n\n    @Deployment\n    public static EnterpriseArchive deployEar()\n    {\n        //workaround for tomee - the ear-file needs to have the same name as the war-file\n        String simpleName = SecuredAnnotationWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        JavaArchive configJar = ShrinkWrap.create(JavaArchive.class, \"dsConfig.jar\")\n            .addAsManifestResource(new StringAsset(CONFIG),\n                \"apache-deltaspike.properties\");\n\n        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + \".ear\")\n                .addAsLibrary(configJar)\n                .addAsModule(SecuredAnnotationWarFileTest.deploy());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.junit.Assert;\nimport org.junit.Test;\n\n\n/**\n * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\npublic abstract class SecuredAnnotationTest\n{\n    @Test\n    public void simpleInterceptorTestOk()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        Assert.assertEquals(\"result\", testBean.getResult());\n    }\n\n    @Test\n    public void simpleInterceptorTestParentOk()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        Assert.assertEquals(\"allfine\", testBean.someFineMethodFromParent());\n    }\n\n    @Test(expected = AccessDeniedException.class)\n    public void simpleInterceptorTestDenied()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        testBean.getBlockedResult();\n    }\n\n    @Test(expected = AccessDeniedException.class)\n    public void simpleInterceptorTestParentDenied()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        testBean.someBlockedMethodFromParent();\n    }\n\n    @Test\n    public void interceptorTestWithStereotypeOk()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        Assert.assertEquals(\"result\", testBean.getResult());\n    }\n\n    @Test\n    public void interceptorTestWithStereotypeParentOk()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        Assert.assertEquals(\"allfine\", testBean.someFineMethodFromParent());\n    }\n\n    @Test(expected = AccessDeniedException.class)\n    public void interceptorTestWithStereotypeDenied()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        testBean.getBlockedResult();\n    }\n\n    @Test(expected = AccessDeniedException.class)\n    public void interceptorTestWithStereotypeParentDenied()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        testBean.someBlockedMethodFromParent();\n    }\n\n    @Test\n    public void interceptorTestWithStereotypeWithValue()\n    {\n        SecuredBean5 testBean = BeanProvider.getContextualReference(SecuredBean5.class, false);\n\n        Assert.assertEquals(\"result\", testBean.getResult());\n\n        try\n        {\n            testBean.getBlockedResult();\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            //expected exception\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"Unexpected Exception: \" + e);\n        }\n    }\n\n    @Test\n    public void simpleInterceptorTestOnMethods()\n    {\n        SecuredBean3 testBean = BeanProvider.getContextualReference(SecuredBean3.class, false);\n\n        Assert.assertEquals(\"result\", testBean.getResult());\n\n        try\n        {\n            testBean.getBlockedResult();\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            //expected exception\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"Unexpected Exception: \" + e);\n        }\n    }\n\n    @Test\n    public void invocationOfMultipleSecuredStereotypes()\n    {\n        SecuredBean4 testBean = BeanProvider.getContextualReference(SecuredBean4.class, false);\n\n        TestAccessDecisionVoter1 voter1 = BeanProvider.getContextualReference(TestAccessDecisionVoter1.class, false);\n        TestAccessDecisionVoter2 voter2 = BeanProvider.getContextualReference(TestAccessDecisionVoter2.class, false);\n\n        Assert.assertFalse(voter1.isCalled());\n        Assert.assertFalse(voter2.isCalled());\n\n        Assert.assertEquals(\"result\", testBean.getResult());\n\n        Assert.assertTrue(voter1.isCalled());\n        Assert.assertTrue(voter2.isCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationWarFileTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.runner.RunWith;\n\n\n/**\n * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\n@RunWith(Arquillian.class)\npublic class SecuredAnnotationWarFileTest extends SecuredAnnotationTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        String simpleName = SecuredAnnotationWarFileTest.class.getSimpleName();\n        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);\n\n        return ShrinkWrap.create(WebArchive.class, archiveName + \".war\")\n                .addPackage(SecuredAnnotationWarFileTest.class.getPackage())\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBean1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@Secured(TestAccessDecisionVoter.class)\npublic class SecuredBean1 extends SomeParentClass\n{\n    public String getBlockedResult()\n    {\n        return \"blocked result\";\n    }\n\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBean2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@SecuredBeanWithStereotype\npublic class SecuredBean2 extends SomeParentClass\n{\n    public String getBlockedResult()\n    {\n        return \"blocked result\";\n    }\n\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBean3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class SecuredBean3\n{\n    @Secured(TestAccessDecisionVoter.class)\n    public String getBlockedResult()\n    {\n        return \"blocked result\";\n    }\n\n    @Secured(TestAccessDecisionVoter.class)\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBean4.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@SecuredBeanWithStereotype1\n@SecuredBeanWithStereotype2\npublic class SecuredBean4\n{\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBean5.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@SecuredBeanWithStereotype3(\"test\")\npublic class SecuredBean5\n{\n    public String getBlockedResult()\n    {\n        return \"blocked result\";\n    }\n\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBeanWithStereotype.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Stereotype\n\n@Retention(value = RUNTIME)\n@Target({TYPE, METHOD } )\n\n@Secured(TestAccessDecisionVoter.class)\npublic @interface SecuredBeanWithStereotype\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBeanWithStereotype1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Stereotype\n\n@Retention(value = RUNTIME)\n@Target({TYPE, METHOD } )\n\n@Secured(TestAccessDecisionVoter1.class)\npublic @interface SecuredBeanWithStereotype1\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBeanWithStereotype2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Stereotype\n\n@Retention(value = RUNTIME)\n@Target({TYPE, METHOD } )\n\n@Secured(TestAccessDecisionVoter2.class)\npublic @interface SecuredBeanWithStereotype2\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredBeanWithStereotype3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.Secured;\n\nimport jakarta.enterprise.inject.Stereotype;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Stereotype\n\n@Retention(value = RUNTIME)\n@Target({TYPE, METHOD } )\n\n@Secured(TestAccessDecisionVoter.class)\npublic @interface SecuredBeanWithStereotype3\n{\n    String value();\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SomeParentClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\n/**\n * To verify if the permission annotation also works on the methods\n * of the parent class\n */\npublic class SomeParentClass\n{\n    public String someFineMethodFromParent()\n    {\n        return \"allfine\";\n    }\n\n    public String someBlockedMethodFromParent()\n    {\n        return \"shouldgetblocked\";\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/TestAccessDecisionVoter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.interceptor.InvocationContext;\nimport java.lang.reflect.Method;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n *\n */\n@ApplicationScoped\npublic class TestAccessDecisionVoter implements AccessDecisionVoter\n{\n    private static final long serialVersionUID = 1331427301357439804L;\n\n    @Override\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)\n    {\n        Method method = accessDecisionVoterContext.<InvocationContext>getSource().getMethod();\n\n        if (!method.getName().contains(\"Blocked\"))\n        {\n            return Collections.emptySet();\n        }\n        return new HashSet<SecurityViolation>() {\n            private static final long serialVersionUID = 9033579102593906350L;\n\n            {\n                add(new SecurityViolation()\n                {\n                    private static final long serialVersionUID = -7990980050100180829L;\n\n                    @Override\n                    public String getReason()\n                    {\n                        return \"blocked\";\n                    }\n                });\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/TestAccessDecisionVoter1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport java.util.Collections;\nimport java.util.Set;\n\n@RequestScoped\npublic class TestAccessDecisionVoter1 implements AccessDecisionVoter\n{\n    private static final long serialVersionUID = 1331427301357439805L;\n\n    private boolean called;\n\n    @Override\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)\n    {\n        this.called = true;\n        return Collections.emptySet();\n    }\n\n    public boolean isCalled()\n    {\n        return called;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/TestAccessDecisionVoter2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.secured;\n\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;\nimport org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;\nimport org.apache.deltaspike.security.api.authorization.SecurityViolation;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport java.util.Collections;\nimport java.util.Set;\n\n@RequestScoped\npublic class TestAccessDecisionVoter2 implements AccessDecisionVoter\n{\n    private static final long serialVersionUID = 1331427301357439806L;\n\n    private boolean called;\n\n    @Override\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)\n    {\n        this.called = true;\n        return Collections.emptySet();\n    }\n\n    public boolean isCalled()\n    {\n        return called;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securitybinding/CustomAuthorizer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securitybinding;\n\nimport org.apache.deltaspike.security.api.authorization.Secures;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.interceptor.InvocationContext;\n\n@ApplicationScoped\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class CustomAuthorizer\n{\n    @Secures\n    @CustomSecurityBinding\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public boolean doSecuredCheck(InvocationContext invocationContext) throws Exception\n    {\n        return !invocationContext.getMethod().getName().contains(\"Blocked\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securitybinding/CustomSecurityBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securitybinding;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityBindingType;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({ TYPE, METHOD })\n\n@Documented\n\n//cdi annotations\n@SecurityBindingType\npublic @interface CustomSecurityBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securitybinding/SecuredBean1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securitybinding;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@CustomSecurityBinding\n@ApplicationScoped\npublic class SecuredBean1 extends SomeParentClass\n{\n    public String getBlockedResult()\n    {\n        return \"blocked result\";\n    }\n\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securitybinding/SecuredBean2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securitybinding;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class SecuredBean2\n{\n    @CustomSecurityBinding\n    public String getBlockedResult()\n    {\n        return \"blocked result\";\n    }\n\n    @CustomSecurityBinding\n    public String getResult()\n    {\n        return \"result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securitybinding/SecurityBindingTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securitybinding;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\n\n/**\n * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\n@RunWith(Arquillian.class)\npublic class SecurityBindingTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap.create(WebArchive.class, \"security-binding-test.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())\n                .addPackage(SecurityBindingTest.class.getPackage())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Test\n    public void simpleInterceptorTestOk()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        Assert.assertEquals(\"result\", testBean.getResult());\n    }\n\n    @Test\n    public void simpleInterceptorTestParentOk()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        Assert.assertEquals(\"allfine\", testBean.someFineMethodFromParent());\n    }\n\n    @Test\n    public void simpleInterceptorTestDenied()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        try {\n            testBean.getBlockedResult();\n            Assert.fail();\n        } catch (AccessDeniedException e) {\n            //expected\n        }\n    }\n\n    @Test\n    public void simpleInterceptorTestParentDenied()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        try {\n            testBean.someBlockedMethodFromParent();\n            Assert.fail();\n        } catch (AccessDeniedException e) {\n            //expected\n        }\n    }\n\n\n    @Test\n    public void simpleInterceptorTestOnMethodsOk()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        Assert.assertEquals(\"result\", testBean.getResult());\n    }\n\n    @Test\n    public void simpleInterceptorTestOnMethodsDenied()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        try {\n            testBean.getBlockedResult();\n        } catch (AccessDeniedException e) {\n            //expected\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securitybinding/SomeParentClass.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securitybinding;\n\n/**\n * To verify if the permission annotation also works on the methods\n * of the parent class\n */\npublic class SomeParentClass\n{\n    public String someFineMethodFromParent()\n    {\n        return \"allfine\";\n    }\n\n    public String someBlockedMethodFromParent()\n    {\n        return \"shouldgetblocked\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/CustomAuthorizer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\nimport org.apache.deltaspike.security.api.authorization.SecuredReturn;\nimport org.apache.deltaspike.security.api.authorization.Secures;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.interceptor.InvocationContext;\n\n@ApplicationScoped\npublic class CustomAuthorizer\n{\n    @Secures\n    @CustomSecurityBinding\n    public boolean doSecuredCheck(@MockParamBinding MockObject obj, InvocationContext invocationContext) \n        throws Exception\n    {\n        return obj.isValue();\n    }\n    \n    @Secures\n    @CustomSecurityBinding\n    public boolean doSecuredCheck(@MockParamBinding MockObject2 obj)\n    {\n    \treturn obj.isValue();\n    }\n    \n    @Secures\n    @CustomSecurityBinding\n    public boolean doSecuredCheckAfterMethodInvocation(@SecuredReturn MockObject obj)\n    {\n    \treturn obj.isValue();\n    }\n\n    @Secures\n    @CustomSecurityBinding\n    public boolean doSecuredCheckAfterMethodInvocationWithVoidMethod(@SecuredReturn Void result) {\n        return false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/CustomSecurityBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityBindingType;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({ TYPE, METHOD })\n\n@Documented\n\n//cdi annotations\n@SecurityBindingType\npublic @interface CustomSecurityBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/MethodInvocationParameter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\npublic class MethodInvocationParameter\n{\n\n    private boolean methodInvoked;\n\n    public boolean isMethodInvoked()\n    {\n        return methodInvoked;\n    }\n\n    public void setMethodInvoked(boolean value)\n    {\n        this.methodInvoked = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/MockObject.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\npublic class MockObject\n{\n\n    private boolean value;\n\n    public MockObject(boolean value)\n    {\n        this.value = value;\n    }\n\n    public boolean isValue()\n    {\n        return value;\n    }\n\n    public void setValue(boolean value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/MockObject2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\npublic class MockObject2\n{\n\n    private boolean value;\n\n    public MockObject2(boolean value)\n    {\n        this.value = value;\n    }\n\n    public boolean isValue()\n    {\n        return value;\n    }\n\n    public void setValue(boolean value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/MockParamBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport org.apache.deltaspike.security.api.authorization.SecurityParameterBinding;\n\n@Retention(value = RUNTIME)\n@Target({ PARAMETER })\n\n@Documented\n\n// CDI Annotation under test\n@SecurityParameterBinding\npublic @interface MockParamBinding\n{\n\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/SecuredBean1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@CustomSecurityBinding\n@ApplicationScoped\npublic class SecuredBean1\n{\n    public boolean getResult(@MockParamBinding MockObject mockObject)\n    {\n        return mockObject.isValue();\n    }\n\n    public boolean getResult(@MockParamBinding MockObject2 mockObject)\n    {\n        return mockObject.isValue();\n    }\n\n    public MockObject getResult(boolean value) {\n    \treturn new MockObject(value);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/SecuredBean2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class SecuredBean2\n{\n    @CustomSecurityBinding\n    public boolean getBlockedResult(@MockParamBinding MockObject mockObject)\n    {\n        return mockObject.isValue();\n    }\n\n    public boolean getResult(MockObject mockObject)\n    {\n        return mockObject.isValue();\n    }\n    \n    @CustomSecurityBinding\n    public void securityCheckAfterMethodInvocation(MethodInvocationParameter parameter) {\n        parameter.setMethodInvoked(true);\n    }\n    \n    @CustomSecurityBinding\n    public Void securityCheckAfterMethodInvocationWithVoidResult(MethodInvocationParameter parameter) {\n        parameter.setMethodInvoked(true);\n        return null;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/securityparameterbinding/SecurityParameterBindingTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.securityparameterbinding;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.security.api.authorization.AccessDeniedException;\nimport org.apache.deltaspike.test.util.ArchiveUtils;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\n/**\n * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}\n */\n@RunWith(Arquillian.class)\npublic class SecurityParameterBindingTest\n{\n    @Deployment\n    public static WebArchive deploy()\n    {\n        return ShrinkWrap.create(WebArchive.class, \"security-parameter-binding-test.war\")\n                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())\n                .addPackage(SecurityParameterBindingTest.class.getPackage())\n                .addAsWebInfResource(ArchiveUtils.getBeansXml(), \"beans.xml\");\n    }\n\n    @Test\n    public void simpleInterceptorThrowsExceptionWhenImproperlyAnnotated()\n    {\n        try\n        {\n            SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n            testBean.getResult(new MockObject2(false));\n            Assert.fail(\"Expected exception, IllegalStateException was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            // expected exception\n        }\n    }\n\n    @Test\n    public void simpleInterceptorDeniesTest()\n    {\n        try\n        {\n            SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n            testBean.getResult(new MockObject(false));\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            // expected\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"Unexpected Exception: \" + e);\n        }\n    }\n\n    @Test\n    public void simpleInterceptorAllowsTest()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        Assert.assertTrue(testBean.getResult(new MockObject(true)));\n    }\n\n    @Test\n    public void simpleInterceptorIgnoresUnsecuredMethods()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        Assert.assertTrue(testBean.getResult(new MockObject(true)));\n    }\n\n    @Test\n    public void simpleInterceptorTestOnMethodsDenies()\n    {\n        try\n        {\n            SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n            testBean.getBlockedResult(new MockObject(false));\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            // expected\n        }\n        catch (Exception e)\n        {\n            Assert.fail(\"Unexpected Exception: \" + e);\n        }\n    }\n\n    @Test\n    public void simpleInterceptorTestOnMethodsAllows()\n    {\n        SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n        Assert.assertTrue(testBean.getBlockedResult(new MockObject(true)));\n    }\n\n    @Test\n    public void afterInvocationAuthorizerCheckWithAllowedResult()\n    {\n        SecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        Assert.assertTrue(testBean.getResult(true).isValue());\n    }\n\n    @Test\n    public void afterInvocationAuthorizerCheckWithDeniedResult()\n    {\n        try\n        {\n        \tSecuredBean1 testBean = BeanProvider.getContextualReference(SecuredBean1.class, false);\n        \ttestBean.getResult(false);\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            // expected\n        }\n    }\n\n    @Test\n    public void afterInvocationAuthorizerWithoutReturnType()\n    {\n        MethodInvocationParameter parameter = new MethodInvocationParameter();\n        try\n        {\n            SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n            testBean.securityCheckAfterMethodInvocation(parameter);\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            Assert.assertTrue(parameter.isMethodInvoked());\n        }\n    }\n\n    @Test\n    public void afterInvocationAuthorizerWithVoidReturnType()\n    {\n        MethodInvocationParameter parameter = new MethodInvocationParameter();\n        try\n        {\n            SecuredBean2 testBean = BeanProvider.getContextualReference(SecuredBean2.class, false);\n            testBean.securityCheckAfterMethodInvocationWithVoidResult(parameter);\n            Assert.fail(\"AccessDeniedException expect, but was not thrown\");\n        }\n        catch (AccessDeniedException e)\n        {\n            Assert.assertTrue(parameter.isMethodInvoked());\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/Annotation1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({TYPE, ANNOTATION_TYPE } )\n\n@Annotation1(\"1\")\npublic @interface Annotation1\n{\n    String value();\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/Annotation2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({TYPE, ANNOTATION_TYPE } )\n\n@Annotation1(\"2\")\npublic @interface Annotation2\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/Annotation3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({TYPE, ANNOTATION_TYPE } )\n\n@Annotation1(\"3\")\n@Annotation2\npublic @interface Annotation3\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/AnnotationA.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({TYPE, ANNOTATION_TYPE } )\n\n@AnnotationC\npublic @interface AnnotationA\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/AnnotationB.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({ANNOTATION_TYPE } )\n\n@AnnotationA\npublic @interface AnnotationB\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/AnnotationC.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({ANNOTATION_TYPE } )\n\n@AnnotationB\npublic @interface AnnotationC\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/AnnotationX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(value = RUNTIME)\n@Target({TYPE, ANNOTATION_TYPE } )\n\n@AnnotationX\npublic @interface AnnotationX\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/DirectCycle.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\n@AnnotationX\npublic class DirectCycle\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/IndirectCycle.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\n@AnnotationA\npublic class IndirectCycle\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/IndirectCycleWithAnnotationMemberValues.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\n@Annotation1(\"usage\")\n@Annotation2\n@Annotation3\npublic class IndirectCycleWithAnnotationMemberValues\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/util/SecurityUtilsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.security.impl.authorization.util;\n\nimport org.apache.deltaspike.security.impl.util.SecurityUtils;\nimport org.junit.Assert;\nimport org.junit.Test;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashSet;\nimport java.util.List;\n\npublic class SecurityUtilsTest\n{\n    @Test\n    public void directCycleDetection()\n    {\n        List<Annotation> result = SecurityUtils.getAllAnnotations(\n            DirectCycle.class.getAnnotations(), new HashSet<Integer>());\n\n        Assert.assertNotNull(result);\n        Assert.assertEquals(1, result.size());\n    }\n\n    @Test\n    public void indirectCycleDetection()\n    {\n        List<Annotation> result = SecurityUtils.getAllAnnotations(\n            IndirectCycle.class.getAnnotations(), new HashSet<Integer>());\n\n        Assert.assertNotNull(result);\n        Assert.assertEquals(3, result.size());\n    }\n\n    @Test\n    public void indirectCycleDetection6()\n    {\n        List<Annotation> result = SecurityUtils.getAllAnnotations(\n            IndirectCycleWithAnnotationMemberValues.class.getAnnotations(), new HashSet<Integer>());\n\n        Assert.assertNotNull(result);\n        Assert.assertEquals(6, result.size());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.util;\n\nimport org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\n/**\n * This class contains helpers for building frequently used archives\n */\npublic class ArchiveUtils\n{\n    private ArchiveUtils() \n    {\n        // private ct\n    }\n    \n    public static JavaArchive[] getDeltaSpikeCoreAndSecurityArchive()\n    {\n        String[] excludedFiles;\n\n        excludedFiles = new String[]{\"META-INF.apache-deltaspike.properties\"};\n\n\n        return ShrinkWrapArchiveUtil.getArchives(null,\n                \"META-INF/beans.xml\",\n                new String[]{\"org.apache.deltaspike.core\",\n                        \"org.apache.deltaspike.test.category\",\n                        \"org.apache.deltaspike.security\"}, excludedFiles,\n                \"ds-core_and_security\");\n    }\n\n    public static Asset getBeansXml()\n    {\n        Asset beansXml = new StringAsset(\n            \"<beans>\" +\n                \"<interceptors>\" +\n                    \"<class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>\" +\n                \"</interceptors>\" +\n            \"</beans>\"\n        );\n\n        return beansXml;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/security/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/security/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>security-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Security-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>test-control-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-test-control-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Test-Control-Module API</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.testcontrol.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.enterprise.inject,\n            !org.apache.deltaspike.testcontrol.*,\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/TestControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api;\n\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.logging.ConsoleHandler;\nimport java.util.logging.Handler;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Optional control annotation for unit-tests\n */\n\n@Target({ TYPE, METHOD })\n@Retention(RUNTIME)\npublic @interface TestControl\n{\n    /**\n     * only supports contexts supported by ContextControl#startContext\n     * defaults: session- and request-scope\n     */\n    Class<? extends Annotation>[] startScopes() default { };\n\n    //TODO discuss callbacks\n\n    Class<? extends ProjectStage> projectStage() default ProjectStage.UnitTest.class;\n\n    /**\n     * only supported on test-class-level\n     */\n    Class<? extends Handler> logHandler() default ConsoleHandler.class;\n\n    /**\n     * Requires additional service-loader config\n     * Currently only supported on class-level\n     */\n    boolean startExternalContainers() default true;\n\n    /**\n     * allows to label alternative cdi-beans similar to global alternatives to bind them to 0-n tests\n     */\n    Class<? extends Label> activeAlternativeLabel() default Label.class;\n\n    //with cdi 1.1+ it can be used to implement labeled-alternatives without text based config\n    //(details see DELTASPIKE-1338)\n    /**\n     * low-level filter (mainly needed for special cases if labeled-alternatives aren't enough)\n     * @return the class-filter class which should be used for the current test-class\n     */\n    Class<? extends ClassFilter> classFilter() default ClassFilter.class;\n\n    interface Label\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestRunner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.junit;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.api.provider.BeanManagerProvider;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.literal.TestControlLiteral;\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\nimport org.apache.deltaspike.testcontrol.spi.TestAware;\nimport org.apache.deltaspike.testcontrol.spi.TestControlValidator;\nimport org.apache.deltaspike.testcontrol.spi.junit.TestStatementDecoratorFactory;\nimport org.junit.Test;\nimport org.junit.internal.runners.statements.FailOnTimeout;\nimport org.junit.runner.notification.RunNotifier;\nimport org.junit.runners.BlockJUnit4ClassRunner;\nimport org.junit.runners.model.FrameworkMethod;\nimport org.junit.runners.model.InitializationError;\nimport org.junit.runners.model.Statement;\nimport org.junit.runners.model.TestClass;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.Bean;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.inject.Singleton;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.Stack;\nimport java.util.concurrent.CopyOnWriteArraySet;\nimport java.util.logging.Handler;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport static java.lang.Boolean.TRUE;\n\n/**\n * A JUnit test runner to start up with a CDI or embedded JavaEE container.\n *\n * <p>If the underlying container supports it you can even pass in  a property file\n * to the bootstrap. You can configure the name of the configuration file via a\n * {@link org.apache.deltaspike.core.api.config.ConfigResolver} property named\n * <code>cdiTestRunnerConfig</code>. By default the name of the config file is\n * <code>cdiTestRunnerConfig.properties</code>.</p>\n */\npublic class CdiTestRunner extends BlockJUnit4ClassRunner\n{\n    private static final Logger LOGGER = Logger.getLogger(CdiTestRunner.class.getName());\n\n    private static final boolean USE_TEST_CLASS_AS_CDI_BEAN;\n    private static final boolean ALLOW_INJECTION_POINT_MANIPULATION;\n\n    private static Set<Integer> notifierIdentities = new CopyOnWriteArraySet<Integer>();\n\n    static\n    {\n        USE_TEST_CLASS_AS_CDI_BEAN = TestBaseConfig.ContainerIntegration.USE_TEST_CLASS_AS_CDI_BEAN;\n        ALLOW_INJECTION_POINT_MANIPULATION = TestBaseConfig.MockIntegration.ALLOW_MANUAL_INJECTION_POINT_MANIPULATION;\n    }\n\n    private static ThreadLocal<Boolean> automaticScopeHandlingActive = new ThreadLocal<Boolean>();\n\n    private static ThreadLocal<CdiTestRunner> currentTestRunner = new ThreadLocal<CdiTestRunner>();\n\n    private List<TestStatementDecoratorFactory> statementDecoratorFactories;\n\n    private ContainerAwareTestContext testContext;\n\n    public CdiTestRunner(Class<?> testClass) throws InitializationError\n    {\n        super(testClass);\n\n        TestControl testControl = testClass.getAnnotation(TestControl.class);\n        this.testContext = new ContainerAwareTestContext(testControl, null);\n\n        //benefits from the fallback-handling in ContainerAwareTestContext\n        Class<? extends Handler> logHandlerClass = this.testContext.getLogHandlerClass();\n\n        if (!Handler.class.equals(logHandlerClass))\n        {\n            try\n            {\n                LOGGER.addHandler(logHandlerClass.newInstance());\n            }\n            catch (Exception e)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(e);\n            }\n        }\n\n        this.statementDecoratorFactories = ServiceUtils.loadServiceImplementations(TestStatementDecoratorFactory.class);\n        Collections.sort(this.statementDecoratorFactories, new Comparator<TestStatementDecoratorFactory>()\n        {\n            @Override\n            public int compare(TestStatementDecoratorFactory f1, TestStatementDecoratorFactory f2)\n            {\n                return f1.getOrdinal() > f2.getOrdinal() ? 1 : -1;\n            }\n        });\n    }\n\n    @Override\n    public void run(RunNotifier runNotifier)\n    {\n        try\n        {\n            CdiTestSuiteRunner.getCdiTestRunnerExecutionRef().set(TRUE);\n\n            if (!CdiTestSuiteRunner.isContainerStarted()) //not called as a part of a test-suite\n            {\n                int identityHashCode = System.identityHashCode(runNotifier);\n                if (!notifierIdentities.contains(identityHashCode))\n                {\n                    addLogRunListener(runNotifier, identityHashCode);\n                }\n            }\n\n            super.run(runNotifier);\n\n        }\n        finally\n        {\n            CdiTestSuiteRunner.getCdiTestRunnerExecutionRef().set(null);\n            CdiTestSuiteRunner.getCdiTestRunnerExecutionRef().remove();\n        }\n    }\n\n    private static synchronized void addLogRunListener(RunNotifier notifier, int identityHashCode)\n    {\n        if (notifierIdentities.contains(identityHashCode))\n        {\n            return;\n        }\n        notifierIdentities.add(identityHashCode);\n        notifier.addListener(new CdiTestSuiteRunner.LogRunListener());\n    }\n\n    @Override\n    protected Statement methodInvoker(FrameworkMethod method, Object test)\n    {\n        return new ContainerAwareMethodInvoker(method, test);\n    }\n\n    @Override\n    protected void runChild(FrameworkMethod method, RunNotifier notifier)\n    {\n        currentTestRunner.set(this);\n\n        TestControl testControl = method.getAnnotation(TestControl.class);\n\n        ContainerAwareTestContext currentTestContext =\n                new ContainerAwareTestContext(testControl, this.testContext);\n\n        currentTestContext.applyBeforeMethodConfig(method.getMethod());\n\n        try\n        {\n            super.runChild(method, notifier);\n        }\n        finally\n        {\n            currentTestContext.applyAfterMethodConfig();\n        }\n    }\n\n    @Override\n    protected Object createTest() throws Exception\n    {\n        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n\n        Class<?> type = getTestClass().getJavaClass();\n        Set<Bean<?>> beans = beanManager.getBeans(type);\n\n        Object result;\n        if (!USE_TEST_CLASS_AS_CDI_BEAN || beans == null || beans.isEmpty())\n        {\n            result = super.createTest();\n            BeanProvider.injectFields(result); //fallback to simple injection\n        }\n        else\n        {\n            Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);\n            CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);\n            result = beanManager.getReference(bean, type, creationalContext);\n        }\n        return result;\n    }\n\n    //TODO use Rules instead\n    @Override\n    protected Statement withBefores(FrameworkMethod method, Object target, Statement statement)\n    {\n        Statement result = super.withBefores(method, target, statement);\n        result = wrapBeforeStatement(result, getTestClass(), target);\n        return result;\n    }\n\n    private Statement wrapBeforeStatement(Statement statement, TestClass testClass, Object target)\n    {\n        for (TestStatementDecoratorFactory statementHandler : this.statementDecoratorFactories)\n        {\n            Statement result = statementHandler.createBeforeStatement(statement, testClass, target);\n            if (result != null)\n            {\n                statement = result;\n            }\n        }\n        return statement;\n    }\n\n    //TODO use Rules instead\n    @Override\n    protected Statement withAfters(FrameworkMethod method,\n                                   final Object target,\n                                   final Statement statement)\n    {\n        Statement result = super.withAfters(method, target, statement);\n        result = wrapAfterStatement(result, getTestClass(), target);\n        return result;\n    }\n\n    private Statement wrapAfterStatement(Statement statement, TestClass testClass, Object target)\n    {\n        for (TestStatementDecoratorFactory statementHandler : this.statementDecoratorFactories)\n        {\n            Statement result = statementHandler.createAfterStatement(statement, testClass, target);\n            if (result != null)\n            {\n                statement = result;\n            }\n        }\n        return statement;\n    }\n\n    @Override\n    protected Statement withBeforeClasses(Statement statement)\n    {\n        return new BeforeClassStatement(super.withBeforeClasses(statement),\n            this.testContext,\n            getTestClass().getJavaClass());\n    }\n\n    @Override\n    protected Statement withAfterClasses(Statement statement)\n    {\n        Statement result = super.withAfterClasses(statement);\n        if (!CdiTestSuiteRunner.isContainerStarted())\n        {\n            return new AfterClassStatement(result, this.testContext);\n        }\n        return result;\n    }\n\n    //TODO use Rules instead\n    @Override\n    protected Statement withPotentialTimeout(FrameworkMethod method, Object test, Statement next)\n    {\n        Statement result = super.withPotentialTimeout(method, test, next);\n\n        if (result instanceof FailOnTimeout)\n        {\n            return new Statement()\n            {\n                @Override\n                public void evaluate() throws Throwable\n                {\n                    throw new RuntimeException(\"@\" + Test.class.getName() + \"#timeout isn't supported\");\n                }\n            };\n        }\n\n        return result;\n    }\n\n    private class ContainerAwareMethodInvoker extends Statement\n    {\n        private final FrameworkMethod method;\n        private final Object originalTarget;\n\n        public ContainerAwareMethodInvoker(FrameworkMethod method, Object originalTarget)\n        {\n            this.method = method;\n            this.originalTarget = originalTarget;\n        }\n\n        @Override\n        public void evaluate() throws Throwable\n        {\n            BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n            Class<?> type = this.method.getMethod().getDeclaringClass();\n            Set<Bean<?>> beans = beanManager.getBeans(type);\n\n            if (!USE_TEST_CLASS_AS_CDI_BEAN || beans == null || beans.isEmpty())\n            {\n                if (!ALLOW_INJECTION_POINT_MANIPULATION)\n                {\n                    BeanProvider.injectFields(this.originalTarget); //fallback to simple injection\n                }\n                invokeMethod(this.originalTarget);\n            }\n            else\n            {\n                Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);\n\n                CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);\n\n                Object target = beanManager.getReference(bean, type, creationalContext);\n\n                try\n                {\n                    invokeMethod(target);\n                }\n                finally\n                {\n                    if (bean.getScope().equals(Dependent.class))\n                    {\n                        bean.destroy(target, creationalContext);\n                    }\n                }\n            }\n        }\n\n        private void invokeMethod(Object target)\n        {\n            try\n            {\n                this.method.invokeExplosively(target);\n            }\n            catch (Throwable throwable)\n            {\n                throw ExceptionUtils.throwAsRuntimeException(throwable);\n            }\n        }\n    }\n\n    private class BeforeClassStatement extends Statement\n    {\n        private final Statement wrapped;\n        private final ContainerAwareTestContext testContext;\n        private final Class testClass;\n\n        BeforeClassStatement(Statement statement, ContainerAwareTestContext testContext, Class testClass)\n        {\n            this.wrapped = statement;\n            this.testContext = testContext;\n            this.testClass = testClass;\n        }\n\n        @Override\n        public void evaluate() throws Throwable\n        {\n            testContext.applyBeforeClassConfig(this.testClass);\n            wrapped.evaluate();\n        }\n    }\n\n    private class AfterClassStatement extends Statement\n    {\n        private final Statement wrapped;\n        private final ContainerAwareTestContext testContext;\n\n        public AfterClassStatement(Statement statement,\n                                   ContainerAwareTestContext testContext)\n        {\n            this.wrapped = statement;\n            this.testContext = testContext;\n        }\n\n        @Override\n        public void evaluate() throws Throwable\n        {\n            try\n            {\n                wrapped.evaluate();\n            }\n            finally\n            {\n                testContext.applyAfterClassConfig();\n            }\n        }\n    }\n\n    private static class ContainerAwareTestContext\n    {\n        private ContainerAwareTestContext parent;\n\n        private final ProjectStage projectStage;\n        private final TestControl testControl;\n\n        private ProjectStage previousProjectStage;\n\n        private boolean containerStarted = false; //only true for the layer it was started in\n\n        private Stack<Class<? extends Annotation>> startedScopes = new Stack<Class<? extends Annotation>>();\n\n        private List<ExternalContainer> externalContainers;\n\n        ContainerAwareTestContext(TestControl testControl, ContainerAwareTestContext parent)\n        {\n            this.parent = parent;\n\n            Class<? extends ProjectStage> foundProjectStageClass;\n            if (testControl == null)\n            {\n                this.testControl = new TestControlLiteral();\n                if (parent != null)\n                {\n                    foundProjectStageClass = parent.testControl.projectStage();\n                }\n                else\n                {\n                    foundProjectStageClass = this.testControl.projectStage();\n                }\n            }\n            else\n            {\n                this.testControl = testControl;\n                foundProjectStageClass = this.testControl.projectStage();\n            }\n            this.projectStage = ProjectStage.valueOf(foundProjectStageClass.getSimpleName());\n\n            ProjectStageProducer.setProjectStage(this.projectStage);\n        }\n\n        boolean isContainerStarted()\n        {\n            return this.containerStarted || (this.parent != null && this.parent.isContainerStarted()) ||\n                    CdiTestSuiteRunner.isContainerStarted();\n        }\n\n        Class<? extends Handler> getLogHandlerClass()\n        {\n            return this.testControl.logHandler();\n        }\n\n        void applyBeforeClassConfig(Class<?> testClass)\n        {\n            CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n            if (!isContainerStarted())\n            {\n                if (!CdiTestSuiteRunner.isContainerStarted())\n                {\n                    // We are setting this system property to make the deployment for Weld \"flat\"\n                    // This (amongst other things) means that alternatives enabled via beans.xml will be \n                    // enabled globally\n                    // Beginning with Weld 2.x you could use Weld.property(), but here we depend on Weld 1.x API\n                    // Note that Weld 1 was \"flat\" anyway, so this property only affects newer versions of Weld\n                    // System.setProperty(\"org.jboss.weld.se.archive.isolation\", \"false\");\n                    // Weld 5.0: https://docs.jboss.org/weld/reference/5.0.0.Final/en-US/html_single/#_bean_archive_isolation\n                    System.setProperty(\"org.jboss.weld.environment.servlet.archive.isolation\", \"false\");\n\n                    CdiTestSuiteRunner.applyTestSpecificMetaData(testClass);\n\n                    container.boot(CdiTestSuiteRunner.getTestContainerConfig());\n                    setContainerStarted();\n\n                    bootExternalContainers(testClass);\n                }\n            }\n\n            List<Class<? extends Annotation>> restrictedScopes = new ArrayList<Class<? extends Annotation>>();\n\n            //controlled by the container and not supported by weld:\n            restrictedScopes.add(ApplicationScoped.class);\n            restrictedScopes.add(Singleton.class);\n\n            if (this.parent == null && this.testControl.getClass().equals(TestControlLiteral.class))\n            {\n                //skip scope-handling if @TestControl isn't used explicitly on the test-class -> TODO re-visit it\n                restrictedScopes.add(RequestScoped.class);\n                restrictedScopes.add(SessionScoped.class);\n            }\n\n            startScopes(container, testClass, null, restrictedScopes.toArray(new Class[restrictedScopes.size()]));\n        }\n\n        private void bootExternalContainers(Class testClass)\n        {\n            if (!this.testControl.startExternalContainers())\n            {\n                return;\n            }\n\n            if (this.externalContainers == null)\n            {\n                List<ExternalContainer> configuredExternalContainers =\n                    ServiceUtils.loadServiceImplementations(ExternalContainer.class);\n                Collections.sort(configuredExternalContainers, new Comparator<ExternalContainer>()\n                {\n                    @Override\n                    public int compare(ExternalContainer ec1, ExternalContainer ec2)\n                    {\n                        return ec1.getOrdinal() > ec2.getOrdinal() ? 1 : -1;\n                    }\n                });\n\n                this.externalContainers = new ArrayList<ExternalContainer>(configuredExternalContainers.size());\n\n                ExternalContainer externalContainerBean;\n                for (ExternalContainer externalContainer : configuredExternalContainers)\n                {\n                    //needed to use cdi-observers in the container optionally\n                    externalContainerBean = BeanProvider.getContextualReference(externalContainer.getClass(), true);\n\n                    if (externalContainerBean != null)\n                    {\n                        this.externalContainers.add(externalContainerBean);\n                    }\n                    else\n                    {\n                        this.externalContainers.add(externalContainer);\n                    }\n                }\n\n                for (ExternalContainer externalContainer : this.externalContainers)\n                {\n                    try\n                    {\n                        if (externalContainer instanceof TestAware)\n                        {\n                            ((TestAware)externalContainer).setTestClass(testClass);\n                        }\n                        externalContainer.boot();\n                    }\n                    catch (RuntimeException e)\n                    {\n                        Logger.getLogger(CdiTestRunner.class.getName()).log(Level.WARNING,\n                                \"booting \" + externalContainer.getClass().getName() + \" failed\", e);\n                    }\n                }\n            }\n        }\n\n        void applyAfterClassConfig()\n        {\n            CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n            stopStartedScopes(container);\n\n            if (this.containerStarted)\n            {\n                if (CdiTestSuiteRunner.isStopContainerAllowed())\n                {\n                    shutdownExternalContainers();\n\n                    container.shutdown(); //stop the container on the same level which started it\n                    CdiTestSuiteRunner.setContainerStarted(false);\n                }\n            }\n        }\n\n        private void shutdownExternalContainers()\n        {\n            if (this.externalContainers == null)\n            {\n                return;\n            }\n\n            for (ExternalContainer externalContainer : this.externalContainers)\n            {\n                try\n                {\n                    externalContainer.shutdown();\n                }\n                catch (RuntimeException e)\n                {\n                    Logger.getLogger(CdiTestRunner.class.getName()).log(Level.WARNING,\n                            \"shutting down \" + externalContainer.getClass().getName() + \" failed\", e);\n                }\n            }\n        }\n\n        void applyBeforeMethodConfig(Method testMethod)\n        {\n            this.previousProjectStage = ProjectStageProducer.getInstance().getProjectStage();\n            ProjectStageProducer.setProjectStage(this.projectStage);\n\n            setCurrentTestMethod(testMethod);\n            startScopes(CdiContainerLoader.getCdiContainer(), testMethod.getDeclaringClass(), testMethod);\n        }\n\n        void applyAfterMethodConfig()\n        {\n            try\n            {\n                stopStartedScopes(CdiContainerLoader.getCdiContainer());\n            }\n            finally\n            {\n                setCurrentTestMethod(null);\n                ProjectStageProducer.setProjectStage(previousProjectStage);\n                previousProjectStage = null;\n                currentTestRunner.set(null);\n                currentTestRunner.remove();\n            }\n        }\n\n        void setContainerStarted()\n        {\n            this.containerStarted = true;\n            CdiTestSuiteRunner.setContainerStarted(true);\n        }\n\n        private void startScopes(CdiContainer container,\n                                 Class testClass,\n                                 Method testMethod,\n                                 Class<? extends Annotation>... restrictedScopes)\n        {\n            try\n            {\n                automaticScopeHandlingActive.set(TRUE);\n\n                ContextControl contextControl = container.getContextControl();\n\n                List<Class<? extends Annotation>> scopeClasses = new ArrayList<Class<? extends Annotation>>();\n\n                Collections.addAll(scopeClasses, this.testControl.startScopes());\n\n                if (scopeClasses.isEmpty())\n                {\n                    addScopesForDefaultBehavior(scopeClasses);\n                }\n                else\n                {\n                    List<TestControlValidator> testControlValidatorList =\n                        ServiceUtils.loadServiceImplementations(TestControlValidator.class);\n\n                    for (TestControlValidator testControlValidator : testControlValidatorList)\n                    {\n                        if (testControlValidator instanceof TestAware)\n                        {\n                            if (testMethod != null)\n                            {\n                                ((TestAware)testControlValidator).setTestMethod(testMethod);\n                            }\n                            ((TestAware)testControlValidator).setTestClass(testClass);\n                        }\n                        try\n                        {\n                            testControlValidator.validate(this.testControl);\n                        }\n                        finally\n                        {\n                            if (testControlValidator instanceof TestAware)\n                            {\n                                ((TestAware)testControlValidator).setTestClass(null);\n                                ((TestAware)testControlValidator).setTestMethod(null);\n                            }\n                        }\n                    }\n                }\n\n                for (Class<? extends Annotation> scopeAnnotation : scopeClasses)\n                {\n                    if (this.parent != null && this.parent.isScopeStarted(scopeAnnotation))\n                    {\n                        continue;\n                    }\n\n                    if (isRestrictedScope(scopeAnnotation, restrictedScopes))\n                    {\n                        continue;\n                    }\n\n                    try\n                    {\n                        //force a clean context - TODO discuss onScopeStopped call\n                        contextControl.stopContext(scopeAnnotation);\n\n                        contextControl.startContext(scopeAnnotation);\n                        this.startedScopes.add(scopeAnnotation);\n\n                        onScopeStarted(scopeAnnotation);\n                    }\n                    catch (RuntimeException e)\n                    {\n                        Logger logger = Logger.getLogger(CdiTestRunner.class.getName());\n                        logger.setLevel(Level.SEVERE);\n                        logger.log(Level.SEVERE, \"failed to start scope @\" + scopeAnnotation.getName(), e);\n                    }\n                }\n            }\n            finally\n            {\n                automaticScopeHandlingActive.set(null);\n                automaticScopeHandlingActive.remove();\n            }\n        }\n\n        private void addScopesForDefaultBehavior(List<Class<? extends Annotation>> scopeClasses)\n        {\n            if (this.parent != null && !this.parent.isScopeStarted(RequestScoped.class))\n            {\n                if (!scopeClasses.contains(RequestScoped.class))\n                {\n                    scopeClasses.add(RequestScoped.class);\n                }\n            }\n            if (this.parent != null && !this.parent.isScopeStarted(SessionScoped.class))\n            {\n                if (!scopeClasses.contains(SessionScoped.class))\n                {\n                    scopeClasses.add(SessionScoped.class);\n                }\n            }\n        }\n\n        private boolean isRestrictedScope(Class<? extends Annotation> scopeAnnotation,\n                                          Class<? extends Annotation>[] restrictedScopes)\n        {\n            for (Class<? extends Annotation> restrictedScope : restrictedScopes)\n            {\n                if (scopeAnnotation.equals(restrictedScope))\n                {\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        private boolean isScopeStarted(Class<? extends Annotation> scopeAnnotation)\n        {\n            return this.startedScopes.contains(scopeAnnotation);\n        }\n\n        private void stopStartedScopes(CdiContainer container)\n        {\n            try\n            {\n                automaticScopeHandlingActive.set(TRUE);\n\n                while (!this.startedScopes.empty())\n                {\n                    Class<? extends Annotation> scopeAnnotation = this.startedScopes.pop();\n                    //TODO check if context was started by parent\n                    try\n                    {\n                        container.getContextControl().stopContext(scopeAnnotation);\n                        onScopeStopped(scopeAnnotation);\n                    }\n                    catch (RuntimeException e)\n                    {\n                        Logger logger = Logger.getLogger(CdiTestRunner.class.getName());\n                        logger.setLevel(Level.SEVERE);\n                        logger.log(Level.SEVERE, \"failed to stop scope @\" + scopeAnnotation.getName(), e);\n                    }\n                }\n            }\n            finally\n            {\n                automaticScopeHandlingActive.remove();\n                automaticScopeHandlingActive.set(null);\n            }\n        }\n\n        private void onScopeStarted(Class<? extends Annotation> scopeClass)\n        {\n            List<ExternalContainer> externalContainerList = collectExternalContainers(this);\n\n            for (ExternalContainer externalContainer : externalContainerList)\n            {\n                externalContainer.startScope(scopeClass);\n            }\n        }\n\n        private void onScopeStopped(Class<? extends Annotation> scopeClass)\n        {\n            List<ExternalContainer> externalContainerList = collectExternalContainers(this);\n\n            for (ExternalContainer externalContainer : externalContainerList)\n            {\n                externalContainer.stopScope(scopeClass);\n            }\n        }\n\n        private static List<ExternalContainer> collectExternalContainers(ContainerAwareTestContext testContext)\n        {\n            List<ExternalContainer> result = new ArrayList<ExternalContainer>();\n\n            if (testContext.externalContainers != null)\n            {\n                result.addAll(testContext.externalContainers);\n            }\n\n            if (testContext.parent != null)\n            {\n                result.addAll(collectExternalContainers(testContext.parent));\n            }\n            return result;\n        }\n\n        private void setCurrentTestMethod(Method testMethod)\n        {\n            List<ExternalContainer> externalContainerList = collectExternalContainers(this);\n\n            for (ExternalContainer externalContainer : externalContainerList)\n            {\n                if (externalContainer instanceof TestAware)\n                {\n                    try\n                    {\n                        ((TestAware)externalContainer).setTestMethod(testMethod);\n                    }\n                    catch (Throwable t)\n                    {\n                        //with a correct setup it shouldn't happen\n                        //TODO better handling for invalid constellations\n                        Assert.fail(t.getMessage());\n                    }\n                }\n            }\n        }\n    }\n\n    public static Boolean isAutomaticScopeHandlingActive()\n    {\n        return automaticScopeHandlingActive.get();\n    }\n\n    public static List<ExternalContainer> getActiveExternalContainers()\n    {\n        CdiTestRunner cdiTestRunner = currentTestRunner.get();\n\n        if (cdiTestRunner == null ||\n            cdiTestRunner.testContext == null ||\n            cdiTestRunner.testContext.externalContainers == null)\n        {\n            return Collections.emptyList();\n        }\n\n        return Collections.unmodifiableList(cdiTestRunner.testContext.externalContainers);\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestSuiteRunner.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.junit;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.PropertyLoader;\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.junit.runner.Description;\nimport org.junit.runner.Runner;\nimport org.junit.runner.notification.Failure;\nimport org.junit.runner.notification.RunListener;\nimport org.junit.runner.notification.RunNotifier;\nimport org.junit.runners.Suite;\nimport org.junit.runners.model.InitializationError;\nimport org.junit.runners.model.RunnerBuilder;\n\nimport jakarta.inject.Named;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport static java.lang.Boolean.TRUE;\n\n@SuppressWarnings(\"UnusedDeclaration\")\npublic class CdiTestSuiteRunner extends Suite\n{\n    /**\n     * Configuration key to define a custom configuration properties file.\n     * e.g.:\n     * deltaspike.testcontrol.test-container.config-file=META-INF/dsTestContainerBootConfig.properties\n     */\n    public static final String CUSTOM_TEST_CONTAINER_CONFIG_FILE_KEY =\n        \"deltaspike.testcontrol.test-container.config-file\";\n\n    /**\n     * Default resource location of the property file which gets used\n     * for the container bootstrap.\n     * This value can be overridden by using {@link #CUSTOM_TEST_CONTAINER_CONFIG_FILE_KEY}\n     */\n    public static final String DEFAULT_TEST_CONTAINER_CONFIG_FILE_NAME =\n        \"META-INF/apache-deltaspike_test-container\";\n\n    private static final boolean STOP_CONTAINER;\n\n    private static final ThreadLocal<Boolean> IS_CDI_TEST_RUNNER_EXECUTION = new ThreadLocal<Boolean>();\n\n    private static volatile boolean containerStarted; //TODO\n\n    private final Class<?> testSuiteClass;\n\n    static\n    {\n        STOP_CONTAINER = TestBaseConfig.ContainerIntegration.STOP_CONTAINER;\n    }\n\n    public CdiTestSuiteRunner(Class<?> klass, RunnerBuilder builder) throws InitializationError\n    {\n        super(klass, builder);\n        this.testSuiteClass = klass;\n    }\n\n    protected CdiTestSuiteRunner(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError\n    {\n        super(klass, suiteClasses);\n        this.testSuiteClass = klass;\n    }\n\n    protected CdiTestSuiteRunner(RunnerBuilder builder, Class<?> klass, Class<?>[] suiteClasses)\n        throws InitializationError\n    {\n        super(builder, klass, suiteClasses);\n        this.testSuiteClass = klass;\n    }\n\n    protected CdiTestSuiteRunner(Class<?> klass, List<Runner> runners) throws InitializationError\n    {\n        super(klass, runners);\n        this.testSuiteClass = klass;\n    }\n\n    @Override\n    public void run(RunNotifier notifier)\n    {\n        if (this.testSuiteClass == null)\n        {\n            throw new IllegalStateException(\"no test-suite class found\");\n        }\n\n        CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n        if (!containerStarted)\n        {\n            applyTestSpecificMetaData(getTestClass().getJavaClass());\n\n            container.boot(getTestContainerConfig());\n            containerStarted = true;\n        }\n\n        notifier.addListener(new LogRunListener());\n\n        try\n        {\n            super.run(notifier);\n        }\n        finally\n        {\n            if (STOP_CONTAINER)\n            {\n                container.shutdown();\n                containerStarted = false;\n            }\n        }\n    }\n\n\n    public static boolean isContainerStarted()\n    {\n        return containerStarted;\n    }\n\n    static Boolean isStopContainerAllowed()\n    {\n        return STOP_CONTAINER;\n    }\n\n    static ThreadLocal<Boolean> getCdiTestRunnerExecutionRef()\n    {\n        return IS_CDI_TEST_RUNNER_EXECUTION;\n    }\n\n    static void setContainerStarted(boolean containerStarted)\n    {\n        CdiTestSuiteRunner.containerStarted = containerStarted;\n    }\n\n    static class LogRunListener extends RunListener\n    {\n        private final Logger logger = Logger.getLogger(LogRunListener.class.getName());\n\n        LogRunListener()\n        {\n        }\n\n        @Override\n        public void testStarted(Description description) throws Exception\n        {\n            if (TRUE.equals(IS_CDI_TEST_RUNNER_EXECUTION.get()))\n            {\n                this.logger.info(\"[run] \" + description.getClassName() + \"#\" + description.getMethodName());\n            }\n\n            super.testRunStarted(description);\n        }\n\n        @Override\n        public void testFinished(Description description) throws Exception\n        {\n            if (TRUE.equals(IS_CDI_TEST_RUNNER_EXECUTION.get()))\n            {\n                this.logger.info(\"[finished] \" + description.getClassName() + \"#\" + description.getMethodName());\n            }\n\n            super.testFinished(description);\n        }\n\n        @Override\n        public void testFailure(Failure failure) throws Exception\n        {\n            if (TRUE.equals(IS_CDI_TEST_RUNNER_EXECUTION.get()))\n            {\n                Description description = failure.getDescription();\n                this.logger.log(Level.SEVERE, \"[failed] \" + description.getClassName() + \"#\" + description.getMethodName() +\n                    \" message: \" + failure.getMessage());\n            }\n\n            super.testFailure(failure);\n        }\n    }\n\n    public static Properties getTestContainerConfig()\n    {\n        String cdiTestRunnerConfig = ConfigResolver.getProjectStageAwarePropertyValue(\n            CUSTOM_TEST_CONTAINER_CONFIG_FILE_KEY, DEFAULT_TEST_CONTAINER_CONFIG_FILE_NAME);\n        return PropertyLoader.getProperties(cdiTestRunnerConfig);\n    }\n\n    //just here, because all shared methods are in this class\n    static void applyTestSpecificMetaData(Class<?> currentAnnotationSource)\n    {\n        TestControl testControl = currentAnnotationSource.getAnnotation(TestControl.class);\n        String activeAlternativeLabel = checkForLabeledAlternativeConfig(testControl);\n\n        initTestEnvConfig(currentAnnotationSource, activeAlternativeLabel, testControl);\n    }\n\n    private static String checkForLabeledAlternativeConfig(TestControl testControl)\n    {\n        String activeAlternativeLabel = \"\";\n\n        if (testControl != null)\n        {\n            Class<? extends TestControl.Label> activeTypedAlternativeLabel =\n                    testControl.activeAlternativeLabel();\n\n            if (!TestControl.Label.class.equals(activeTypedAlternativeLabel))\n            {\n                Named labelName = activeTypedAlternativeLabel.getAnnotation(Named.class);\n\n                if (labelName != null)\n                {\n                    activeAlternativeLabel = labelName.value();\n                }\n                else\n                {\n                    String labelClassName = activeTypedAlternativeLabel.getSimpleName();\n                    activeAlternativeLabel = labelClassName.substring(0, 1).toLowerCase();\n\n                    if (labelClassName.length() > 1)\n                    {\n                        activeAlternativeLabel += labelClassName.substring(1);\n                    }\n                }\n            }\n        }\n        return activeAlternativeLabel;\n    }\n\n    private static void initTestEnvConfig(Class<?> testClass, String activeAlternativeLabel, TestControl testControl)\n    {\n        if (ClassDeactivationUtils.isActivated(TestConfigSource.class))\n        {\n            TestConfigSource testConfigSource = null;\n\n            for (ConfigSource configSource : ConfigResolver.getConfigSources())\n            {\n                if (configSource instanceof TestConfigSource)\n                {\n                    //if it happens: parallel test-execution can't be supported with labeled alternatives\n                    testConfigSource = (TestConfigSource) configSource;\n                }\n            }\n\n            if (testConfigSource == null)\n            {\n                testConfigSource = new TestConfigSource();\n                ConfigResolver.addConfigSources(Arrays.<ConfigSource>asList(testConfigSource));\n            }\n\n            //always set it even if it is empty (it might overrule the value of the prev. test\n            testConfigSource.getProperties().put(\"activeAlternativeLabel\", activeAlternativeLabel);\n\n            testConfigSource.getProperties().put(\"activeAlternativeLabelSource\", testClass.getName());\n\n            if (testControl != null)\n            {\n                testConfigSource.getProperties().put(TestControl.class.getName(), testClass.getName());\n                testConfigSource.getProperties().put(ClassFilter.class.getName(), testControl.classFilter().getName());\n            }\n            else\n            {\n                //reset it to avoid leaks between tests\n                testConfigSource.getProperties().put(TestControl.class.getName(), TestControl.class.getName());\n                testConfigSource.getProperties().put(ClassFilter.class.getName(), ClassFilter.class.getName());\n            }\n        }\n        else\n        {\n            //always set it even if it is empty (it might overrule the value of the prev. test\n            System.setProperty(\"activeAlternativeLabel\", activeAlternativeLabel); //will be picked up by ds-core\n\n            System.setProperty(\"activeAlternativeLabelSource\", testClass.getName()); //can be used for custom logic\n\n            if (testControl != null) //can be used for custom logic\n            {\n                System.setProperty(TestControl.class.getName(), testClass.getName());\n                System.setProperty(ClassFilter.class.getName(), testControl.classFilter().getName());\n            }\n            else\n            {\n                //reset it to avoid leaks between tests\n                System.setProperty(TestControl.class.getName(), TestControl.class.getName());\n                System.setProperty(ClassFilter.class.getName(), ClassFilter.class.getName());\n            }\n        }\n    }\n\n    //config-sources are already stored per classloader\n    //keep it public to allow type-safe deactivation (if needed)\n    public static class TestConfigSource implements ConfigSource, Deactivatable\n    {\n        private Map<String, String> testConfig = new ConcurrentHashMap<String, String>();\n\n        @Override\n        public int getOrdinal()\n        {\n            return Integer.MIN_VALUE;\n        }\n\n        @Override\n        public Map<String, String> getProperties()\n        {\n            return testConfig;\n        }\n\n        @Override\n        public String getPropertyValue(String key)\n        {\n            return testConfig.get(key);\n        }\n\n        @Override\n        public String getConfigName()\n        {\n            return \"ds-test-config\";\n        }\n\n        @Override\n        public boolean isScannable()\n        {\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/TestBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.junit;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig;\n\npublic interface TestBaseConfig extends DeltaSpikeBaseConfig\n{\n    interface ContainerIntegration\n    {\n        //default is false to improve the compatibility with @Before and @After\n        Boolean USE_TEST_CLASS_AS_CDI_BEAN = ConfigResolver.resolve(\"deltaspike.testcontrol.use_test_class_as_cdi_bean\")\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        Boolean STOP_CONTAINER = ConfigResolver.resolve(\"deltaspike.testcontrol.stop_container\")\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.TRUE)\n                .getValue();\n    }\n\n    interface MockIntegration\n    {\n        String ALLOW_MOCKED_BEANS_KEY = \"deltaspike.testcontrol.mock-support.allow_mocked_beans\";\n        String ALLOW_MOCKED_PRODUCERS_KEY = \"deltaspike.testcontrol.mock-support.allow_mocked_producers\";\n        String ALLOW_MANUAL_INJECTION_POINT_MANIPULATION_KEY =\n            \"deltaspike.testcontrol.mock-support.allow_manual_injection-point_manipulation\";\n\n        Boolean ALLOW_MOCKED_BEANS = ConfigResolver.resolve(ALLOW_MOCKED_BEANS_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        Boolean ALLOW_MOCKED_PRODUCERS = ConfigResolver.resolve(ALLOW_MOCKED_PRODUCERS_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        //if enabled it's possible to change the value of injection-points after the injection-process and\n        //before test-execution. that allows to replace injection-points (e.g. with a mock) conditionally\n        //via a test-rule or @Before\n        Boolean ALLOW_MANUAL_INJECTION_POINT_MANIPULATION =\n            ConfigResolver.resolve(ALLOW_MANUAL_INJECTION_POINT_MANIPULATION_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/literal/TestControlLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.literal;\n\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\nimport java.lang.annotation.Annotation;\nimport java.util.logging.Handler;\n\npublic class TestControlLiteral extends AnnotationLiteral<TestControl> implements TestControl\n{\n    private static final long serialVersionUID = 6684011035751678259L;\n\n    private final TestControl defaultInstance;\n\n    public TestControlLiteral()\n    {\n        this.defaultInstance = AnnotationInstanceProvider.of(TestControl.class);\n    }\n\n    @Override\n    public Class<? extends Annotation>[] startScopes()\n    {\n        return defaultInstance.startScopes();\n    }\n\n    @Override\n    public Class<? extends ProjectStage> projectStage()\n    {\n        return defaultInstance.projectStage();\n    }\n\n    @Override\n    public Class<? extends Handler> logHandler()\n    {\n        return defaultInstance.logHandler();\n    }\n\n    @Override\n    public boolean startExternalContainers()\n    {\n        return defaultInstance.startExternalContainers();\n    }\n\n    @Override\n    public Class<? extends Label> activeAlternativeLabel()\n    {\n        return defaultInstance.activeAlternativeLabel();\n    }\n\n    @Override\n    public Class<? extends ClassFilter> classFilter()\n    {\n        return defaultInstance.classFilter();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/mock/ApplicationMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.mock;\n\nimport java.lang.annotation.Annotation;\n\n//needed e.g. due to caches for application-scoped,... beans\npublic interface ApplicationMockManager\n{\n    void addMock(Object mockInstance, Annotation... qualifiers);\n\n    <T> T getMock(Class<T> beanClass, Annotation... qualifiers);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/mock/DynamicMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.mock;\n\npublic interface DynamicMockManager extends ApplicationMockManager\n{\n    void reset();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/mock/TypedMock.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.api.mock;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n//equivalent to @Typed for mocks to avoid conflicts with cdi\n\n@Target({ FIELD, METHOD, TYPE })\n@Retention(RUNTIME)\npublic @interface TypedMock\n{\n    Class<?>[] value() default { };\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/spi/ExternalContainer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.spi;\n\nimport java.lang.annotation.Annotation;\n\npublic interface ExternalContainer\n{\n    /**\n     * Bootstraps the container\n     */\n    void boot();\n\n    /**\n     * Closes the container\n     */\n    void shutdown();\n\n    int getOrdinal();\n\n    /**\n     * Signals a started scope\n     * @param scopeClass annotation-class of the scope\n     */\n    void startScope(Class<? extends Annotation> scopeClass);\n\n    /**\n     * Signals a stopped scope\n     * @param scopeClass annotation-class of the scope\n     */\n    void stopScope(Class<? extends Annotation> scopeClass);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/spi/TestAware.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.spi;\n\nimport java.lang.reflect.Method;\n\npublic interface TestAware\n{\n    void setTestClass(Class testClass);\n\n    void setTestMethod(Method testMethod);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/spi/TestControlValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.spi;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\n\n/**\n * Allows to provide a different validator which could\n * allow e.g. more scope-annotations (if a custom cdi-control implementation supports that custom contexts as well).\n * A custom validator could also validate e.g. the usage of project-stages,...\n */\npublic interface TestControlValidator extends Deactivatable\n{\n    void validate(TestControl testControl);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/spi/junit/TestStatementDecoratorFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.spi.junit;\n\nimport org.junit.runners.model.Statement;\nimport org.junit.runners.model.TestClass;\n\n//TODO find a better name\npublic interface TestStatementDecoratorFactory\n{\n    Statement createBeforeStatement(Statement originalStatement, TestClass testClass, Object target);\n\n    Statement createAfterStatement(Statement originalStatement, TestClass testClass, Object target);\n\n    int getOrdinal();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/spi/mock/MockFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.spi.mock;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\npublic interface MockFilter extends Deactivatable\n{\n    boolean isMockedImplementationSupported(BeanManager beanManager, Annotated annotated);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/main/java/org/apache/deltaspike/testcontrol/impl/jsf/MockedJsf2TestContainer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.jsf;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\nimport org.apache.myfaces.test.mock.MockApplicationFactory;\nimport org.apache.myfaces.test.mock.MockExceptionHandlerFactory;\nimport org.apache.myfaces.test.mock.MockExternalContext;\nimport org.apache.myfaces.test.mock.MockFacesContext;\nimport org.apache.myfaces.test.mock.MockFacesContextFactory;\nimport org.apache.myfaces.test.mock.MockHttpServletRequest;\nimport org.apache.myfaces.test.mock.MockHttpServletResponse;\nimport org.apache.myfaces.test.mock.MockHttpSession;\nimport org.apache.myfaces.test.mock.MockPartialViewContextFactory;\nimport org.apache.myfaces.test.mock.MockRenderKit;\nimport org.apache.myfaces.test.mock.MockRenderKitFactory;\nimport org.apache.myfaces.test.mock.MockServletConfig;\nimport org.apache.myfaces.test.mock.MockServletContext;\nimport org.apache.myfaces.test.mock.lifecycle.MockLifecycleFactory;\nimport org.apache.myfaces.test.mock.visit.MockVisitContextFactory;\n\nimport jakarta.el.ExpressionFactory;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.faces.FactoryFinder;\nimport jakarta.faces.application.Application;\nimport jakarta.faces.application.ApplicationFactory;\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.ExceptionHandler;\nimport jakarta.faces.context.ExceptionHandlerFactory;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.context.FacesContextFactory;\nimport jakarta.faces.lifecycle.Lifecycle;\nimport jakarta.faces.lifecycle.LifecycleFactory;\nimport jakarta.faces.render.RenderKit;\nimport jakarta.faces.render.RenderKitFactory;\nimport java.lang.annotation.Annotation;\nimport java.util.HashMap;\nimport java.util.Locale;\nimport java.util.Map;\n\n//known restriction: faces-config.xml files are ignored\n@ApplicationScoped\npublic class MockedJsf2TestContainer implements ExternalContainer\n{\n    protected MockServletConfig servletConfig;\n    protected MockServletContext servletContext;\n\n    protected Lifecycle lifecycle;\n    protected RenderKit renderKit;\n    protected Application application;\n\n    protected FacesContext facesContext;\n    protected MockHttpServletRequest request;\n    protected MockHttpServletResponse response;\n    protected MockHttpSession session;\n\n    protected Map<String, String> containerConfig;\n\n    public void boot()\n    {\n        initContainerConfig();\n        initServletObjects();\n        initJsf();\n    }\n\n    protected void initContainerConfig()\n    {\n        containerConfig = new HashMap<String, String>();\n        for (Map.Entry<String, String> entry : ConfigResolver.getAllProperties().entrySet())\n        {\n            if (entry.getKey().startsWith(\"org.apache.myfaces.\") || entry.getKey().startsWith(\"jakarta.faces.\") ||\n                    entry.getKey().startsWith(\"facelets.\"))\n            {\n                containerConfig.put(entry.getKey(), entry.getValue());\n            }\n        }\n    }\n\n    protected void initServletObjects()\n    {\n        this.servletContext = new MockServletContext();\n        this.servletConfig = new MockServletConfig(this.servletContext);\n        applyContainerConfig();\n    }\n\n    protected void applyContainerConfig()\n    {\n        //add the default values\n        servletContext.addInitParameter(\"jakarta.faces.PROJECT_STAGE\", \"UnitTest\");\n        servletContext.addInitParameter(\"jakarta.faces.PARTIAL_STATE_SAVING\", \"true\");\n        servletContext.addInitParameter(\"jakarta.faces.FACELETS_REFRESH_PERIOD\", \"-1\");\n\n        servletContext.addInitParameter(\"org.apache.myfaces.INITIALIZE_ALWAYS_STANDALONE\", \"true\");\n        servletContext.addInitParameter(\"org.apache.myfaces.spi.InjectionProvider\",\n            \"org.apache.myfaces.spi.impl.NoInjectionAnnotationInjectionProvider\");\n        servletContext.addInitParameter(\"org.apache.myfaces.config.annotation.LifecycleProvider\",\n            \"org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider\");\n        servletConfig.addInitParameter(\"org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED\", \"false\");\n\n        servletContext.addInitParameter(ExpressionFactory.class.getName(), \"org.apache.el.ExpressionFactoryImpl\");\n        //add custom values (might replace the default values)\n        for (Map.Entry<String, String> entry : containerConfig.entrySet())\n        {\n            servletContext.addInitParameter(entry.getKey(), entry.getValue());\n        }\n    }\n\n    protected void initJsf()\n    {\n        FactoryFinder.releaseFactories();\n\n        onPreInitJsf();\n\n        initLifecycle();\n        initApplication();\n        initRenderKit();\n    }\n\n    protected void onPreInitJsf()\n    {\n        //init mocked jsf factories\n        addFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());\n        addFactory(FactoryFinder.FACES_CONTEXT_FACTORY, MockFacesContextFactory.class.getName());\n        addFactory(FactoryFinder.LIFECYCLE_FACTORY, MockLifecycleFactory.class.getName());\n        addFactory(FactoryFinder.RENDER_KIT_FACTORY, MockRenderKitFactory.class.getName());\n        addFactory(FactoryFinder.EXCEPTION_HANDLER_FACTORY, MockExceptionHandlerFactory.class.getName());\n        addFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY, MockPartialViewContextFactory.class.getName());\n        addFactory(FactoryFinder.VISIT_CONTEXT_FACTORY, MockVisitContextFactory.class.getName());\n    }\n\n    protected void addFactory(String factoryName, String className)\n    {\n        FactoryFinder.setFactory(factoryName, className);\n    }\n\n    protected void initLifecycle()\n    {\n        LifecycleFactory lifecycleFactory =\n                (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);\n        this.lifecycle = lifecycleFactory.getLifecycle(getLifecycleId());\n    }\n\n    protected void initApplication()\n    {\n        ApplicationFactory applicationFactory =\n                (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);\n        this.application = applicationFactory.getApplication();\n    }\n\n    protected void initRenderKit()\n    {\n        RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder\n                .getFactory(FactoryFinder.RENDER_KIT_FACTORY);\n        this.renderKit = new MockRenderKit();\n        renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT, this.renderKit);\n    }\n\n    @Override\n    public void startScope(Class<? extends Annotation> scopeClass)\n    {\n        if (RequestScoped.class.equals(scopeClass))\n        {\n            initRequest();\n            initResponse();\n\n            initFacesContext();\n\n            initDefaultView();\n        }\n        else if (SessionScoped.class.equals(scopeClass))\n        {\n            initSession();\n        }\n    }\n\n    protected void initRequest()\n    {\n        this.request = new MockHttpServletRequest(this.session);\n        this.request.setServletContext(this.servletContext);\n    }\n\n    protected void initResponse()\n    {\n        this.response = new MockHttpServletResponse();\n    }\n\n    protected void initFacesContext()\n    {\n        FacesContextFactory facesContextFactory =\n                (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);\n        this.facesContext = facesContextFactory.getFacesContext(\n                this.servletContext, this.request, this.response, this.lifecycle);\n\n        ((MockFacesContext) this.facesContext).setApplication(this.application);\n        ExceptionHandler exceptionHandler = ((ExceptionHandlerFactory)\n                FactoryFinder.getFactory(FactoryFinder.EXCEPTION_HANDLER_FACTORY)).getExceptionHandler();\n        this.facesContext.setExceptionHandler(exceptionHandler);\n\n        ((MockFacesContext) this.facesContext).setExternalContext(\n                new MockExternalContext(this.servletContext, this.request, this.response));\n    }\n\n    protected void initDefaultView()\n    {\n        UIViewRoot root = new UIViewRoot();\n        root.setViewId(\"/viewId\");\n        root.setLocale(getLocale());\n        root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);\n        this.facesContext.setViewRoot(root);\n    }\n\n    protected void initSession()\n    {\n        if (this.request != null)\n        {\n            this.session = (MockHttpSession)this.request.getSession(true);\n        }\n        else\n        {\n            this.session = new MockHttpSession();\n            this.session.setServletContext(this.servletContext);\n        }\n    }\n\n    @Override\n    public void stopScope(Class<? extends Annotation> scopeClass)\n    {\n        if (RequestScoped.class.equals(scopeClass))\n        {\n            if (this.facesContext != null)\n            {\n                this.facesContext.release();\n            }\n            this.facesContext = null;\n            this.request = null;\n            this.response = null;\n        }\n        else if (SessionScoped.class.equals(scopeClass))\n        {\n            this.session = null;\n        }\n    }\n\n    protected Locale getLocale()\n    {\n        return Locale.getDefault();\n    }\n\n    public void shutdown()\n    {\n        this.application = null;\n        this.servletConfig = null;\n        this.containerConfig = null;\n        this.lifecycle = null;\n        this.renderKit = null;\n        this.servletContext = null;\n\n        FactoryFinder.releaseFactories();\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1000; //default in ds\n    }\n\n    protected String getLifecycleId()\n    {\n        return LifecycleFactory.DEFAULT_LIFECYCLE;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/main/java/org/apache/deltaspike/testcontrol/impl/jsf/MockedJsfTestContainerAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.jsf;\n\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\nimport org.apache.myfaces.test.mock.MockedJsfTestContainer;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport java.lang.annotation.Annotation;\n\n/**\n * Optional adapter for MockedJsfTestContainer\n * Requires MyFaces-Test v1.0.6 or higher\n */\n@ApplicationScoped\npublic class MockedJsfTestContainerAdapter implements ExternalContainer\n{\n    private final MockedJsfTestContainer mockedMyFacesTestContainer = new MockedJsfTestContainer();\n\n    public void boot()\n    {\n        this.mockedMyFacesTestContainer.setUp();\n    }\n\n    @Override\n    public void startScope(Class<? extends Annotation> scopeClass)\n    {\n        if (RequestScoped.class.equals(scopeClass))\n        {\n            this.mockedMyFacesTestContainer.startRequest();\n        }\n        else if (SessionScoped.class.equals(scopeClass))\n        {\n            this.mockedMyFacesTestContainer.startSession();\n        }\n    }\n\n    @Override\n    public void stopScope(Class<? extends Annotation> scopeClass)\n    {\n        if (RequestScoped.class.equals(scopeClass))\n        {\n            this.mockedMyFacesTestContainer.endRequest();\n        }\n        else if (SessionScoped.class.equals(scopeClass))\n        {\n            this.mockedMyFacesTestContainer.endSession();\n        }\n    }\n\n    public void shutdown()\n    {\n        this.mockedMyFacesTestContainer.tearDown();\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1000; //default in ds\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/main/java/org/apache/deltaspike/testcontrol/impl/jsf/MyFacesContainerAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.jsf;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\nimport org.apache.deltaspike.testcontrol.spi.TestAware;\nimport org.apache.myfaces.mc.test.core.annotation.TestConfig;\nimport org.apache.myfaces.mc.test.core.runner.MyFacesContainer;\nimport org.junit.runners.model.TestClass;\n\nimport jakarta.el.ExpressionFactory;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Optional adapter for MyFacesContainer\n * Requires MyFaces-Core 2.2.x, MyFaces-Test v1.0.6 or higher as well as org.apache.myfaces.core:myfaces-impl-test\n */\n@ApplicationScoped\npublic class MyFacesContainerAdapter implements TestAware, ExternalContainer\n{\n    private static final TestConfig DEFAULT_TEST_CONFIG_LITERAL = AnnotationInstanceProvider.of(TestConfig.class);\n    protected MyFacesContainer mockedMyFacesTestContainer;\n    protected Class testClass;\n    protected Map<String, String> containerConfig = new HashMap<String, String>();\n\n    public void boot()\n    {\n        final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();\n\n        this.mockedMyFacesTestContainer = new MyFacesContainer(new TestClass(this.testClass))\n        {\n            @Override\n            protected String getWebappResourcePath()\n            {\n                TestConfig testConfig = testClass.getJavaClass().getAnnotation(TestConfig.class);\n\n                if (testConfig == null || DEFAULT_TEST_CONFIG_LITERAL.webappResourcePath().equals(\n                    testConfig.webappResourcePath()))\n                {\n                    return MyFacesTestBaseConfig.WEBAPP_RESOURCE_PATH;\n                }\n                return testConfig.webappResourcePath();\n            }\n\n            @Override\n            protected void setUpServletObjects()\n            {\n                //just needed for MyFaces-Test util v1.0.7\n                //(to bypass issues with the outdated URLClassLoader used by AbstractJsfTestContainer)\n                setCurrentClassLoader(originalClassLoader);\n                super.setUpServletObjects();\n            }\n\n            @Override\n            protected void setUpWebConfigParams()\n            {\n                servletContext.addInitParameter(\"org.apache.myfaces.config.annotation.LifecycleProvider\",\n                    \"org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider\");\n                servletContext.addInitParameter(\"org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED\", \"false\");\n\n                servletContext.addInitParameter(ExpressionFactory.class.getName(),\n                    \"org.apache.el.ExpressionFactoryImpl\");\n\n                super.setUpWebConfigParams();\n\n                initContainerConfig();\n\n                //add custom values (might replace the default values)\n                for (Map.Entry<String, String> entry : containerConfig.entrySet())\n                {\n                    servletContext.addInitParameter(entry.getKey(), entry.getValue());\n                }\n            }\n        };\n\n        this.mockedMyFacesTestContainer.setUp(new Object() /*we don't need the test-instance here*/);\n    }\n\n    protected void setCurrentClassLoader(ClassLoader originalClassLoader)\n    {\n        Thread.currentThread().setContextClassLoader(originalClassLoader);\n    }\n\n    protected void initContainerConfig()\n    {\n        containerConfig = new HashMap<String, String>();\n        for (Map.Entry<String, String> entry : ConfigResolver.getAllProperties().entrySet())\n        {\n            if (entry.getKey().startsWith(\"org.apache.myfaces.\") || entry.getKey().startsWith(\"jakarta.faces.\") ||\n                    entry.getKey().startsWith(\"facelets.\"))\n            {\n                containerConfig.put(entry.getKey(), entry.getValue());\n            }\n        }\n    }\n\n    @Override\n    public void startScope(Class<? extends Annotation> scopeClass)\n    {\n        if (RequestScoped.class.equals(scopeClass))\n        {\n            this.mockedMyFacesTestContainer.startRequest();\n        }\n    }\n\n    @Override\n    public void stopScope(Class<? extends Annotation> scopeClass)\n    {\n        if (RequestScoped.class.equals(scopeClass))\n        {\n            this.mockedMyFacesTestContainer.endRequest();\n        }\n    }\n\n    public void shutdown()\n    {\n        if (this.mockedMyFacesTestContainer == null)\n        {\n            throw new IllegalStateException(\"During starting MyFaces-Core an exception happened.\");\n        }\n        this.mockedMyFacesTestContainer.tearDown();\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1000; //default in ds\n    }\n\n    @Override\n    public void setTestClass(Class testClass)\n    {\n        this.testClass = testClass;\n    }\n\n    @Override\n    public void setTestMethod(Method method)\n    {\n        //not needed\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/main/java/org/apache/deltaspike/testcontrol/impl/jsf/MyFacesContainerPerTestMethodAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.jsf;\n\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\nimport org.apache.deltaspike.testcontrol.spi.TestAware;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\n\n/**\n * Optional adapter for MyFacesContainer which gets started and stopped for every test-method\n * Requires MyFaces-Core 2.2.x, MyFaces-Test v1.0.6 or higher as well as org.apache.myfaces.core:myfaces-impl-test\n */\n@ApplicationScoped\npublic class MyFacesContainerPerTestMethodAdapter implements TestAware, ExternalContainer\n{\n    private static ThreadLocal<MyFacesContainerAdapter> myFacesContainerAdapterThreadLocal =\n            new ThreadLocal<MyFacesContainerAdapter>();\n\n    @Override\n    public void boot()\n    {\n    }\n\n    @Override\n    public void shutdown()\n    {\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1000; //default in ds\n    }\n\n    @Override\n    public void startScope(Class<? extends Annotation> scopeClass)\n    {\n        myFacesContainerAdapterThreadLocal.get().startScope(scopeClass);\n    }\n\n    @Override\n    public void stopScope(Class<? extends Annotation> scopeClass)\n    {\n        myFacesContainerAdapterThreadLocal.get().stopScope(scopeClass);\n    }\n\n    @Override\n    public void setTestClass(Class testClass)\n    {\n        MyFacesContainerAdapter myFacesContainerAdapter = new MyFacesContainerAdapter();\n        myFacesContainerAdapter.setTestClass(testClass);\n        myFacesContainerAdapterThreadLocal.set(myFacesContainerAdapter);\n    }\n\n    @Override\n    public void setTestMethod(Method testMethod)\n    {\n        if (testMethod != null)\n        {\n            myFacesContainerAdapterThreadLocal.get().boot();\n        }\n        else\n        {\n            myFacesContainerAdapterThreadLocal.get().shutdown();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/main/java/org/apache/deltaspike/testcontrol/impl/jsf/MyFacesTestBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.jsf;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig;\n\npublic interface MyFacesTestBaseConfig extends DeltaSpikeBaseConfig\n{\n    String WEBAPP_RESOURCE_PATH = ConfigResolver.resolve(\"deltaspike.testcontrol.mf.test.webapp_resource_path\")\n            .as(String.class)\n            .withCurrentProjectStage(true)\n            .withDefault(\"\")\n            .getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/main/java/org/apache/deltaspike/testcontrol/impl/transaction/TransactionStatementDecoratorFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.transaction;\n\nimport junit.framework.AssertionFailedError;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.testcontrol.spi.junit.TestStatementDecoratorFactory;\nimport org.junit.After;\nimport org.junit.runners.model.FrameworkMethod;\nimport org.junit.runners.model.MultipleFailureException;\nimport org.junit.runners.model.Statement;\nimport org.junit.runners.model.TestClass;\n\nimport jakarta.persistence.EntityManager;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * Not compatible with too short scopes, because they are closed too early\n */\npublic class TransactionStatementDecoratorFactory implements TestStatementDecoratorFactory\n{\n    private static final Logger LOG = Logger.getLogger(TransactionStatementDecoratorFactory.class.getName());\n\n    static\n    {\n        LOG.setLevel(Level.INFO);\n    }\n\n    @Override\n    public Statement createBeforeStatement(Statement originalStatement, TestClass testClass, Object target)\n    {\n        return originalStatement;\n    }\n\n    @Override\n    public Statement createAfterStatement(Statement originalStatement, TestClass testClass, Object target)\n    {\n        final List<FrameworkMethod> afters = testClass.getAnnotatedMethods(After.class);\n        return new TransactionAwareRunAfters(originalStatement, afters, target);\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return 1000; //default in ds\n    }\n\n    //see org.junit.internal.runners.statements.RunAfters\n    private class TransactionAwareRunAfters extends Statement\n    {\n        private final Statement wrapped;\n        private final List<FrameworkMethod> afters;\n        private final Object target;\n\n        public TransactionAwareRunAfters(Statement wrapped, List<FrameworkMethod> afters, Object target)\n        {\n            this.wrapped = wrapped;\n            this.afters = afters;\n            this.target = target;\n        }\n\n        @Override\n        public void evaluate() throws Throwable\n        {\n            List<Throwable> result = new ArrayList<Throwable>();\n\n            try\n            {\n                this.wrapped.evaluate();\n            }\n            catch (Throwable e)\n            {\n                result.add(performConsistencyCheck(e));\n            }\n            finally\n            {\n                Throwable t = performConsistencyCheck(null);\n\n                if (t != null)\n                {\n                    result.add(t);\n                }\n\n                for (FrameworkMethod each : this.afters)\n                {\n                    try\n                    {\n                        each.invokeExplosively(this.target);\n                    }\n                    catch (Throwable e)\n                    {\n                        result.add(e);\n                    }\n                }\n            }\n\n            if (!result.isEmpty())\n            {\n                MultipleFailureException.assertEmpty(result);\n            }\n        }\n\n        private Throwable performConsistencyCheck(Throwable t)\n        {\n            Throwable result = t;\n\n            if (t instanceof InvocationTargetException)\n            {\n                result = t.getCause();\n            }\n\n            List<EntityManager> entityManagerList =\n                    BeanProvider.getContextualReferences(EntityManager.class, true, false);\n\n            for (Field field : this.target.getClass().getDeclaredFields())\n            {\n                if (EntityManager.class.isAssignableFrom(field.getType()))\n                {\n                    field.setAccessible(true);\n                    try\n                    {\n                        entityManagerList.add((EntityManager) field.get(this.target));\n                    }\n                    catch (Exception e)\n                    {\n                        throw ExceptionUtils.throwAsRuntimeException(e);\n                    }\n                }\n            }\n\n            for (EntityManager entityManager : entityManagerList)\n            {\n                if (entityManager.getTransaction().isActive())\n                {\n                    if (t instanceof AssertionFailedError)\n                    {\n                        LOG.severe(\"assert failed within a transaction\");\n                    }\n                    LOG.severe(\"start manual rollback\");\n\n                    //force rollback - otherwise there can be side-effects in other tests or cleanup-code\n                    // (e.g. 'TRUNCATE SCHEMA' would fail)\n                    entityManager.getTransaction().rollback();\n\n                    if (result == null)\n                    {\n                        result = new IllegalStateException(\"open transaction found\");\n                    }\n                }\n            }\n\n            return result;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/InternalMyFacesTestContainerAdapter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol;\n\nimport org.apache.deltaspike.test.testcontrol.uc005.MockedJsfContainerTest;\nimport org.apache.deltaspike.test.testcontrol.uc006.SkipExternalContainerTest;\nimport org.apache.deltaspike.test.testcontrol.uc009.JsfContainerTest;\nimport org.apache.deltaspike.test.testcontrol.uc010.JsfContainerPerTestMethodTest;\nimport org.apache.deltaspike.testcontrol.impl.jsf.MockedJsf2TestContainer;\nimport org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerAdapter;\nimport org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerPerTestMethodAdapter;\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\nimport org.apache.deltaspike.testcontrol.spi.TestAware;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\n\npublic class InternalMyFacesTestContainerAdapter implements TestAware, ExternalContainer\n{\n    private ExternalContainer wrapped;\n\n    @Override\n    public void boot()\n    {\n        wrapped.boot();\n    }\n\n    @Override\n    public void shutdown()\n    {\n        wrapped.shutdown();\n    }\n\n    @Override\n    public int getOrdinal()\n    {\n        return wrapped.getOrdinal();\n    }\n\n    @Override\n    public void startScope(Class<? extends Annotation> scopeClass)\n    {\n        wrapped.startScope(scopeClass);\n    }\n\n    @Override\n    public void stopScope(Class<? extends Annotation> scopeClass)\n    {\n        wrapped.stopScope(scopeClass);\n    }\n\n    @Override\n    public void setTestClass(Class testClass)\n    {\n        if (MockedJsfContainerTest.class.equals(testClass) ||\n            SkipExternalContainerTest.class.equals(testClass))\n        {\n            this.wrapped = new MockedJsf2TestContainer();\n        }\n        else if (JsfContainerTest.class.equals(testClass))\n        {\n            this.wrapped = new MyFacesContainerAdapter();\n            ((TestAware)this.wrapped).setTestClass(testClass);\n        }\n        else if (JsfContainerPerTestMethodTest.class.equals(testClass))\n        {\n            this.wrapped = new MyFacesContainerPerTestMethodAdapter();\n            ((TestAware)this.wrapped).setTestClass(testClass);\n        }\n        else\n        {\n            this.wrapped = new ExternalContainer()\n            {\n                @Override\n                public void boot()\n                {\n                }\n\n                @Override\n                public void shutdown()\n                {\n                }\n\n                @Override\n                public int getOrdinal()\n                {\n                    return 0;\n                }\n\n                @Override\n                public void startScope(Class<? extends Annotation> scopeClass)\n                {\n                }\n\n                @Override\n                public void stopScope(Class<? extends Annotation> scopeClass)\n                {\n                }\n            };\n        }\n    }\n\n    @Override\n    public void setTestMethod(Method testMethod)\n    {\n        if (this.wrapped instanceof TestAware)\n        {\n            ((TestAware)this.wrapped).setTestMethod(testMethod);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/shared/ApplicationScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.shared;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ApplicationScopedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/shared/MyQualifier.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.shared;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.*;\n\n@Target( { TYPE, METHOD, PARAMETER, FIELD })\n@Retention(value = RetentionPolicy.RUNTIME)\n@Documented\n@Qualifier\npublic @interface MyQualifier\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/shared/RequestScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.shared;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class RequestScopedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/shared/SessionScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.shared;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport java.io.Serializable;\n\n@SessionScoped\npublic class SessionScopedBean implements Serializable\n{\n    private static final long serialVersionUID = -6055362670706159152L;\n    protected int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc001/MockedRequestScopedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc001;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedRequestScopedBeanTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMock1()\n    {\n        mockManager.addMock(new RequestScopedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        });\n\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(7, requestScopedBean.getCount());\n    }\n\n    @Test\n    public void manualMock2() //same test with different mock\n    {\n        mockManager.addMock(new RequestScopedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 14;\n            }\n        });\n\n        Assert.assertEquals(14, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(14, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc002/MockedSessionScopedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc002;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedSessionScopedBeanTest\n{\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMock1()\n    {\n        mockManager.addMock(new SessionScopedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        });\n\n        Assert.assertEquals(7, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(7, sessionScopedBean.getCount());\n    }\n\n    @Test\n    public void manualMock2() //same test with different mock\n    {\n        mockManager.addMock(new SessionScopedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 14;\n            }\n        });\n\n        Assert.assertEquals(14, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(14, sessionScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc003/MockedSessionScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc003;\n\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class MockedSessionScopedBean extends SessionScopedBean\n{\n    public void setCount(int count)\n    {\n        this.count = count;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc003/MockedSessionScopedBeanAcrossMethodsTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc003;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(startScopes = {ApplicationScoped.class, SessionScoped.class})\npublic class MockedSessionScopedBeanAcrossMethodsTest\n{\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    //static is needed here, because the session spans across all test-methods\n    private static MockedSessionScopedBean mockedSessionScopedBean = new MockedSessionScopedBean();\n\n    @Before\n    public void init()\n    {\n        mockManager.addMock(mockedSessionScopedBean);\n    }\n\n    @Test\n    public void manualMock1()\n    {\n        mockedSessionScopedBean.setCount(7);\n\n        Assert.assertEquals(7, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(8, sessionScopedBean.getCount());\n    }\n\n    @Test\n    public void manualMock2()\n    {\n        mockedSessionScopedBean.setCount(14);\n\n        Assert.assertEquals(14, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(15, sessionScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc004/MockedApplicationScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc004;\n\nimport org.apache.deltaspike.test.testcontrol.mock.shared.ApplicationScopedBean;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class MockedApplicationScopedBean extends ApplicationScopedBean\n{\n    @Override\n    public int getCount()\n    {\n        return 14;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc004/MockedApplicationScopedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc004;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.ApplicationMockManager;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedApplicationScopedBeanTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    //e.g. application-scoped beans are cached very early -> usage of ApplicationMockManager to register mocks for them\n    @BeforeClass\n    public static void init()\n    {\n        ApplicationMockManager applicationMockManager = BeanProvider.getContextualReference(ApplicationMockManager.class);\n        applicationMockManager.addMock(new MockedApplicationScopedBean());\n    }\n\n    @Test\n    public void manualMock1()\n    {\n        Assert.assertEquals(14, applicationScopedBean.getCount());\n        applicationScopedBean.increaseCount();\n        Assert.assertEquals(14, applicationScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc005/MockedProducedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc005;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedProducedBeanTest\n{\n    @Inject\n    private ProducedBean producedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockForProducedBean1()\n    {\n        mockManager.addMock(new ProducedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        });\n        Assert.assertEquals(7, producedBean.getCount());\n        producedBean.increaseCount();\n        Assert.assertEquals(7, producedBean.getCount());\n    }\n\n    @Test\n    public void manualMockForProducedBean2()\n    {\n        mockManager.addMock(new ProducedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 14;\n            }\n        });\n        Assert.assertEquals(14, producedBean.getCount());\n        producedBean.increaseCount();\n        Assert.assertEquals(14, producedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc005/ProducedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc005;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class ProducedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc005/ProducedBeanProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc005;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class ProducedBeanProducer\n{\n    @Produces\n    @RequestScoped\n    public ProducedBean produceBean()\n    {\n        return new ProducedBean();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc006/MockedRequestScopedQualifiedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc006;\n\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.MyQualifier;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedRequestScopedQualifiedBeanTest\n{\n    @Inject\n    @MyQualifier\n    private QualifiedBean qualifiedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockWithQualifier()\n    {\n        mockManager.addMock(new QualifiedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        }, AnnotationInstanceProvider.of(MyQualifier.class));\n\n        Assert.assertEquals(7, qualifiedBean.getCount());\n        qualifiedBean.increaseCount();\n        Assert.assertEquals(7, qualifiedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc006/QualifiedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc006;\n\nimport org.apache.deltaspike.test.testcontrol.mock.shared.MyQualifier;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\n@MyQualifier\npublic class QualifiedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc007/MockedProducedQualifiedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc007;\n\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.MyQualifier;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedProducedQualifiedBeanTest\n{\n    @Inject\n    @MyQualifier\n    private ProducedBean producedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockWithQualifierForProducedBean1()\n    {\n        mockManager.addMock(new ProducedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        }, AnnotationInstanceProvider.of(MyQualifier.class));\n        Assert.assertEquals(7, producedBean.getCount());\n        producedBean.increaseCount();\n        Assert.assertEquals(7, producedBean.getCount());\n    }\n\n    @Test\n    public void manualMockWithQualifierForProducedBean2()\n    {\n        mockManager.addMock(new ProducedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 14;\n            }\n        }, AnnotationInstanceProvider.of(MyQualifier.class));\n        Assert.assertEquals(14, producedBean.getCount());\n        producedBean.increaseCount();\n        Assert.assertEquals(14, producedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc007/ProducedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc007;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class ProducedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc007/ProducedBeanProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc007;\n\nimport org.apache.deltaspike.test.testcontrol.mock.shared.MyQualifier;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class ProducedBeanProducer\n{\n    @Produces\n    @RequestScoped\n    @MyQualifier\n    public ProducedBean produceBean()\n    {\n        return new ProducedBean();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc008/MockedTypedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc008;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol.api.mock.TypedMock;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedTypedBeanTest\n{\n    @Inject\n    private T1 t1;\n\n    @Inject\n    private T2 t2;\n\n    @Inject\n    private T3 t3;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockForTypedBeans()\n    {\n        mockManager.addMock(new MockedTypedBean1and2(7));\n        mockManager.addMock(new MockedTypedBean3(14));\n        Assert.assertEquals(7, t1.getCount());\n        Assert.assertEquals(7, t2.getCount());\n        Assert.assertEquals(14, t3.getCount());\n    }\n\n    @Typed() //exclude it for the cdi type-check\n    private static class MockedTypedBean1and2 extends TypedBean1and2\n    {\n        private final int mockedCount;\n\n        private MockedTypedBean1and2(int mockedCount)\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n\n    @Typed() //exclude it for the cdi type-check\n    @TypedMock(T3.class) //optional - only needed in case of producers\n    private static class MockedTypedBean3 extends TypedBean3\n    {\n        private final int mockedCount;\n\n        private MockedTypedBean3(int mockedCount)\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc008/T1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc008;\n\npublic interface T1\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc008/T2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc008;\n\npublic interface T2\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc008/T3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc008;\n\npublic interface T3\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc008/TypedBean1and2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc008;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Vetoed;\n\n@RequestScoped\n@Typed({T1.class, T2.class})\npublic class TypedBean1and2 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc008/TypedBean3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc008;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Vetoed;\n\n@RequestScoped\n@Typed({T3.class})\npublic class TypedBean3 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/MockedTypedProducedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedTypedProducedBeanTest\n{\n    @Inject\n    private T1 t1;\n\n    @Inject\n    private T2 t2;\n\n    @Inject\n    private T3 t3;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockT1()\n    {\n        mockManager.addMock(new MockedTypedBean1and2(7));\n        mockManager.addMock(new MockedTypedBean3(14));\n        Assert.assertEquals(7, t1.getCount());\n        Assert.assertEquals(7, t2.getCount());\n        Assert.assertEquals(14, t3.getCount());\n    }\n\n    @Typed({T1.class, T2.class}) //fine for the cdi-container due to parametrized constructor\n    private static class MockedTypedBean1and2 extends TypedBean1and2\n    {\n        private final int mockedCount;\n\n        private MockedTypedBean1and2(int mockedCount)\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n\n    @Typed(T3.class) //fine for the cdi-container due to parametrized constructor\n    private static class MockedTypedBean3 extends TypedBean3\n    {\n        private final int mockedCount;\n\n        private MockedTypedBean3(int mockedCount)\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/T1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\npublic interface T1\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/T2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\npublic interface T2\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/T3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\npublic interface T3\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/TypedBean1and2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBean1and2 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/TypedBean3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBean3 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc009/TypedBeanProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc009;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBeanProducer\n{\n    @Produces\n    @RequestScoped\n    @Typed({T1.class, T2.class})\n    public TypedBean1and2 produce1and2()\n    {\n        return new TypedBean1and2();\n    }\n\n    @Produces\n    @RequestScoped\n    @Typed(T3.class)\n    public TypedBean3 produce3()\n    {\n        return new TypedBean3();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc010/MockedRequestScopedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc010;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.mockito.Mockito.*;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedRequestScopedBeanTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void mockitoMock1()\n    {\n        RequestScopedBean mockedRequestScopedBean = mock(RequestScopedBean.class);\n        when(mockedRequestScopedBean.getCount()).thenReturn(7);\n        mockManager.addMock(mockedRequestScopedBean);\n\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(7, requestScopedBean.getCount());\n    }\n\n    @Test\n    public void mockitoMock2() //same test with different mock\n    {\n        RequestScopedBean mockedRequestScopedBean = mock(RequestScopedBean.class);\n        when(mockedRequestScopedBean.getCount()).thenReturn(14);\n        mockManager.addMock(mockedRequestScopedBean);\n\n        Assert.assertEquals(14, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(14, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc011/MockedRequestScopedBeanWithInjection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc011;\n\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.inject.Inject;\n\n@Typed() //exclude it for the cdi type-check\npublic class MockedRequestScopedBeanWithInjection extends RequestScopedBean\n{\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Override\n    public int getCount()\n    {\n        return sessionScopedBean.getCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc011/MockedRequestScopedBeanWithInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc011;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedRequestScopedBeanWithInjectionTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockWithInjection()\n    {\n        RequestScopedBean mockedRequestScopedBean = new MockedRequestScopedBeanWithInjection();\n        BeanProvider.injectFields(mockedRequestScopedBean);\n        mockManager.addMock(mockedRequestScopedBean);\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount(); //not delegated\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n        Assert.assertEquals(1, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc012/MockedRequestScopedBeanWithInjection.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc012;\n\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.inject.Inject;\n\n@Typed() //exclude it for the cdi type-check\npublic class MockedRequestScopedBeanWithInjection extends RequestScopedBean\n{\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Override\n    public int getCount()\n    {\n        return sessionScopedBean.getCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc012/MockedRequestScopedBeanWithInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc012;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.mockito.Mockito.*;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedRequestScopedBeanWithInjectionTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void mixedMocksWithInjection1()\n    {\n        SessionScopedBean mockedSessionScopedBean = mock(SessionScopedBean.class);\n        when(mockedSessionScopedBean.getCount()).thenReturn(7);\n        mockManager.addMock(mockedSessionScopedBean);\n\n        RequestScopedBean mockedRequestScopedBean = new MockedRequestScopedBeanWithInjection();\n        BeanProvider.injectFields(mockedRequestScopedBean);\n        mockManager.addMock(mockedRequestScopedBean);\n\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        requestScopedBean.increaseCount(); //not delegated\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(7, sessionScopedBean.getCount()); //still mocked\n        Assert.assertEquals(7, requestScopedBean.getCount()); //still mocked\n    }\n\n    @Test\n    public void mixedMocksWithInjection2()\n    {\n        SessionScopedBean mockedSessionScopedBean = mock(SessionScopedBean.class);\n        when(mockedSessionScopedBean.getCount()).thenReturn(14);\n        mockManager.addMock(mockedSessionScopedBean);\n\n        RequestScopedBean mockedRequestScopedBean = new MockedRequestScopedBeanWithInjection();\n        BeanProvider.injectFields(mockedRequestScopedBean);\n        mockManager.addMock(mockedRequestScopedBean);\n\n        Assert.assertEquals(14, requestScopedBean.getCount());\n        requestScopedBean.increaseCount(); //not delegated\n        Assert.assertEquals(14, requestScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(14, sessionScopedBean.getCount()); //still mocked\n        Assert.assertEquals(14, requestScopedBean.getCount()); //still mocked\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/MockedTypedProducedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol.api.mock.TypedMock;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedTypedProducedBeanTest\n{\n    @Inject\n    private T1 t1;\n\n    @Inject\n    private T2 t2;\n\n    @Inject\n    private T3 t3;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockT1()\n    {\n        mockManager.addMock(new MockedTypedBean1and2(7));\n        mockManager.addMock(new MockedTypedBean3(14));\n        Assert.assertEquals(7, t1.getCount());\n        Assert.assertEquals(7, t2.getCount());\n        Assert.assertEquals(14, t3.getCount());\n    }\n\n    @TypedMock({T1.class, T2.class}) //specify the types for mocking (to replace the producer)\n    private static class MockedTypedBean1and2 extends TypedBean1and2\n    {\n        private final int mockedCount;\n\n        private MockedTypedBean1and2(int mockedCount) //-> no @Typed() needed\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n\n     //exclude it for the cdi type-check\n    @TypedMock(T3.class)\n    private static class MockedTypedBean3 extends TypedBean3\n    {\n        private final int mockedCount;\n\n        private MockedTypedBean3(int mockedCount) //-> no @Typed() needed\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\npublic interface T1\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\npublic interface T2\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/T3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\npublic interface T3\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean1and2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBean1and2 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBean3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBean3 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc013/TypedBeanProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc013;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBeanProducer\n{\n    @Produces\n    @RequestScoped\n    @Typed({T1.class, T2.class})\n    public TypedBean1and2 produce1and2()\n    {\n        return new TypedBean1and2();\n    }\n\n    @Produces\n    @RequestScoped\n    @Typed(T3.class)\n    public TypedBean3 produce3()\n    {\n        return new TypedBean3();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/MockedTypedProducedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol.api.mock.TypedMock;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class MockedTypedProducedBeanTest\n{\n    @Inject\n    private T1 t1;\n\n    @Inject\n    private T2 t2;\n\n    @Inject\n    private T3 t3;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockT1()\n    {\n        MockedTypedBean1and2 mockedTypedBean1and2 = new MockedTypedBean1and2();\n        mockedTypedBean1and2.setMockedCount(7);\n        mockManager.addMock(mockedTypedBean1and2);\n\n        MockedTypedBean3 mockedTypedBean3 = new MockedTypedBean3();\n        mockedTypedBean3.setMockedCount(14);\n        mockManager.addMock(mockedTypedBean3);\n\n        Assert.assertEquals(7, t1.getCount());\n        Assert.assertEquals(7, t2.getCount());\n        Assert.assertEquals(14, t3.getCount());\n    }\n\n    @Typed() //exclude it for the cdi type-check\n    @TypedMock({T1.class, T2.class}) //specify the types for mocking (to replace the producer)\n    private static class MockedTypedBean1and2 extends TypedBean1and2\n    {\n        private int mockedCount;\n\n        private void setMockedCount(int mockedCount)\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n\n    @Typed() //exclude it for the cdi type-check\n    @TypedMock(T3.class)\n    private static class MockedTypedBean3 extends TypedBean3\n    {\n        private int mockedCount;\n\n        private void setMockedCount(int mockedCount)\n        {\n            this.mockedCount = mockedCount;\n        }\n\n        @Override\n        public int getCount()\n        {\n            return mockedCount;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T1.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\npublic interface T1\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\npublic interface T2\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/T3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\npublic interface T3\n{\n    int getCount();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean1and2.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBean1and2 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBean3.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBean3 implements T1, T2, T3\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc014/TypedBeanProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc014;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.Vetoed;\n\n@Typed() //exclude it for the cdi type-check\npublic class TypedBeanProducer\n{\n    @Produces\n    @RequestScoped\n    @Typed({T1.class, T2.class})\n    public TypedBean1and2 produce1and2()\n    {\n        return new TypedBean1and2();\n    }\n\n    @Produces\n    @RequestScoped\n    @Typed(T3.class)\n    public TypedBean3 produce3()\n    {\n        return new TypedBean3();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc016/CustomMockManagerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc016;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.CustomMockManager;\nimport org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n//same base logic as uc001 + a manual check of CustomMockManager\npublic class CustomMockManagerTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMock1()\n    {\n        CustomMockManager.resetInternals();\n\n        mockManager.addMock(new RequestScopedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        });\n\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(7, requestScopedBean.getCount());\n\n        Assert.assertTrue(CustomMockManager.isIsCalled());\n    }\n\n    @Test\n    public void manualMock2() //same test with different mock\n    {\n        CustomMockManager.resetInternals();\n\n        mockManager.addMock(new RequestScopedBean()\n        {\n            @Override\n            public int getCount()\n            {\n                return 14;\n            }\n        });\n\n        Assert.assertEquals(14, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(14, requestScopedBean.getCount());\n\n        Assert.assertTrue(CustomMockManager.isIsCalled());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc005/MockedJsfContainerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc005;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.render.RenderKitFactory;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\n@TestControl(startExternalContainers = true)\npublic class MockedJsfContainerTest\n{\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    public void firstTest()\n    {\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getViewRoot());\n        Assert.assertEquals(\"/viewId\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        UIViewRoot uiViewRoot = new UIViewRoot();\n        uiViewRoot.setViewId(\"/test1.xhtml\");\n        uiViewRoot.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n        Assert.assertEquals(\"/test1.xhtml\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExternalContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getApplication());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getELContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getPartialViewContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getRenderKit());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExceptionHandler());\n\n        Assert.assertNull(FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"1\");\n        Assert.assertEquals(\"1\", FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n    }\n\n    @Test\n    public void secondTest()\n    {\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getViewRoot());\n        Assert.assertEquals(\"/viewId\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        UIViewRoot uiViewRoot = new UIViewRoot();\n        uiViewRoot.setViewId(\"/test2.xhtml\");\n        uiViewRoot.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n        Assert.assertEquals(\"/test2.xhtml\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExternalContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getApplication());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getELContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getPartialViewContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getRenderKit());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExceptionHandler());\n\n        Assert.assertNull(FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"2\");\n        Assert.assertEquals(\"2\", FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc006/SkipExternalContainerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc006;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.faces.context.FacesContext;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\n@TestControl(startExternalContainers = false)\npublic class SkipExternalContainerTest\n{\n    @Test\n    public void skippedSetupTest()\n    {\n        Assert.assertNull(FacesContext.getCurrentInstance());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc009/JsfContainerTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc009;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.faces.component.UIViewRoot;\nimport jakarta.faces.context.FacesContext;\nimport jakarta.faces.render.RenderKitFactory;\nimport jakarta.inject.Inject;\nimport java.util.Map;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\n@TestControl(startExternalContainers = true)\npublic class JsfContainerTest\n{\n    private Integer identityHashCode;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    public void firstTest()\n    {\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n\n        UIViewRoot uiViewRoot = new UIViewRoot();\n        uiViewRoot.setViewId(\"/viewId\");\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getViewRoot());\n        Assert.assertEquals(\"/viewId\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        uiViewRoot.setViewId(\"/test1.xhtml\");\n        uiViewRoot.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n        Assert.assertEquals(\"/test1.xhtml\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExternalContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getApplication());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getELContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getPartialViewContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getRenderKit());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExceptionHandler());\n\n        Assert.assertNull(FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"1\");\n        Assert.assertEquals(\"1\", FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n\n        Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();\n        if (identityHashCode == null)\n        {\n            identityHashCode = System.identityHashCode(applicationMap);\n        }\n        else\n        {\n            Assert.assertSame(identityHashCode, System.identityHashCode(applicationMap));\n        }\n    }\n\n    @Test\n    public void secondTest()\n    {\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n\n        UIViewRoot uiViewRoot = new UIViewRoot();\n        uiViewRoot.setViewId(\"/viewId\");\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getViewRoot());\n        Assert.assertEquals(\"/viewId\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        uiViewRoot.setViewId(\"/test2.xhtml\");\n        uiViewRoot.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n\n        FacesContext.getCurrentInstance().setViewRoot(uiViewRoot);\n        Assert.assertEquals(\"/test2.xhtml\", FacesContext.getCurrentInstance().getViewRoot().getViewId());\n\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExternalContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getApplication());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getELContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getPartialViewContext());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getRenderKit());\n        Assert.assertNotNull(FacesContext.getCurrentInstance().getExceptionHandler());\n\n        Assert.assertNull(FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n        FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"test\", \"2\");\n        Assert.assertEquals(\"2\", FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(\"test\"));\n\n        Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();\n        if (identityHashCode == null)\n        {\n            identityHashCode = System.identityHashCode(applicationMap);\n        }\n        else\n        {\n            Assert.assertSame(identityHashCode, System.identityHashCode(applicationMap));\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc010/JsfContainerPerTestMethodTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc010;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.faces.context.FacesContext;\nimport java.util.Map;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class JsfContainerPerTestMethodTest\n{\n    private Integer identityHashCode;\n\n    @Test\n    public void firstTest()\n    {\n        Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();\n        if (identityHashCode == null)\n        {\n            identityHashCode = System.identityHashCode(applicationMap);\n        }\n        else\n        {\n            Assert.assertNotSame(identityHashCode, System.identityHashCode(applicationMap));\n        }\n    }\n\n    @Test\n    public void secondTest()\n    {\n        Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();\n        if (identityHashCode == null)\n        {\n            identityHashCode = System.identityHashCode(applicationMap);\n        }\n        else\n        {\n            Assert.assertNotSame(identityHashCode, System.identityHashCode(applicationMap));\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/DefaultTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DefaultTestService implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"default-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestLabelX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport org.apache.deltaspike.testcontrol.api.TestControl;\n\npublic class TestLabelX implements TestControl.Label\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\npublic interface TestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestServiceLabelX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@ApplicationScoped\npublic class TestServiceLabelX implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-x\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestServiceLabelY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@ApplicationScoped\npublic class TestServiceLabelY implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-y\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestServiceLabelYTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(activeAlternativeLabel = TestServiceLabelYTest.Y.class)\npublic class TestServiceLabelYTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultY()\n    {\n        Assert.assertEquals(\"result-y\", testService.getValue());\n    }\n\n    class Y implements TestControl.Label\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestServiceNoLabelTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class TestServiceNoLabelTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void noLabel()\n    {\n        Assert.assertEquals(\"default-result\", testService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc014/TestServiceTestLabelXTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc014;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(activeAlternativeLabel = TestLabelX.class)\npublic class TestServiceTestLabelXTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultX()\n    {\n        Assert.assertEquals(\"result-x\", testService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc015/AlternativeServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc015;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class AlternativeServiceTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void defaultValue()\n    {\n        Assert.assertEquals(\"alternative-result\", testService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc015/DefaultTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc015;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DefaultTestService implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"default-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc015/LabeledServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc015;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\nimport jakarta.inject.Named;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(activeAlternativeLabel = LabeledServiceTest.Label.class)\npublic class LabeledServiceTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultLbl()\n    {\n        Assert.assertEquals(\"result-lbl\", testService.getValue());\n    }\n\n    @Named(\"lbl\")\n    class Label implements TestControl.Label\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc015/LabeledTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc015;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@ApplicationScoped\npublic class LabeledTestService implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-lbl\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc015/TestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc015;\n\npublic interface TestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/DefaultTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DefaultTestService implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"default-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestLabel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@TestQualifierBinding\n\n@Retention(RUNTIME)\n@Target(TYPE)\npublic @interface TestLabel\n{\n    Type value();\n\n    enum Type\n    {\n        X, Y\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestQualifierBinding.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.ANNOTATION_TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target(ANNOTATION_TYPE)\npublic @interface TestQualifierBinding\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\npublic interface TestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestServiceLabelX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@TestLabel(TestLabel.Type.X)\n@ApplicationScoped\npublic class TestServiceLabelX implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-x\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestServiceLabelXTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestLabel(TestLabel.Type.X)\npublic class TestServiceLabelXTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultX()\n    {\n        Assert.assertEquals(\"result-x\", testService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestServiceLabelY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@TestLabel(TestLabel.Type.Y)\n@ApplicationScoped\npublic class TestServiceLabelY implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-y\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc016/TestServiceLabelYTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc016;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestLabel(TestLabel.Type.Y)\npublic class TestServiceLabelYTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultY()\n    {\n        Assert.assertEquals(\"result-y\", testService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc017;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class DefaultServiceTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void defaultValue()\n    {\n        Assert.assertEquals(\"default-result\", testService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultTestServiceProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc017;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Produces;\n\n@ApplicationScoped\npublic class DefaultTestServiceProducer\n{\n    @Produces\n    @ApplicationScoped\n    protected TestService testService()\n    {\n        return new TestService()\n        {\n            @Override\n            public String getValue()\n            {\n                return \"default-result\";\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc017;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(activeAlternativeLabel = LabeledServiceTest.Label.class)\npublic class LabeledServiceTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void labeledValue()\n    {\n        Assert.assertEquals(\"labeled-result\", testService.getValue());\n    }\n\n    class Label implements TestControl.Label\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledTestServiceProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc017;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.inject.Produces;\n\n@Alternative\npublic class LabeledTestServiceProducer extends DefaultTestServiceProducer\n{\n    @Produces\n    @ApplicationScoped\n    protected TestService testService()\n    {\n        return new TestService()\n        {\n            @Override\n            public String getValue()\n            {\n                return \"labeled-result\";\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/TestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc017;\n\npublic interface TestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\npublic class DefaultServiceTest\n{\n    @Inject\n    private InterceptedTestService interceptedTestService;\n\n    @Test\n    public void defaultValue()\n    {\n        Assert.assertEquals(\"DEFAULT-RESULT\", interceptedTestService.getValue());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultTestServiceProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Produces;\n\nimport static org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.DEFAULT;\n\n@ApplicationScoped\npublic class DefaultTestServiceProducer implements InterceptedTestServiceProducer\n{\n    @Produces\n    @Default //optional\n    @Dependent\n    public InterceptedTestService createInterceptedTestService(@TestServiceQualifier(DEFAULT) InterceptedTestService interceptedTestService)\n    {\n        return interceptedTestService; //the exposed result is an intercepted instance\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedDefaultTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport static org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.DEFAULT;\n\n@ApplicationScoped\n@TestUpperCaseInterceptor\n@TestServiceQualifier(DEFAULT)\npublic class InterceptedDefaultTestService implements InterceptedTestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"default-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedLabeledTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\nimport static org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.LABELED;\n\n@ApplicationScoped\n@TestUpperCaseInterceptor\n@TestServiceQualifier(LABELED)\npublic class InterceptedLabeledTestService implements InterceptedTestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"labeled-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\npublic interface InterceptedTestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestServiceProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\npublic interface InterceptedTestServiceProducer\n{\n    InterceptedTestService createInterceptedTestService(InterceptedTestService interceptedTestService);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledServiceTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(activeAlternativeLabel = LabeledServiceTest.Label.class)\npublic class LabeledServiceTest\n{\n    @Inject\n    private InterceptedTestService interceptedTestService;\n\n    @Test\n    public void labeledValue()\n    {\n        Assert.assertEquals(\"LABELED-RESULT\", interceptedTestService.getValue());\n    }\n\n    class Label implements TestControl.Label\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledTestServiceProducer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.Dependent;\nimport jakarta.enterprise.inject.Alternative;\nimport jakarta.enterprise.inject.Default;\nimport jakarta.enterprise.inject.Produces;\n\nimport static org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.LABELED;\n\n@Alternative\n@ApplicationScoped\npublic class LabeledTestServiceProducer implements InterceptedTestServiceProducer\n{\n    @Produces\n    @Default //optional\n    @Dependent\n    public InterceptedTestService createInterceptedTestService(@TestServiceQualifier(LABELED) InterceptedTestService interceptedTestService)\n    {\n        return interceptedTestService; //the exposed result is an intercepted instance\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestServiceQualifier.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.inject.Qualifier;\nimport java.lang.annotation.*;\n\n@Qualifier\n@Documented\n@Inherited\n\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.TYPE, ElementType.PARAMETER })\npublic @interface TestServiceQualifier\n{\n    Mode value();\n\n    enum Mode\n    {\n        DEFAULT, LABELED\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.*;\n\n@InterceptorBinding\n@Documented\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ ElementType.TYPE, ElementType.METHOD })\npublic @interface TestUpperCaseInterceptor\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptorImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc018;\n\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@TestUpperCaseInterceptor\n@Interceptor\npublic class TestUpperCaseInterceptorImplementation implements Serializable\n{\n    @AroundInvoke\n    public Object executeInTransaction(InvocationContext invocationContext) throws Exception\n    {\n        Object result = invocationContext.proceed();\n\n        if (result instanceof String)\n        {\n            return ((String) result).toUpperCase();\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.ExternalContainer",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.testcontrol.InternalMyFacesTestContainerAdapter"
  },
  {
    "path": "deltaspike/modules/test-control/impl/obsolete/src/test/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.junit.TestStatementDecoratorFactory",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n#optional - just added to test possible side-effects\norg.apache.deltaspike.testcontrol.impl.transaction.TransactionStatementDecoratorFactory"
  },
  {
    "path": "deltaspike/modules/test-control/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>test-control-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-test-control-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Test-Control-Module Impl</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.testcontrol.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.testcontrol.impl.*,\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-test-control-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.geronimo.specs</groupId>\n            <artifactId>geronimo-jpa_2.2_spec</artifactId>\n            <optional>true</optional>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.el</groupId>\n            <artifactId>jakarta.el-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.mockito</groupId>\n            <artifactId>mockito-all</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n    </dependencies>\n\n\n    <profiles>\n        <profile>\n            <id>OWB</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-owb</artifactId>\n                    <version>${project.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n        </profile>\n        <profile>\n            <id>Weld</id>\n            <dependencies>\n                <!-- Adding a test dependency needed for Weld -->\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-weld</artifactId>\n                    <version>${project.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n                <!-- The remaining bits of this profile are located under deltaspike/parent/code/pom.xml -->\n            </dependencies>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/AbstractMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol.api.junit.TestBaseConfig;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol.api.mock.TypedMock;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic abstract class AbstractMockManager implements DynamicMockManager\n{\n    private Map<BeanCacheKey, Object> registeredMocks = new HashMap<BeanCacheKey, Object>();\n\n    @Override\n    public void addMock(Object mockInstance, Annotation... qualifiers)\n    {\n        //check if this method gets used without changing the default-config\n        if (!TestBaseConfig.MockIntegration.ALLOW_MOCKED_BEANS &&\n            !TestBaseConfig.MockIntegration.ALLOW_MOCKED_PRODUCERS)\n        {\n            throw new IllegalStateException(\"The support for mocked CDI-Beans is disabled \" +\n                \"due to a reduced portability across different CDI-implementations. \" +\n                \"Please set '\" + TestBaseConfig.MockIntegration.ALLOW_MOCKED_BEANS_KEY + \"' and/or '\" +\n                TestBaseConfig.MockIntegration.ALLOW_MOCKED_PRODUCERS_KEY + \"' to 'true' \" +\n                \"(in 'META-INF/apache-deltaspike.properties') on your test-classpath.\");\n        }\n\n        Class<?> mockClass = mockInstance.getClass();\n        Class<?> beanClass = mockClass.getSuperclass();\n\n        if (beanClass == null)\n        {\n            beanClass = mockClass;\n        }\n        if (Object.class.equals(beanClass))\n        {\n            throw new IllegalArgumentException(mockInstance.getClass().getName() +\n                \" isn't a supported approach for mocking -> please extend from the original class.\");\n        }\n\n        TypedMock typedMock = mockClass.getAnnotation(TypedMock.class);\n\n        if (typedMock == null)\n        {\n            typedMock = beanClass.getAnnotation(TypedMock.class);\n        }\n\n        Class[] specifiedTypes = null;\n\n        if (typedMock != null)\n        {\n            specifiedTypes = typedMock.value();\n        }\n        else\n        {\n            Typed typed = mockClass.getAnnotation(Typed.class);\n\n            if (typed == null || typed.value().length == 0)\n            {\n                typed = beanClass.getAnnotation(Typed.class);\n            }\n\n            if (typed != null && typed.value().length > 0)\n            {\n                specifiedTypes = typed.value();\n            }\n        }\n\n        if (specifiedTypes != null)\n        {\n            for (Class typedClass : specifiedTypes)\n            {\n                this.registeredMocks.put(new BeanCacheKey(typedClass, qualifiers), mockInstance);\n            }\n        }\n        else\n        {\n            this.registeredMocks.put(new BeanCacheKey(beanClass, qualifiers), mockInstance);\n        }\n    }\n\n    @Override\n    public <T> T getMock(Class<T> beanClass, Annotation... qualifiers)\n    {\n        return (T)this.registeredMocks.get(new BeanCacheKey(beanClass, qualifiers));\n    }\n\n    @Override\n    public void reset()\n    {\n        this.registeredMocks.clear();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/BeanCacheKey.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport org.apache.deltaspike.core.util.ReflectionUtils;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Array;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Comparator;\n\n//class from OWB\npublic class BeanCacheKey\n{\n    private static final Comparator<Annotation> ANNOTATION_COMPARATOR = new AnnotationComparator();\n\n    private final Type type;\n    private final Annotation qualifier;\n    private final Annotation qualifiers[];\n    private final int hashCode;\n\n    public BeanCacheKey(Type type, Annotation... qualifiers)\n    {\n        this.type = type;\n        final int length = qualifiers != null ? qualifiers.length : 0;\n        if (length == 0)\n        {\n            qualifier = null;\n            this.qualifiers = null;\n        }\n        else if (length == 1)\n        {\n            qualifier = qualifiers[0];\n            this.qualifiers = null;\n        }\n        else\n        {\n            qualifier = null;\n            // to save array creations, we only create an array, if we have more than one annotation\n            this.qualifiers = new Annotation[length];\n            System.arraycopy(qualifiers, 0, this.qualifiers, 0, length);\n            Arrays.sort(this.qualifiers, ANNOTATION_COMPARATOR);\n        }\n\n        // this class is directly used in ConcurrentHashMap.get() so simply init the hasCode here\n        hashCode = computeHashCode();\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n\n        BeanCacheKey cacheKey = (BeanCacheKey) o;\n\n        if (!type.equals(cacheKey.type))\n        {\n            return false;\n        }\n        if (qualifier != null ? !qualifierEquals(qualifier, cacheKey.qualifier) : cacheKey.qualifier != null)\n        {\n            return false;\n        }\n        if (!qualifierArrayEquals(qualifiers, cacheKey.qualifiers))\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    private boolean qualifierArrayEquals(Annotation[] qualifiers1, Annotation[] qualifiers2)\n    {\n        if (qualifiers1 == qualifiers2)\n        {\n            return true;\n        }\n        else if (qualifiers1 == null || qualifiers2 == null)\n        {\n            return false;\n        }\n        if (qualifiers1.length != qualifiers2.length)\n        {\n            return false;\n        }\n        for (int i = 0; i < qualifiers1.length; i++)\n        {\n            Annotation a1 = qualifiers1[i];\n            Annotation a2 = qualifiers2[i];\n            if (a1 == null ? a2 != null : !qualifierEquals(a1, a2))\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return hashCode;\n    }\n\n    /**\n     * Compute the HashCode. This should be called only in the constructor.\n     */\n    private int computeHashCode()\n    {\n        int computedHashCode = 31 * ReflectionUtils.calculateHashCodeOfType(type);\n        if (qualifier != null)\n        {\n            computedHashCode = 31 * computedHashCode + getQualifierHashCode(qualifier);\n        }\n        if (qualifiers != null)\n        {\n            for (int i = 0; i < qualifiers.length; i++)\n            {\n                computedHashCode = 31 * computedHashCode + getQualifierHashCode(qualifiers[i]);\n            }\n        }\n        return computedHashCode;\n    }\n\n    /**\n     * Calculate the hashCode() of a qualifier, which ignores {@link jakarta.enterprise.util.Nonbinding} members.\n     */\n    private int getQualifierHashCode(Annotation a)\n    {\n        return ReflectionUtils.calculateHashCodeOfAnnotation(a, true);\n    }\n\n    /**\n     * Implements the equals() method for qualifiers, which ignores {@link jakarta.enterprise.util.Nonbinding} members.\n     */\n    private boolean qualifierEquals(Annotation qualifier1, Annotation qualifier2)\n    {\n        return ANNOTATION_COMPARATOR.compare(qualifier1, qualifier2) == 0;\n    }\n\n    /**\n     * for debugging ...\n     */\n    @Override\n    public String toString()\n    {\n        return \"BeanCacheKey{\" + \"type=\" + type + \", qualifiers=\"\n                + (qualifiers == null ? qualifier : Arrays.asList(qualifiers)) + \", hashCode=\" + hashCode + '}';\n    }\n\n    /**\n     * to keep the annotations ordered.\n     */\n    private static class AnnotationComparator implements Comparator<Annotation>\n    {\n\n        // Notice: Sorting is a bit costly, but the use of this code is very rar.\n        @Override\n        public int compare(Annotation annotation1, Annotation annotation2)\n        {\n            final Class<? extends Annotation> type1 = annotation1.annotationType();\n            final Class<? extends Annotation> type2 = annotation2.annotationType();\n            final int temp = type1.getName().compareTo(type2.getName());\n            if (temp != 0)\n            {\n                return temp;\n            }\n            final Method[] member1 = type1.getDeclaredMethods();\n            final Method[] member2 = type2.getDeclaredMethods();\n\n            // TBD: the order of the list of members seems to be deterministic\n\n            int i = 0;\n            int j = 0;\n            final int length1 = member1.length;\n            final int length2 = member2.length;\n\n            // find next nonbinding\n            for (;; i++, j++)\n            {\n                while (i < length1 && member1[i].isAnnotationPresent(Nonbinding.class))\n                {\n                    i++;\n                }\n                while (j < length2 && member2[j].isAnnotationPresent(Nonbinding.class))\n                {\n                    j++;\n                }\n                if (i >= length1 && j >= length2)\n                { // both ended\n                    return 0;\n                }\n                else if (i >= length1)\n                { // #1 ended\n                    return 1;\n                }\n                else if (j >= length2)\n                { // #2 ended\n                    return -1;\n                }\n                else\n                { // not ended\n                    int c = member1[i].getName().compareTo(member2[j].getName());\n                    if (c != 0)\n                    {\n                        return c;\n                    }\n                    final Object value1 = ReflectionUtils.invokeMethod(annotation1, member1[i], Object.class, true);\n                    final Object value2 = ReflectionUtils.invokeMethod(annotation2, member2[j], Object.class, true);\n                    assert value1.getClass().equals(value2.getClass());\n\n                    if (value1 instanceof Comparable)\n                    {\n                        c = ((Comparable)value1).compareTo(value2);\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n                    }\n                    else if (value1.getClass().isArray())\n                    {\n                        c = value1.getClass().getComponentType().getName()\n                                .compareTo(value2.getClass().getComponentType().getName());\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n\n                        final int length = Array.getLength(value1);\n                        c = length - Array.getLength(value2);\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n                        for (int k = 0; k < length; k++)\n                        {\n                            c = ((Comparable)Array.get(value1, k)).compareTo(Array.get(value2, k));\n                            if (c != 0)\n                            {\n                                return c;\n                            }\n                        }\n\n                    }\n                    else if (value1 instanceof Class)\n                    {\n\n                        c = ((Class)value1).getName().compareTo(((Class) value2).getName());\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n                    }\n                    else\n                    {\n                        // valid types for members are only Comparable, Arrays, or Class\n                        assert false;\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/DefaultMockFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport org.apache.deltaspike.testcontrol.api.junit.TestBaseConfig;\nimport org.apache.deltaspike.testcontrol.spi.mock.MockFilter;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedMember;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Member;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\npublic class DefaultMockFilter implements MockFilter\n{\n    private static final Logger LOG = Logger.getLogger(DefaultMockFilter.class.getName());\n\n    private static final String DS_BASE_PACKAGE = \"org.apache.deltaspike.\";\n    private static final String JAVA_BASE_PACKAGE = \"java.\";\n    private static final String JAVAX_BASE_PACKAGE = \"javax.\";\n    private static final String JAKARTA_BASE_PACKAGE = \"jakarta.\";\n    private static final String EJB_BASE_PACKAGE = \"javax.ejb.\";\n    private static final String OWB_BASE_PACKAGE = \"org.apache.webbeans.\";\n    private static final String WELD_BASE_PACKAGE = \"org.jboss.weld.\";\n\n    @Override\n    public boolean isMockedImplementationSupported(BeanManager beanManager, Annotated annotated)\n    {\n        if (!isMockSupportEnabled(annotated))\n        {\n            return false;\n        }\n\n        Class origin = null;\n        if (annotated instanceof AnnotatedType)\n        {\n            origin = ((AnnotatedType)annotated).getJavaClass();\n            Set<Annotation> annotations = new HashSet<Annotation>();\n            annotations.addAll(annotated.getAnnotations());\n\n            for (AnnotatedMethod annotatedMethod :\n                (Set<jakarta.enterprise.inject.spi.AnnotatedMethod>)((AnnotatedType) annotated).getMethods())\n            {\n                annotations.addAll(annotatedMethod.getAnnotations());\n            }\n\n            if (isEjbOrAnnotatedTypeWithInterceptorAnnotation(\n                beanManager, annotations, origin.getName()))\n            {\n                return false;\n            }\n        }\n        else if (annotated instanceof AnnotatedMember)\n        {\n            Member member = ((AnnotatedMember)annotated).getJavaMember();\n            origin = member.getDeclaringClass();\n            if (isEjbOrAnnotatedTypeWithInterceptorAnnotation(\n                beanManager, annotated.getAnnotations(), member.toString()))\n            {\n                return false;\n            }\n        }\n\n        if (origin != null && origin.getPackage() == null)\n        {\n            LOG.warning(\"Please don't use the default-package for \" + origin.getName());\n            return true;\n        }\n\n        return origin != null && !isInternalPackage(origin.getPackage().getName());\n    }\n\n    protected boolean isMockSupportEnabled(Annotated annotated)\n    {\n        if ((annotated instanceof AnnotatedMethod || annotated instanceof AnnotatedField) &&\n                annotated.getAnnotation(Produces.class) != null)\n        {\n            return TestBaseConfig.MockIntegration.ALLOW_MOCKED_PRODUCERS;\n        }\n        else\n        {\n            return TestBaseConfig.MockIntegration.ALLOW_MOCKED_BEANS;\n        }\n    }\n\n    protected boolean isEjbOrAnnotatedTypeWithInterceptorAnnotation(BeanManager beanManager,\n                                                                    Set<Annotation> annotations,\n                                                                    String origin)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (annotation.annotationType().getName().startsWith(EJB_BASE_PACKAGE))\n            {\n                return true;\n            }\n\n            if (isStandardAnnotation(annotation))\n            {\n                continue;\n            }\n\n            if (beanManager.isInterceptorBinding(annotation.annotationType()) ||\n                (beanManager.isStereotype(annotation.annotationType()) &&\n                    isStereotypeWithInterceptor(annotation, beanManager)))\n            {\n                LOG.warning(\"Skip mocking intercepted bean \" + origin);\n\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected boolean isStereotypeWithInterceptor(Annotation stereotypeAnnotation, BeanManager beanManager)\n    {\n        for (Annotation annotation : stereotypeAnnotation.annotationType().getAnnotations())\n        {\n            if (isStandardAnnotation(annotation))\n            {\n                continue;\n            }\n\n            if (beanManager.isInterceptorBinding(annotation.annotationType()) ||\n                isStereotypeWithInterceptor(annotation, beanManager))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected boolean isStandardAnnotation(Annotation annotation)\n    {\n        return annotation.annotationType().getName().startsWith(JAVA_BASE_PACKAGE) ||\n            annotation.annotationType().getName().startsWith(JAVAX_BASE_PACKAGE) ||\n            annotation.annotationType().getName().startsWith(JAKARTA_BASE_PACKAGE);\n    }\n\n    protected boolean isInternalPackage(String packageName)\n    {\n        return packageName.startsWith(OWB_BASE_PACKAGE) || packageName.startsWith(WELD_BASE_PACKAGE) ||\n            isDeltaSpikePackage(packageName);\n    }\n\n    protected boolean isDeltaSpikePackage(String packageName)\n    {\n        return packageName.startsWith(DS_BASE_PACKAGE);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/MockAwareInjectionTargetWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.List;\nimport java.util.Set;\n\npublic class MockAwareInjectionTargetWrapper<T> implements InjectionTarget<T>\n{\n    private BeanManager beanManager;\n    private final InjectionTarget<T> wrapped;\n    private final List<Type> beanTypes;\n    private final List<Annotation> qualifiers;\n\n    public MockAwareInjectionTargetWrapper(BeanManager beanManager,\n                                           InjectionTarget<T> wrapped,\n                                           List<Type> beanTypes,\n                                           List<Annotation> qualifiers)\n    {\n        this.beanManager = beanManager;\n        this.wrapped = wrapped;\n        this.beanTypes = beanTypes;\n        this.qualifiers = qualifiers;\n    }\n\n    @Override\n    public T produce(CreationalContext<T> creationalContext)\n    {\n        DynamicMockManager mockManager =\n            BeanProvider.getContextualReference(this.beanManager, DynamicMockManager.class, false);\n\n        for (Type beanType : this.beanTypes)\n        {\n            Object mockInstance = mockManager.getMock(\n                    (Class)beanType, this.qualifiers.toArray(new Annotation[this.qualifiers.size()]));\n\n            if (mockInstance != null)\n            {\n                return (T)mockInstance;\n            }\n        }\n        return wrapped.produce(creationalContext);\n    }\n\n    /*\n     * generated\n     */\n\n    @Override\n    public void inject(T instance, CreationalContext<T> ctx)\n    {\n        wrapped.inject(instance, ctx);\n    }\n\n    @Override\n    public void postConstruct(T instance)\n    {\n        wrapped.postConstruct(instance);\n    }\n\n    @Override\n    public void preDestroy(T instance)\n    {\n        wrapped.preDestroy(instance);\n    }\n\n    @Override\n    public void dispose(T instance)\n    {\n        wrapped.dispose(instance);\n    }\n\n    @Override\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return wrapped.getInjectionPoints();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/MockAwareProducerWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.Producer;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.List;\nimport java.util.Set;\n\npublic class MockAwareProducerWrapper<T> implements Producer<T>\n{\n    private final BeanManager beanManager;\n    private final Producer<T> wrapped;\n    private final List<Type> beanTypes;\n    private final List<Annotation> qualifiers;\n\n    public MockAwareProducerWrapper(BeanManager beanManager,\n                                    Producer<T> wrapped,\n                                    List<Type> beanTypes,\n                                    List<Annotation> qualifiers)\n    {\n        this.beanManager = beanManager;\n        this.wrapped = wrapped;\n        this.beanTypes = beanTypes;\n        this.qualifiers = qualifiers;\n    }\n\n    @Override\n    public T produce(CreationalContext<T> creationalContext)\n    {\n        DynamicMockManager mockManager =\n            BeanProvider.getContextualReference(this.beanManager, DynamicMockManager.class, false);\n\n        for (Type beanType : this.beanTypes)\n        {\n            Object mockInstance = mockManager.getMock(\n                (Class)beanType, this.qualifiers.toArray(new Annotation[this.qualifiers.size()]));\n\n            if (mockInstance != null)\n            {\n                return (T)mockInstance;\n            }\n        }\n\n        return wrapped.produce(creationalContext);\n    }\n\n    /*\n     * generated\n     */\n\n    @Override\n    public void dispose(T instance)\n    {\n        wrapped.dispose(instance);\n    }\n\n    @Override\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return wrapped.getInjectionPoints();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/MockExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.apache.deltaspike.testcontrol.spi.mock.MockFilter;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AnnotatedMember;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.enterprise.inject.spi.ProcessInjectionTarget;\nimport jakarta.enterprise.inject.spi.ProcessProducer;\nimport jakarta.enterprise.inject.spi.Producer;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class MockExtension implements Extension, Deactivatable\n{\n    private Boolean isActivated = true;\n    private List<MockFilter> mockFilters;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n        mockFilters = ServiceUtils.loadServiceImplementations(MockFilter.class);\n    }\n\n    public <X> void onProcessInjectionTarget(@Observes ProcessInjectionTarget<X> processInjectionTarget,\n                                             BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        for (MockFilter mockFilter : mockFilters)\n        {\n            if (!mockFilter.isMockedImplementationSupported(beanManager, processInjectionTarget.getAnnotatedType()))\n            {\n                return;\n            }\n        }\n\n        List<Annotation> qualifiers = new ArrayList<Annotation>();\n        for (Annotation annotation : processInjectionTarget.getAnnotatedType().getAnnotations())\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                qualifiers.add(annotation);\n            }\n        }\n\n        Typed typed = processInjectionTarget.getAnnotatedType().getAnnotation(Typed.class);\n\n        List<Type> foundTypes = new ArrayList<>();\n        if (typed != null)\n        {\n            Collections.addAll(foundTypes, typed.value());\n        }\n        else\n        {\n            foundTypes.addAll(extractTypes(processInjectionTarget.getAnnotatedType().getJavaClass()));\n        }\n\n        if (foundTypes.isEmpty())\n        {\n            return;\n        }\n\n        final InjectionTarget<X> originalInjectionTarget = processInjectionTarget.getInjectionTarget();\n        processInjectionTarget.setInjectionTarget(new MockAwareInjectionTargetWrapper<X>(\n            beanManager, originalInjectionTarget, foundTypes, qualifiers));\n    }\n\n    public <X, T> void onProcessProducer(@Observes ProcessProducer<X, T> processProducer, BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        for (MockFilter mockFilter : mockFilters)\n        {\n            if (!mockFilter.isMockedImplementationSupported(beanManager, processProducer.getAnnotatedMember()))\n            {\n                return;\n            }\n        }\n\n        final Producer<T> originalProducer = processProducer.getProducer();\n        AnnotatedMember<X> annotatedMember = processProducer.getAnnotatedMember();\n        List<Annotation> qualifiers = new ArrayList<Annotation>();\n        for (Annotation annotation : annotatedMember.getAnnotations())\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                qualifiers.add(annotation);\n            }\n        }\n\n        Typed typed = annotatedMember.getAnnotation(Typed.class);\n\n        List<Type> foundTypes = new ArrayList<Type>();\n        if (typed != null)\n        {\n            Collections.addAll(foundTypes, typed.value());\n        }\n        else if (annotatedMember.getBaseType() instanceof Class)\n        {\n            foundTypes.addAll(extractTypes((Class)annotatedMember.getBaseType()));\n        }\n\n        if (foundTypes.isEmpty())\n        {\n            return;\n        }\n\n        processProducer.setProducer(new MockAwareProducerWrapper<T>(\n            beanManager, originalProducer, foundTypes, qualifiers));\n    }\n\n    //logic from org.apache.deltaspike.core.util.bean.BeanBuilder\n    protected List<Type> extractTypes(Class currentClass)\n    {\n        List<Type> result = new ArrayList<Type>();\n        for (Class<?> c = currentClass; c != Object.class && c != null; c = c.getSuperclass())\n        {\n            result.add(c);\n        }\n        Collections.addAll(result, currentClass.getInterfaces());\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/SimpleApplicationMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol.api.mock.ApplicationMockManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@Typed(ApplicationMockManager.class)\npublic class SimpleApplicationMockManager extends AbstractMockManager implements ApplicationMockManager\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/SimpleMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol.api.mock.ApplicationMockManager;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Inject;\nimport java.lang.annotation.Annotation;\n\n@RequestScoped\n@Typed(DynamicMockManager.class)\npublic class SimpleMockManager extends AbstractMockManager\n{\n    @Inject\n    private ApplicationMockManager applicationMockManager;\n\n    @Override\n    public <T> T getMock(Class<T> beanClass, Annotation... qualifiers)\n    {\n        T result = applicationMockManager.getMock(beanClass, qualifiers);\n\n        if (result != null)\n        {\n            return result;\n        }\n        return super.getMock(beanClass, qualifiers);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/request/ContextControlDecorator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.request;\n\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.spi.ExternalContainer;\n\nimport jakarta.decorator.Decorator;\nimport jakarta.decorator.Delegate;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.ConversationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Singleton;\nimport java.lang.annotation.Annotation;\n\n/**\n * Needed to allow the manual usage of\n * ContextControl#stopContext(RequestScoped.class)\n * and\n * ContextControl#startContext(RequestScoped.class)\n * within a test-method.\n * That can be useful in combination with the integration of myfaces-test for page-bean tests.\n */\n@Decorator\n//don't use an abstract decorator to keep the compatibility with old version of owb/weld\npublic class ContextControlDecorator implements ContextControl\n{\n    @Inject\n    @Delegate\n    private ContextControl wrapped;\n\n    @Override\n    public void startContexts()\n    {\n        wrapped.startContexts();\n\n        if (isManualScopeHandling())\n        {\n            for (ExternalContainer externalContainer : CdiTestRunner.getActiveExternalContainers())\n            {\n                externalContainer.startScope(Singleton.class);\n                externalContainer.startScope(ApplicationScoped.class);\n                externalContainer.startScope(RequestScoped.class);\n                externalContainer.startScope(SessionScoped.class);\n                externalContainer.startScope(ConversationScoped.class);\n            }\n        }\n    }\n\n    @Override\n    public void stopContexts()\n    {\n        if (isManualScopeHandling())\n        {\n            for (ExternalContainer externalContainer : CdiTestRunner.getActiveExternalContainers())\n            {\n                externalContainer.stopScope(ConversationScoped.class);\n                externalContainer.stopScope(SessionScoped.class);\n                externalContainer.stopScope(RequestScoped.class);\n                externalContainer.stopScope(ApplicationScoped.class);\n                externalContainer.stopScope(Singleton.class);\n            }\n        }\n\n        wrapped.stopContexts();\n    }\n\n    @Override\n    public void startContext(Class<? extends Annotation> scopeClass)\n    {\n        wrapped.startContext(scopeClass);\n\n        if (isManuallyHandledRequest(scopeClass))\n        {\n            for (ExternalContainer externalContainer : CdiTestRunner.getActiveExternalContainers())\n            {\n                externalContainer.startScope(scopeClass);\n            }\n        }\n    }\n\n    @Override\n    public void stopContext(Class<? extends Annotation> scopeClass)\n    {\n        wrapped.stopContext(scopeClass);\n\n        if (isManuallyHandledRequest(scopeClass))\n        {\n            for (ExternalContainer externalContainer : CdiTestRunner.getActiveExternalContainers())\n            {\n                externalContainer.stopScope(scopeClass);\n            }\n        }\n    }\n\n    private boolean isManuallyHandledRequest(Class<? extends Annotation> scopeClass)\n    {\n        return RequestScoped.class.equals(scopeClass) && isManualScopeHandling();\n    }\n\n    private boolean isManualScopeHandling()\n    {\n        return !Boolean.TRUE.equals(CdiTestRunner.isAutomaticScopeHandlingActive());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/validation/StandardContextTestControlValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol.impl.validation;\n\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.spi.TestAware;\nimport org.apache.deltaspike.testcontrol.spi.TestControlValidator;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n@Vetoed\npublic class StandardContextTestControlValidator implements TestAware, TestControlValidator\n{\n    private static Boolean customContextControlDetected;\n\n    private static ThreadLocal<Class> currentTestClass = new ThreadLocal<Class>();\n    private static ThreadLocal<Method> currentTestMethod = new ThreadLocal<Method>();\n\n    @Override\n    public void validate(TestControl testControl)\n    {\n        checkActiveContextControlImplementation();\n\n        List<Class<? extends Annotation>> scopeClasses = new ArrayList<Class<? extends Annotation>>();\n        Collections.addAll(scopeClasses, testControl.startScopes());\n\n        validateSupportedScopes(scopeClasses, currentTestClass.get(), currentTestMethod.get());\n    }\n\n    private void checkActiveContextControlImplementation()\n    {\n        if (customContextControlDetected != null)\n        {\n            return;\n        }\n\n        customContextControlDetected = !CdiContainerLoader.getCdiContainer().getContextControl()\n            .getClass().getName().startsWith(\"org.apache.deltaspike.\");\n    }\n\n    private void validateSupportedScopes(List<Class<? extends Annotation>> scopeClasses,\n                                         Class<?> declaringClass,\n                                         Method testMethod)\n    {\n        //skip validation in case of a custom context-control implementation (it might support more scopes)\n        if (Boolean.TRUE.equals(customContextControlDetected))\n        {\n            return;\n        }\n\n        for (Class<? extends Annotation> scopeClass : scopeClasses)\n        {\n            if (!scopeClass.getName().startsWith(\"jakarta.enterprise.context.\"))\n            {\n                throw new IllegalStateException(\"Please remove \" + scopeClass.getName() + \" at \" + declaringClass +\n                        (testMethod != null ? \"#\" + testMethod.getName() : \"\") +\n                        \" from @\" + TestControl.class.getName() + \". @\" + TestControl.class.getName() +\n                        \" only supports standard Scope-Annotations provided by the CDI-Specification. \" +\n                        \"Other Contexts start automatically or need to get started with a specific Management-API. \" +\n                        \"Examples: \" +\n                        \"@TransactionScoped gets started automatically once the @Transactional-Interceptor is used. \" +\n                        \"Whereas @WindowScoped starts once WindowContext#activateWindow gets called.\");\n            }\n        }\n    }\n\n    @Override\n    public void setTestClass(Class testClass)\n    {\n        currentTestClass.set(testClass);\n        if (testClass == null)\n        {\n            currentTestClass.remove();\n        }\n    }\n\n    @Override\n    public void setTestMethod(Method testMethod)\n    {\n        currentTestMethod.set(testMethod);\n        if (testMethod == null)\n        {\n            currentTestMethod.remove();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/resources/META-INF/apache-deltaspike_test-container.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\n#can be used to configure the underlying test-container\n#(currently the only container supported by deltaspike\n#(out-of-the-box) which supports that config is openejb-embedded)\n\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n\n    <decorators>\n        <class>org.apache.deltaspike.testcontrol.impl.request.ContextControlDecorator</class>\n    </decorators>\n\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.testcontrol.impl.mock.MockExtension"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.TestControlValidator",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.testcontrol.impl.validation.StandardContextTestControlValidator"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/main/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.mock.MockFilter",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.testcontrol.impl.mock.DefaultMockFilter"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/CustomMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol.impl.mock.SimpleMockManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Alternative;\nimport java.lang.annotation.Annotation;\n\n@Alternative\n\n@RequestScoped\n@Typed(DynamicMockManager.class)\npublic class CustomMockManager extends SimpleMockManager\n{\n    private static boolean isCalled;\n\n    @Override\n    public <T> T getMock(Class<T> beanClass, Annotation... qualifiers)\n    {\n        isCalled = true;\n\n        return super.getMock(beanClass, qualifiers);\n    }\n\n    public static boolean isIsCalled()\n    {\n        return isCalled;\n    }\n\n    public static void resetInternals()\n    {\n        isCalled = false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestClassDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.testcontrol.impl.mock.DefaultMockFilter;\n\n//just needed because the internal test-packages need to be handled differently\npublic class InternalTestClassDeactivator implements ClassDeactivator\n{\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        return !DefaultMockFilter.class.equals(targetClass);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestMockFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol;\n\nimport org.apache.deltaspike.testcontrol.impl.mock.DefaultMockFilter;\n\npublic class InternalTestMockFilter extends DefaultMockFilter\n{\n    private static final String DS_TEST_BASE_PACKAGE = \"org.apache.deltaspike.test.testcontrol.mock.\";\n\n    protected boolean isInternalPackage(String packageName)\n    {\n        return super.isInternalPackage(packageName) &&\n                (!packageName.startsWith(DS_TEST_BASE_PACKAGE) ||\n                    packageName.equals(CustomMockManager.class.getPackage().getName()));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc015/InterceptedBeanClassLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc015;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\n@TestInterceptor\npublic class InterceptedBeanClassLevel\n{\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc015/InterceptedBeanMethodLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc015;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptedBeanMethodLevel\n{\n    @TestInterceptor\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc015/InterceptedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc015;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class InterceptedBeanTest\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @Inject\n    private InterceptedBeanClassLevel interceptedBeanClassLevel;\n\n    @Inject\n    private InterceptedBeanMethodLevel interceptedBeanMethodLevel;\n\n    @Test\n    public void classLevelInterception()\n    {\n        Assert.assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanClassLevel.test();\n        Assert.assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n\n    @Test\n    public void methodLevelInterception()\n    {\n        Assert.assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanMethodLevel.test();\n        Assert.assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc015/InterceptionResultStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc015;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptionResultStorage\n{\n    private boolean intercepted;\n\n    public void markAsIntercepted()\n    {\n        this.intercepted = true;\n    }\n\n    public boolean isInterceptionDetected()\n    {\n        return intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc015/TestInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc015;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@InterceptorBinding\n\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\npublic @interface TestInterceptor\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/mock/uc015/TestInterceptorImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.mock.uc015;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@TestInterceptor\n@Interceptor\npublic class TestInterceptorImplementation implements Serializable\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @AroundInvoke\n    public Object intercept(InvocationContext ctx) throws Exception\n    {\n        this.interceptionResultStorage.markAsIntercepted();\n        return ctx.proceed();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/shared/ApplicationScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.shared;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ApplicationScopedBean\n{\n    private int count = 0;\n    private static int instanceCount = 0;\n\n    @PostConstruct\n    protected void init()\n    {\n        instanceCount++;\n    }\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n\n    public void resetCount()\n    {\n        this.count = 0;\n    }\n\n    public static int getInstanceCount()\n    {\n        return instanceCount;\n    }\n\n    public static void resetInstanceCount()\n    {\n        instanceCount = 0;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/shared/RequestScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.shared;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class RequestScopedBean\n{\n    private int count = 0;\n    private static int instanceCount = 0;\n\n    @PostConstruct\n    protected void init()\n    {\n        instanceCount++;\n    }\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n\n    public static int getInstanceCount()\n    {\n        return instanceCount;\n    }\n\n    public static int resetInstanceCount()\n    {\n        return instanceCount = 0;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/shared/SessionScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.shared;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport java.io.Serializable;\n\n@SessionScoped\npublic class SessionScopedBean implements Serializable\n{\n    private static final long serialVersionUID = -6055362670706159152L;\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/shared/TestUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.shared;\n\nimport org.junit.Test;\n\nimport java.lang.reflect.Method;\n\npublic abstract class TestUtils\n{\n    private TestUtils()\n    {\n    }\n\n    public static int getTestMethodCount(Class testClass)\n    {\n        int result = 0;\n        for (Method method : testClass.getDeclaredMethods())\n        {\n            if (method.isAnnotationPresent(Test.class))\n            {\n                result++;\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc001/RequestAndSessionScopePerTestMethodTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc001;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.TestUtils;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class) //starts container once and one session + request per test-method\n//implicitly annotated with @TestControl without the default-scope settings\npublic class RequestAndSessionScopePerTestMethodTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n    }\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n    }\n\n    @BeforeClass\n    public static void resetSharedState()\n    {\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n        RequestScopedBean.resetInstanceCount();\n    }\n\n    @AfterClass\n    public static void finalCheckAndCleanup()\n    {\n        int testCount = TestUtils.getTestMethodCount(RequestAndSessionScopePerTestMethodTest.class);\n\n        if (RequestScopedBean.getInstanceCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected instance count\");\n        }\n        RequestScopedBean.resetInstanceCount();\n\n        if (BeanProvider.getContextualReference(ApplicationScopedBean.class).getCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc002/SessionScopePerTestClassTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc002;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.TestUtils;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class) //starts container and session once and one request per test-method\n@TestControl(startScopes = SessionScoped.class)\npublic class SessionScopePerTestClassTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n    }\n\n    @Test\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n    }\n\n    @BeforeClass\n    public static void resetSharedState()\n    {\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n        RequestScopedBean.resetInstanceCount();\n    }\n\n    @AfterClass\n    public static void finalCheckAndCleanup()\n    {\n        int testCount = TestUtils.getTestMethodCount(SessionScopePerTestClassTest.class);\n\n        if (RequestScopedBean.getInstanceCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected instance count\");\n        }\n        RequestScopedBean.resetInstanceCount();\n\n        if (BeanProvider.getContextualReference(ApplicationScopedBean.class).getCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n\n        if (BeanProvider.getContextualReference(SessionScopedBean.class).getCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc003/RequestAndSessionScopePerTestMethodTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc003;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class) //starts container once and one session + request per test-method\n//implicitly annotated with @TestControl without the default-scope settings\npublic class RequestAndSessionScopePerTestMethodTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n    }\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n\n        Assert.assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        Assert.assertEquals(1, sessionScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc003/SessionScopePerTestClassTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc003;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class) //starts container and session once and one request per test-method\n@TestControl(startScopes = SessionScoped.class)\npublic class SessionScopePerTestClassTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n    }\n\n    @Test\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc003/TestSuite.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc003;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n@RunWith(CdiTestSuiteRunner.class) //starts container once (for the whole suite)\n@Suite.SuiteClasses({\n        RequestAndSessionScopePerTestMethodTest.class,\n        SessionScopePerTestClassTest.class\n})\npublic class TestSuite\n{\n    @BeforeClass\n    public static void resetSharedState()\n    {\n        ApplicationScopedBean.resetInstanceCount();\n    }\n\n    @AfterClass\n    public static void finalCheckAndCleanup()\n    {\n        if (ApplicationScopedBean.getInstanceCount() != 1)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n        ApplicationScopedBean.resetInstanceCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc004/ProjectStageTestControlTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc004;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.uc001.RequestAndSessionScopePerTestMethodTest;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\n@TestControl(projectStage = ProjectStage.Development.class) //can be a custom stage\n@Typed() //needed due to RequestAndSessionScopePerTestMethodTest\npublic class ProjectStageTestControlTest extends RequestAndSessionScopePerTestMethodTest //just to inherit the tests - to check that @TestControl#projectStage doesn't influence the default handling\n{\n    @Inject\n    private ProjectStage projectStage;\n\n    @Test\n    public void firstProjectStageTest()\n    {\n        Assert.assertEquals(ProjectStage.Development, this.projectStage);\n    }\n\n    @Test\n    @TestControl(projectStage = ProjectStage.UnitTest.class) //can be a custom stage - e.g. for a special test\n    public void secondProjectStageTest()\n    {\n        Assert.assertEquals(ProjectStage.UnitTest, this.projectStage);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc007/BaseTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc007;\n\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol.shared.SessionScopedBean;\n\nimport jakarta.inject.Inject;\n\npublic abstract class BaseTest\n{\n    @Inject\n    protected ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    protected SessionScopedBean sessionScopedBean;\n\n    @Inject\n    protected RequestScopedBean requestScopedBean;\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc007/ExtendedTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc007;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class ExtendedTest extends BaseTest\n{\n    @Test\n    public void inheritedInjectionTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        Assert.assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(1, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc008/BeforeAndAfterInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc008;\n\nimport junit.framework.Assert;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.test.testcontrol.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class BeforeAndAfterInjectionTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    private Integer foundValue;\n\n    @Before\n    public void before()\n    {\n        if (this.applicationScopedBean == null)\n        {\n            throw new IllegalStateException(\"injection failed\");\n        }\n\n        this.foundValue = this.applicationScopedBean.getCount();\n    }\n\n    @Test\n    public void injectionTest()\n    {\n        Assert.assertNotNull(this.applicationScopedBean);\n        Assert.assertNotNull(this.foundValue);\n    }\n\n    @After\n    public void after()\n    {\n        if (this.applicationScopedBean == null)\n        {\n            throw new IllegalStateException(\"injection failed\");\n        }\n        if (this.foundValue == null)\n        {\n            throw new IllegalStateException(\"different instance without initialized value found\");\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc011/InterceptedBeanClassLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc011;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\n@TestInterceptor\npublic class InterceptedBeanClassLevel\n{\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc011/InterceptedBeanMethodLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc011;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptedBeanMethodLevel\n{\n    @TestInterceptor\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc011/InterceptedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc011;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class InterceptedBeanTest\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @Inject\n    private InterceptedBeanClassLevel interceptedBeanClassLevel;\n\n    @Inject\n    private InterceptedBeanMethodLevel interceptedBeanMethodLevel;\n\n    @Test\n    public void classLevelInterception()\n    {\n        Assert.assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanClassLevel.test();\n        Assert.assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n\n    @Test\n    public void methodLevelInterception()\n    {\n        Assert.assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanMethodLevel.test();\n        Assert.assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc011/InterceptionResultStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc011;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptionResultStorage\n{\n    private boolean intercepted;\n\n    public void markAsIntercepted()\n    {\n        this.intercepted = true;\n    }\n\n    public boolean isInterceptionDetected()\n    {\n        return intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc011/TestInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc011;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@InterceptorBinding\n\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\npublic @interface TestInterceptor\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc011/TestInterceptorImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc011;\n\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@TestInterceptor\n@Interceptor\npublic class TestInterceptorImplementation implements Serializable\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @AroundInvoke\n    public Object intercept(InvocationContext ctx) throws Exception\n    {\n        this.interceptionResultStorage.markAsIntercepted();\n        return ctx.proceed();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc012/ApplicationScopedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc012;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class ApplicationScopedBeanTest\n{\n    @Inject\n    private ApplicationScopedTestBean testBean;\n\n    @Inject\n    private ApplicationScopedTestBeanClient testBeanClient;\n\n    @Test\n    public void beanAccess()\n    {\n        this.testBean.setValue(0);\n        Assert.assertEquals(1, this.testBeanClient.getNextValue());\n        Assert.assertEquals(1, this.testBean.getValue());\n    }\n\n    @AfterClass\n    public static void finalCheck()\n    {\n        int value = BeanProvider.getContextualReference(ApplicationScopedTestBean.class).getValue();\n        int nextValue = BeanProvider.getContextualReference(ApplicationScopedTestBeanClient.class).getNextValue();\n\n        if (value == 0)\n        {\n            throw new IllegalStateException(\"new application-scoped bean instance was created\");\n        }\n\n        if (nextValue == 1)\n        {\n            throw new IllegalStateException(\"new application-scoped bean instance was created\");\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc012/ApplicationScopedTestBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc012;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ApplicationScopedTestBean\n{\n    private int value = 0;\n\n    public void increaseValue()\n    {\n        this.value++;\n    }\n\n    public int getValue()\n    {\n        return value;\n    }\n\n    public void setValue(int value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc012/ApplicationScopedTestBeanClient.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc012;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class ApplicationScopedTestBeanClient\n{\n    @Inject\n    private ApplicationScopedTestBean testBean;\n\n    public int getNextValue()\n    {\n        this.testBean.increaseValue();\n        return this.testBean.getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc013/ContainerConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc013;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n\n\n@RunWith(CdiTestRunner.class)\npublic class ContainerConfigTest\n{\n\n    @Test\n    @TestControl(projectStage = ProjectStage.UnitTest.class) //just for internal tests\n    public void configForTestContainerStageUnitTest()\n    {\n        Assert.assertNotNull(CdiTestSuiteRunner.getTestContainerConfig());\n        Assert.assertEquals(\"jdbc:hsqldb:mem:demoDB\",\n            CdiTestSuiteRunner.getTestContainerConfig().getProperty(\"demoDatabase.JdbcUrl\"));\n    }\n\n    @Test\n    @TestControl(projectStage = ProjectStage.IntegrationTest.class) //just for internal tests\n    public void configForTestContainerStageIntegrationTest()\n    {\n        Assert.assertNotNull(CdiTestSuiteRunner.getTestContainerConfig());\n        Assert.assertEquals(\"jdbc:hsqldb:file:demoDB\",\n            CdiTestSuiteRunner.getTestContainerConfig().getProperty(\"demoDatabase.JdbcUrl\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/DefaultTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DefaultTestService implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"default-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestBeanClassFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\n\n//!!!not!!! needed with cdi 1.1+ and @Priority (which is the target of this use-case)\n//only needed because our test-suite is based on cdi v1.0\n\n//also useful to test DELTASPIKE-1337\npublic class TestBeanClassFilter implements ClassFilter\n{\n    @Override\n    public boolean isFiltered(Class<?> targetClass)\n    {\n        if (!targetClass.getName().startsWith(\"org.apache.deltaspike.test.\"))\n        {\n            return false;\n        }\n\n        String currentTestOrigin = ConfigResolver.getPropertyValue(TestControl.class.getName());\n\n        if (currentTestOrigin == null) //no known origin (no @TestControl is used)\n        {\n            //filter all classes which are located in packages using tests with class-filters\n            //(since we test the feature with ambiguous beans which isn't valid without filtering)\n            return getClass().getPackage().getName().equals(targetClass.getPackage().getName());\n        }\n        else\n        {\n            Class<?> currentOrigin = ClassUtils.tryToLoadClassForName(currentTestOrigin);\n            //origin is in one of the packages for class-filtering tests\n            if (getClass().getPackage().getName().equals(currentOrigin.getPackage().getName()))\n            {\n                TestControl testControl = currentOrigin.getAnnotation(TestControl.class);\n                return ClassUtils.tryToInstantiateClass(testControl.classFilter()).isFiltered(targetClass);\n            }\n            return isInSamePackage(targetClass);\n        }\n    }\n\n    private boolean isInSamePackage(Class<?> targetClass)\n    {\n        return targetClass.getPackage().getName().equals(getClass().getPackage().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestLabeled.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport org.apache.deltaspike.testcontrol.api.TestControl;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target(TYPE)\npublic @interface TestLabeled\n{\n    Class<? extends TestControl.Label> value();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestLabeledAlternativeFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\n\nimport jakarta.enterprise.inject.Alternative;\n\npublic abstract class TestLabeledAlternativeFilter implements ClassFilter\n{\n    private final Class<? extends TestControl.Label> activeLabel;\n\n    protected TestLabeledAlternativeFilter(Class<? extends TestControl.Label> activeLabel)\n    {\n        this.activeLabel = activeLabel;\n    }\n\n    @Override\n    public boolean isFiltered(Class<?> targetClass)\n    {\n        if (!targetClass.isAnnotationPresent(Alternative.class))\n        {\n            return false;\n        }\n\n        TestLabeled testLabeled = targetClass.getAnnotation(TestLabeled.class);\n\n        if (testLabeled == null)\n        {\n            return false;\n        }\n\n        if (testLabeled.value().equals(activeLabel))\n        {\n            return false;\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\npublic interface TestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestServiceLabelX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@TestLabeled(TestServiceLabelXTest.TestLabelX.class)\n@ApplicationScoped\npublic class TestServiceLabelX implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-x\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestServiceLabelXTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(\n    activeAlternativeLabel = TestServiceLabelXTest.TestLabelX.class,\n    classFilter = TestServiceLabelXTest.LabelXFilter.class)\npublic class TestServiceLabelXTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultX()\n    {\n        Assert.assertEquals(\"result-x\", testService.getValue());\n    }\n\n    public static class TestLabelX implements TestControl.Label\n    {\n    }\n\n    //replaces the text based config of labeled-alternatives\n    public static class LabelXFilter extends TestLabeledAlternativeFilter\n    {\n        public LabelXFilter()\n        {\n            super(TestLabelX.class);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestServiceLabelY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@TestLabeled(TestServiceLabelYTest.TestLabelY.class)\n@ApplicationScoped\npublic class TestServiceLabelY implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-y\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc019/TestServiceLabelYTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol.uc019;\n\nimport org.apache.deltaspike.test.category.SeCategory;\nimport org.apache.deltaspike.testcontrol.api.TestControl;\nimport org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.junit.runner.RunWith;\n\nimport jakarta.inject.Inject;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Category(SeCategory.class)\n\n@RunWith(CdiTestRunner.class)\n@TestControl(\n        activeAlternativeLabel = TestServiceLabelYTest.TestLabelY.class,\n        classFilter = TestServiceLabelYTest.LabelYFilter.class)\npublic class TestServiceLabelYTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultY()\n    {\n        Assert.assertEquals(\"result-y\", testService.getValue());\n    }\n\n    public static class TestLabelY implements TestControl.Label\n    {\n    }\n\n    //replaces the text based config of labeled-alternatives\n    public static class LabelYFilter extends TestLabeledAlternativeFilter\n    {\n        public LabelYFilter()\n        {\n            super(TestServiceLabelYTest.TestLabelY.class);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\ndeltaspike.testcontrol.mock-support.allow_mocked_beans=true\ndeltaspike.testcontrol.mock-support.allow_mocked_producers=true\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.test.testcontrol.InternalTestClassDeactivator\n\ndeltaspike.testcontrol.test-container.config-file.UnitTest=META-INF/test/dsTestContainerBootConfig.properties\n\n#only needed because our test-suite is based on cdi v1.0. with v1.1+ and @Priority (which is the target of this use-case) the following part isn't needed:\norg.apache.deltaspike.core.spi.filter.ClassFilter=org.apache.deltaspike.test.testcontrol.uc019.TestBeanClassFilter"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike_test-container.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\n#can be used to configure the underlying test-container\n#(currently the only container supported by deltaspike\n#(out-of-the-box) which supports that config is openejb-embedded)\n\n#just random config-entries\ndemoDatabase.JdbcUrl=jdbc:hsqldb:file:demoDB\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n    <interceptors>\n        <class>org.apache.deltaspike.test.testcontrol.uc011.TestInterceptorImplementation</class>\n        <class>org.apache.deltaspike.test.testcontrol.mock.uc015.TestInterceptorImplementation</class>\n    </interceptors>\n\n    <alternatives>\n        <class>org.apache.deltaspike.test.testcontrol.CustomMockManager</class>\n\n        <!-- with cdi 1.1+ the following can be replaced with @Priority(...)-->\n        <class>org.apache.deltaspike.test.testcontrol.uc019.TestServiceLabelX</class>\n        <class>org.apache.deltaspike.test.testcontrol.uc019.TestServiceLabelY</class>\n    </alternatives>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.alternative.AlternativeBeanClassProvider",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.testcontrol.uc016.CustomAlternativeBeanClassProvider"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.mock.MockFilter",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.testcontrol.InternalTestMockFilter"
  },
  {
    "path": "deltaspike/modules/test-control/impl/src/test/resources/META-INF/test/dsTestContainerBootConfig.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\n#can be used to configure the underlying test-container\n#(currently the only container supported by deltaspike\n#(out-of-the-box) which supports that config is openejb-embedded)\n\n#just random config-entries\ndemoDatabase.JdbcUrl=jdbc:hsqldb:mem:demoDB\n"
  },
  {
    "path": "deltaspike/modules/test-control/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>test-control-module-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Test-Control-Module</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>test-control5-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-test-control5-module-api</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Test-Control5-Module API (JUnit 5)</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.testcontrol5.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            jakarta.enterprise.inject,\n            !org.apache.deltaspike.testcontrol5.*,\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-api</artifactId>\n            <version>${junit5.version}</version>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/TestControl.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api;\n\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport java.util.logging.ConsoleHandler;\nimport java.util.logging.Handler;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Optional control annotation for JUnit 5 unit-tests\n */\n\n@Target({ TYPE, METHOD })\n@Retention(RUNTIME)\npublic @interface TestControl\n{\n    /**\n     * only supports contexts supported by ContextControl#startContext\n     * defaults: session- and request-scope\n     */\n    Class<? extends Annotation>[] startScopes() default { };\n\n    //TODO discuss callbacks\n\n    Class<? extends ProjectStage> projectStage() default ProjectStage.UnitTest.class;\n\n    /**\n     * only supported on test-class-level\n     */\n    Class<? extends Handler> logHandler() default ConsoleHandler.class;\n\n    /**\n     * Requires additional service-loader config\n     * Currently only supported on class-level\n     */\n    boolean startExternalContainers() default true;\n\n    /**\n     * allows to label alternative cdi-beans similar to global alternatives to bind them to 0-n tests\n     */\n    Class<? extends Label> activeAlternativeLabel() default Label.class;\n\n    //with cdi 1.1+ it can be used to implement labeled-alternatives without text based config\n    //(details see DELTASPIKE-1338)\n    /**\n     * low-level filter (mainly needed for special cases if labeled-alternatives aren't enough)\n     * @return the class-filter class which should be used for the current test-class\n     */\n    Class<? extends ClassFilter> classFilter() default ClassFilter.class;\n\n    interface Label\n    {\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/junit/CdiTestExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.junit;\n\nimport jakarta.inject.Named;\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ExceptionUtils;\nimport org.apache.deltaspike.core.util.ProjectStageProducer;\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.literal.TestControlLiteral;\nimport org.apache.deltaspike.testcontrol5.spi.ExternalContainer;\nimport org.apache.deltaspike.testcontrol5.spi.TestAware;\nimport org.apache.deltaspike.testcontrol5.spi.TestControlValidator;\nimport org.apache.deltaspike.testcontrol5.spi.junit.TestStatementDecoratorFactory;\nimport org.junit.jupiter.api.extension.AfterAllCallback;\nimport org.junit.jupiter.api.extension.AfterEachCallback;\nimport org.junit.jupiter.api.extension.BeforeAllCallback;\nimport org.junit.jupiter.api.extension.BeforeEachCallback;\nimport org.junit.jupiter.api.extension.ExtensionContext;\nimport org.junit.jupiter.api.extension.ParameterContext;\nimport org.junit.jupiter.api.extension.ParameterResolutionException;\nimport org.junit.jupiter.api.extension.ParameterResolver;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Singleton;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Stack;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.logging.Handler;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n\n/**\n * A JUnit 5 extension to start up with a CDI or embedded JavaEE container.\n */\npublic class CdiTestExtension implements BeforeAllCallback, AfterAllCallback,\n                                         BeforeEachCallback, AfterEachCallback, ParameterResolver\n{\n    private static final Logger LOGGER = Logger.getLogger(CdiTestExtension.class.getName());\n\n    private static final String STORE_KEY_TEST_CONTEXT = \"testContext\";\n    private static final String STORE_KEY_INJECTED_FLAG = \"testInjected\";\n\n    private static final boolean USE_TEST_CLASS_AS_CDI_BEAN;\n    private static final boolean ALLOW_INJECTION_POINT_MANIPULATION;\n\n\n    static\n    {\n        USE_TEST_CLASS_AS_CDI_BEAN = TestBaseConfig.ContainerIntegration.USE_TEST_CLASS_AS_CDI_BEAN;\n        ALLOW_INJECTION_POINT_MANIPULATION = TestBaseConfig.MockIntegration.ALLOW_MANUAL_INJECTION_POINT_MANIPULATION;\n    }\n\n    private List<TestStatementDecoratorFactory> statementDecoratorFactories;\n\n    protected static ExtensionContext.Store getStore(ExtensionContext extensionContext)\n    {\n        final ExtensionContext.Namespace namespace = ExtensionContext.Namespace.create(CdiTestExtension.class, extensionContext.getUniqueId());\n        return extensionContext.getStore(namespace);\n    }\n\n    protected ContainerAwareTestContext getClassTestContext(ExtensionContext extensionContext)\n    {\n        final ExtensionContext.Store store = getStore(extensionContext);\n        return store.getOrComputeIfAbsent(STORE_KEY_TEST_CONTEXT, k ->\n            {\n                TestControl testControl = extensionContext.getTestClass()\n                    .map(cls -> cls.getAnnotation(TestControl.class)).orElse(null);\n\n                ContainerAwareTestContext testContext = new ContainerAwareTestContext(testControl, null);\n\n                Class<? extends Handler> logHandlerClass = testContext.getLogHandlerClass();\n\n                if (!Handler.class.equals(logHandlerClass))\n                {\n                    try\n                    {\n                        LOGGER.addHandler(logHandlerClass.newInstance());\n                    }\n                    catch (Exception e)\n                    {\n                        throw ExceptionUtils.throwAsRuntimeException(e);\n                    }\n                }\n\n                this.statementDecoratorFactories = ServiceUtils.loadServiceImplementations(TestStatementDecoratorFactory.class);\n                Collections.sort(this.statementDecoratorFactories,\n                    (f1, f2) -> f1.getOrdinal() > f2.getOrdinal() ? 1 : -1);\n\n                return testContext;\n            }, ContainerAwareTestContext.class);\n    }\n\n\n\n    protected ContainerAwareTestContext getMethodTestContext(ExtensionContext methodExtensionContext)\n    {\n        final ExtensionContext.Store store = getStore(methodExtensionContext);\n\n        return store.getOrComputeIfAbsent(STORE_KEY_TEST_CONTEXT, k ->\n            {\n                TestControl testControl = methodExtensionContext.getTestMethod()\n                    .map(cls -> cls.getAnnotation(TestControl.class)).orElse(null);\n\n                ContainerAwareTestContext classTestContext = getClassTestContext(methodExtensionContext.getParent().orElse(null));\n                return new ContainerAwareTestContext(testControl, classTestContext);\n            }, ContainerAwareTestContext.class);\n    }\n\n    @Override\n    public void beforeEach(ExtensionContext extensionContext) throws Exception\n    {\n\n        ContainerAwareTestContext currentTestContext = getMethodTestContext(extensionContext);\n\n        extensionContext.getTestMethod().ifPresent(method ->\n            {\n                try\n                {\n                    currentTestContext.applyBeforeMethodConfig(method);\n                }\n                catch (Exception e)\n                {\n                    throw ExceptionUtils.throwAsRuntimeException(e);\n                }\n            });\n\n        final ExtensionContext.Store store = getStore(extensionContext);\n        final ConcurrentMap<Integer, Boolean> isInjectedMap\n            = store.getOrComputeIfAbsent(STORE_KEY_INJECTED_FLAG, k -> new ConcurrentHashMap(), ConcurrentMap.class);\n\n        final int classId = System.identityHashCode(extensionContext.getTestInstance());\n        if (!isInjectedMap.containsKey(classId))\n        {\n            BeanProvider.injectFields(extensionContext.getTestInstance().get());\n            isInjectedMap.putIfAbsent(classId, Boolean.TRUE);\n        }\n    }\n\n    @Override\n    public void afterEach(ExtensionContext extensionContext) throws Exception\n    {\n        ContainerAwareTestContext currentTestContext = getMethodTestContext(extensionContext);\n\n        if (currentTestContext != null)\n        {\n            currentTestContext.applyAfterMethodConfig();\n        }\n    }\n\n    @Override\n    public void beforeAll(ExtensionContext extensionContext) throws Exception\n    {\n        getClassTestContext(extensionContext).applyBeforeClassConfig(extensionContext.getTestClass().orElseThrow());\n    }\n\n    @Override\n    public void afterAll(ExtensionContext extensionContext) throws Exception\n    {\n        final ContainerAwareTestContext testContext = getClassTestContext(extensionContext);\n        if (testContext != null)\n        {\n            testContext.applyAfterClassConfig();\n        }\n\n        // TODO destroy all injected beans\n        // this might need a namespace storage in the context?\n\n    }\n\n    @Override\n    public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)\n            throws ParameterResolutionException\n    {\n        return false;\n    }\n\n    @Override\n    public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)\n            throws ParameterResolutionException\n    {\n        return null;\n    }\n\n    private class ContainerAwareTestContext\n    {\n        private ContainerAwareTestContext parent;\n\n        private final ProjectStage projectStage;\n        private final TestControl testControl;\n\n        private ProjectStage previousProjectStage;\n\n        private boolean containerStarted = false;\n\n        private Stack<Class<? extends Annotation>> startedScopes = new Stack<>();\n\n        private List<ExternalContainer> externalContainers;\n\n        ContainerAwareTestContext(TestControl testControl, ContainerAwareTestContext parent)\n        {\n            this.parent = parent;\n\n            Class<? extends ProjectStage> foundProjectStageClass;\n            if (testControl == null)\n            {\n                this.testControl = new TestControlLiteral();\n                if (parent != null)\n                {\n                    foundProjectStageClass = parent.testControl.projectStage();\n                }\n                else\n                {\n                    foundProjectStageClass = this.testControl.projectStage();\n                }\n            }\n            else\n            {\n                this.testControl = testControl;\n                foundProjectStageClass = this.testControl.projectStage();\n            }\n            this.projectStage = ProjectStage.valueOf(foundProjectStageClass.getSimpleName());\n\n            ProjectStageProducer.setProjectStage(this.projectStage);\n        }\n\n        boolean isContainerStarted()\n        {\n            return this.containerStarted || (this.parent != null && this.parent.isContainerStarted());\n        }\n\n        Class<? extends Handler> getLogHandlerClass()\n        {\n            return this.testControl.logHandler();\n        }\n\n        void applyBeforeClassConfig(Class<?> testClass)\n        {\n            CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n            if (!isContainerStarted())\n            {\n                // We are setting this system property to make the deployment for Weld \"flat\"\n                // This (amongst other things) means that alternatives enabled via beans.xml will be\n                // enabled globally\n                // Beginning with Weld 2.x you could use Weld.property(), but here we depend on Weld 1.x API\n                // Note that Weld 1 was \"flat\" anyway, so this property only affects newer versions of Weld\n                // System.setProperty(\"org.jboss.weld.se.archive.isolation\", \"false\");\n                // Weld 5.0: https://docs.jboss.org/weld/reference/5.0.0.Final/en-US/html_single/#_bean_archive_isolation\n                System.setProperty(\"org.jboss.weld.environment.servlet.archive.isolation\", \"false\");\n\n                String activeAlternativeLabel = checkForLabeledAlternativeConfig(testControl);\n\n                initTestEnvConfig(testClass, activeAlternativeLabel, testControl);\n\n                container.boot(CdiTestSuiteExtension.getTestContainerConfig());\n                setContainerStarted();\n\n                bootExternalContainers(testClass);\n            }\n\n            List<Class<? extends Annotation>> restrictedScopes = new ArrayList<Class<? extends Annotation>>();\n\n            restrictedScopes.add(ApplicationScoped.class);\n            restrictedScopes.add(Singleton.class);\n\n            if (this.parent == null && this.testControl.getClass().equals(TestControlLiteral.class))\n            {\n                restrictedScopes.add(RequestScoped.class);\n                restrictedScopes.add(SessionScoped.class);\n            }\n\n            startScopes(container, testClass, null, restrictedScopes.toArray(new Class[restrictedScopes.size()]));\n        }\n\n        private void bootExternalContainers(Class testClass)\n        {\n            if (!this.testControl.startExternalContainers())\n            {\n                return;\n            }\n\n            if (this.externalContainers == null)\n            {\n                List<ExternalContainer> configuredExternalContainers =\n                        ServiceUtils.loadServiceImplementations(ExternalContainer.class);\n                Collections.sort(configuredExternalContainers, new Comparator<ExternalContainer>()\n                {\n                    @Override\n                    public int compare(ExternalContainer ec1, ExternalContainer ec2)\n                    {\n                        return ec1.getOrdinal() > ec2.getOrdinal() ? 1 : -1;\n                    }\n                });\n\n                this.externalContainers = new ArrayList<ExternalContainer>(configuredExternalContainers.size());\n\n                ExternalContainer externalContainerBean;\n                for (ExternalContainer externalContainer : configuredExternalContainers)\n                {\n                    externalContainerBean = BeanProvider.getContextualReference(externalContainer.getClass(), true);\n\n                    if (externalContainerBean != null)\n                    {\n                        this.externalContainers.add(externalContainerBean);\n                    }\n                    else\n                    {\n                        this.externalContainers.add(externalContainer);\n                    }\n                }\n\n                for (ExternalContainer externalContainer : this.externalContainers)\n                {\n                    try\n                    {\n                        if (externalContainer instanceof TestAware)\n                        {\n                            ((TestAware) externalContainer).setTestClass(testClass);\n                        }\n                        externalContainer.boot();\n                    }\n                    catch (RuntimeException e)\n                    {\n                        Logger.getLogger(CdiTestExtension.class.getName()).log(Level.WARNING,\n                                \"booting \" + externalContainer.getClass().getName() + \" failed\", e);\n                    }\n                }\n            }\n        }\n\n        void applyAfterClassConfig()\n        {\n            CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n            stopStartedScopes(container);\n\n            if (this.containerStarted)\n            {\n                if (CdiTestSuiteExtension.isStopContainerAllowed())\n                {\n                    shutdownExternalContainers();\n\n                    container.shutdown();\n                    CdiTestSuiteExtension.setContainerStarted(false);\n                }\n            }\n        }\n\n        private void shutdownExternalContainers()\n        {\n            if (this.externalContainers == null)\n            {\n                return;\n            }\n\n            for (ExternalContainer externalContainer : this.externalContainers)\n            {\n                try\n                {\n                    externalContainer.shutdown();\n                }\n                catch (RuntimeException e)\n                {\n                    Logger.getLogger(CdiTestExtension.class.getName()).log(Level.WARNING,\n                            \"shutting down \" + externalContainer.getClass().getName() + \" failed\", e);\n                }\n            }\n        }\n\n        void applyBeforeMethodConfig(Method testMethod)\n        {\n            this.previousProjectStage = ProjectStageProducer.getInstance().getProjectStage();\n            ProjectStageProducer.setProjectStage(this.projectStage);\n\n            setCurrentTestMethod(testMethod);\n            startScopes(CdiContainerLoader.getCdiContainer(), testMethod.getDeclaringClass(), testMethod);\n        }\n\n        void applyAfterMethodConfig()\n        {\n            try\n            {\n                stopStartedScopes(CdiContainerLoader.getCdiContainer());\n            }\n            finally\n            {\n                setCurrentTestMethod(null);\n                ProjectStageProducer.setProjectStage(previousProjectStage);\n                previousProjectStage = null;\n            }\n        }\n\n        private String checkForLabeledAlternativeConfig(TestControl testControl)\n        {\n            String activeAlternativeLabel = \"\";\n\n            if (testControl != null)\n            {\n                Class<? extends TestControl.Label> activeTypedAlternativeLabel =\n                    testControl.activeAlternativeLabel();\n\n                if (!TestControl.Label.class.equals(activeTypedAlternativeLabel))\n                {\n                    Named labelName = activeTypedAlternativeLabel.getAnnotation(Named.class);\n\n                    if (labelName != null)\n                    {\n                        activeAlternativeLabel = labelName.value();\n                    }\n                    else\n                    {\n                        String labelClassName = activeTypedAlternativeLabel.getSimpleName();\n                        activeAlternativeLabel = labelClassName.substring(0, 1).toLowerCase();\n\n                        if (labelClassName.length() > 1)\n                        {\n                            activeAlternativeLabel += labelClassName.substring(1);\n                        }\n                    }\n                }\n            }\n            return activeAlternativeLabel;\n        }\n\n        private void initTestEnvConfig(Class<?> testClass, String activeAlternativeLabel, TestControl testControl)\n        {\n            if (ClassDeactivationUtils.isActivated(TestConfigSource.class))\n            {\n                TestConfigSource testConfigSource = null;\n\n                for (ConfigSource configSource : ConfigResolver.getConfigSources())\n                {\n                    if (configSource instanceof TestConfigSource)\n                    {\n                        //if it happens: parallel test-execution can't be supported with labeled alternatives\n                        testConfigSource = (TestConfigSource) configSource;\n                    }\n                }\n\n                if (testConfigSource == null)\n                {\n                    testConfigSource = new TestConfigSource();\n                    ConfigResolver.addConfigSources(Arrays.asList(testConfigSource));\n                }\n\n                //always set it even if it is empty (it might overrule the value of the prev. test\n                testConfigSource.getProperties().put(\"activeAlternativeLabel\", activeAlternativeLabel);\n\n                testConfigSource.getProperties().put(\"activeAlternativeLabelSource\", testClass.getName());\n\n                if (testControl != null)\n                {\n                    testConfigSource.getProperties().put(TestControl.class.getName(), testClass.getName());\n                    testConfigSource.getProperties().put(ClassFilter.class.getName(), testControl.classFilter().getName());\n                }\n                else\n                {\n                    //reset it to avoid leaks between tests\n                    testConfigSource.getProperties().put(TestControl.class.getName(), TestControl.class.getName());\n                    testConfigSource.getProperties().put(ClassFilter.class.getName(), ClassFilter.class.getName());\n                }\n            }\n            else\n            {\n                throw new IllegalStateException(\"Alternative Environments require TestConfigSource to be active\");\n            }\n        }\n        void setContainerStarted()\n        {\n            this.containerStarted = true;\n            CdiTestSuiteExtension.setContainerStarted(true);\n        }\n\n        private void startScopes(CdiContainer container,\n                                 Class testClass,\n                                 Method testMethod,\n                                 Class<? extends Annotation>... restrictedScopes)\n        {\n            ContextControl contextControl = container.getContextControl();\n\n            List<Class<? extends Annotation>> scopeClasses = new ArrayList<>();\n\n            Collections.addAll(scopeClasses, this.testControl.startScopes());\n\n            if (scopeClasses.isEmpty())\n            {\n                addScopesForDefaultBehavior(scopeClasses);\n            }\n            else\n            {\n                List<TestControlValidator> testControlValidatorList =\n                        ServiceUtils.loadServiceImplementations(TestControlValidator.class);\n\n                for (TestControlValidator testControlValidator : testControlValidatorList)\n                {\n                    if (testControlValidator instanceof TestAware)\n                    {\n                        if (testMethod != null)\n                        {\n                            ((TestAware) testControlValidator).setTestMethod(testMethod);\n                        }\n                        ((TestAware) testControlValidator).setTestClass(testClass);\n                    }\n                    try\n                    {\n                        testControlValidator.validate(this.testControl);\n                    }\n                    finally\n                    {\n                        if (testControlValidator instanceof TestAware)\n                        {\n                            ((TestAware) testControlValidator).setTestClass(null);\n                            ((TestAware) testControlValidator).setTestMethod(null);\n                        }\n                    }\n                }\n            }\n\n            for (Class<? extends Annotation> scopeAnnotation : scopeClasses)\n            {\n                if (this.parent != null && this.parent.isScopeStarted(scopeAnnotation))\n                {\n                    continue;\n                }\n\n                if (isRestrictedScope(scopeAnnotation, restrictedScopes))\n                {\n                    continue;\n                }\n\n                try\n                {\n                    contextControl.stopContext(scopeAnnotation);\n\n                    contextControl.startContext(scopeAnnotation);\n                    this.startedScopes.add(scopeAnnotation);\n\n                    onScopeStarted(scopeAnnotation);\n                }\n                catch (RuntimeException e)\n                {\n                    Logger logger = Logger.getLogger(CdiTestExtension.class.getName());\n                    logger.setLevel(Level.SEVERE);\n                    logger.log(Level.SEVERE, \"failed to start scope @\" + scopeAnnotation.getName(), e);\n                }\n            }\n        }\n\n        private void addScopesForDefaultBehavior(List<Class<? extends Annotation>> scopeClasses)\n        {\n            if (this.parent != null && !this.parent.isScopeStarted(RequestScoped.class))\n            {\n                if (!scopeClasses.contains(RequestScoped.class))\n                {\n                    scopeClasses.add(RequestScoped.class);\n                }\n            }\n            if (this.parent != null && !this.parent.isScopeStarted(SessionScoped.class))\n            {\n                if (!scopeClasses.contains(SessionScoped.class))\n                {\n                    scopeClasses.add(SessionScoped.class);\n                }\n            }\n        }\n\n        private boolean isRestrictedScope(Class<? extends Annotation> scopeAnnotation,\n                                          Class<? extends Annotation>[] restrictedScopes)\n        {\n            for (Class<? extends Annotation> restrictedScope : restrictedScopes)\n            {\n                if (scopeAnnotation.equals(restrictedScope))\n                {\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        private boolean isScopeStarted(Class<? extends Annotation> scopeAnnotation)\n        {\n            return this.startedScopes.contains(scopeAnnotation);\n        }\n\n        private void stopStartedScopes(CdiContainer container)\n        {\n            while (!this.startedScopes.empty())\n            {\n                Class<? extends Annotation> scopeAnnotation = this.startedScopes.pop();\n                try\n                {\n                    container.getContextControl().stopContext(scopeAnnotation);\n                    onScopeStopped(scopeAnnotation);\n                }\n                catch (RuntimeException e)\n                {\n                    Logger logger = Logger.getLogger(CdiTestExtension.class.getName());\n                    logger.setLevel(Level.SEVERE);\n                    logger.log(Level.SEVERE, \"failed to stop scope @\" + scopeAnnotation.getName(), e);\n                }\n            }\n        }\n\n        private void onScopeStarted(Class<? extends Annotation> scopeClass)\n        {\n            List<ExternalContainer> externalContainerList = collectExternalContainers(this);\n\n            for (ExternalContainer externalContainer : externalContainerList)\n            {\n                externalContainer.startScope(scopeClass);\n            }\n        }\n\n        private void onScopeStopped(Class<? extends Annotation> scopeClass)\n        {\n            List<ExternalContainer> externalContainerList = collectExternalContainers(this);\n\n            for (ExternalContainer externalContainer : externalContainerList)\n            {\n                externalContainer.stopScope(scopeClass);\n            }\n        }\n\n        private List<ExternalContainer> collectExternalContainers(ContainerAwareTestContext testContext)\n        {\n            List<ExternalContainer> result = new ArrayList<ExternalContainer>();\n\n            if (testContext.externalContainers != null)\n            {\n                result.addAll(testContext.externalContainers);\n            }\n\n            if (testContext.parent != null)\n            {\n                result.addAll(collectExternalContainers(testContext.parent));\n            }\n            return result;\n        }\n\n        private void setCurrentTestMethod(Method testMethod)\n        {\n            List<ExternalContainer> externalContainerList = collectExternalContainers(this);\n\n            for (ExternalContainer externalContainer : externalContainerList)\n            {\n                if (externalContainer instanceof TestAware)\n                {\n                    try\n                    {\n                        ((TestAware) externalContainer).setTestMethod(testMethod);\n                    }\n                    catch (Throwable t)\n                    {\n                        throw new RuntimeException(t.getMessage());\n                    }\n                }\n            }\n        }\n    }\n\n    public static Boolean isAutomaticScopeHandlingActive()\n    {\n        throw new UnsupportedOperationException(\"Not supported yet.\");\n        //X TODO return automaticScopeHandlingActive.get();\n    }\n\n    public static List<ExternalContainer> getActiveExternalContainers()\n    {\n        throw new UnsupportedOperationException(\"Not supported yet.\");\n/*X TODO\n        CdiTestExtension cdiTestExtension = currentTestExtension.get();\n\n        if (cdiTestExtension == null ||\n                cdiTestExtension.externalContainers == null)\n        {\n            return Collections.emptyList();\n        }\n\n        return Collections.unmodifiableList(cdiTestExtension.externalContainers);\n*/\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/junit/CdiTestSuiteExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.junit;\n\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.PropertyLoader;\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.junit.jupiter.api.extension.AfterAllCallback;\nimport org.junit.jupiter.api.extension.BeforeAllCallback;\nimport org.junit.jupiter.api.extension.ExtensionContext;\n\nimport jakarta.inject.Named;\n\nimport java.util.Arrays;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.concurrent.ConcurrentHashMap;\n\n//X TODO this is work in progress and not fully functional right now.\npublic class CdiTestSuiteExtension extends CdiTestExtension implements BeforeAllCallback, AfterAllCallback\n{\n    public static final String CUSTOM_TEST_CONTAINER_CONFIG_FILE_KEY =\n            \"deltaspike.testcontrol.test-container.config-file\";\n\n    public static final String DEFAULT_TEST_CONTAINER_CONFIG_FILE_NAME =\n            \"META-INF/apache-deltaspike_test-container\";\n\n    private static final boolean STOP_CONTAINER;\n\n    private static final ThreadLocal<Boolean> IS_CDI_TEST_RUNNER_EXECUTION = new ThreadLocal<>();\n\n    private static volatile boolean containerStarted;\n\n    private Class<?> testSuiteClass;\n\n    static\n    {\n        STOP_CONTAINER = TestBaseConfig.ContainerIntegration.STOP_CONTAINER;\n    }\n\n\n\n    @Override\n    public void beforeAll(ExtensionContext extensionContext) throws Exception\n    {\n        this.testSuiteClass = extensionContext.getTestClass()\n                .orElseThrow(() -> new IllegalStateException(\"no test-suite class found\"));\n\n        CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n        if (!containerStarted)\n        {\n            applyTestSpecificMetaData(testSuiteClass);\n\n            container.boot(getTestContainerConfig());\n            containerStarted = true;\n        }\n    }\n\n    @Override\n    public void afterAll(ExtensionContext extensionContext) throws Exception\n    {\n        // Cleanup if needed\n        if (STOP_CONTAINER)\n        {\n            CdiContainer container = CdiContainerLoader.getCdiContainer();\n\n            container.shutdown();\n            containerStarted = false;\n        }\n    }\n\n    public static boolean isContainerStarted()\n    {\n        return containerStarted;\n    }\n\n    static Boolean isStopContainerAllowed()\n    {\n        return STOP_CONTAINER;\n    }\n\n    static ThreadLocal<Boolean> getCdiTestRunnerExecutionRef()\n    {\n        return IS_CDI_TEST_RUNNER_EXECUTION;\n    }\n\n    static void setContainerStarted(boolean containerStarted)\n    {\n        CdiTestSuiteExtension.containerStarted = containerStarted;\n    }\n\n    public static Properties getTestContainerConfig()\n    {\n        String cdiTestRunnerConfig = ConfigResolver.getProjectStageAwarePropertyValue(\n                CUSTOM_TEST_CONTAINER_CONFIG_FILE_KEY, DEFAULT_TEST_CONTAINER_CONFIG_FILE_NAME);\n        return PropertyLoader.getProperties(cdiTestRunnerConfig);\n    }\n\n    static void applyTestSpecificMetaData(Class<?> currentAnnotationSource)\n    {\n        TestControl testControl = currentAnnotationSource.getAnnotation(TestControl.class);\n        String activeAlternativeLabel = checkForLabeledAlternativeConfig(testControl);\n\n        initTestEnvConfig(currentAnnotationSource, activeAlternativeLabel, testControl);\n    }\n\n    private static String checkForLabeledAlternativeConfig(TestControl testControl)\n    {\n        String activeAlternativeLabel = \"\";\n\n        if (testControl != null)\n        {\n            Class<? extends TestControl.Label> activeTypedAlternativeLabel =\n                    testControl.activeAlternativeLabel();\n\n            if (!TestControl.Label.class.equals(activeTypedAlternativeLabel))\n            {\n                Named labelName = activeTypedAlternativeLabel.getAnnotation(Named.class);\n\n                if (labelName != null)\n                {\n                    activeAlternativeLabel = labelName.value();\n                }\n                else\n                {\n                    String labelClassName = activeTypedAlternativeLabel.getSimpleName();\n                    activeAlternativeLabel = labelClassName.substring(0, 1).toLowerCase();\n\n                    if (labelClassName.length() > 1)\n                    {\n                        activeAlternativeLabel += labelClassName.substring(1);\n                    }\n                }\n            }\n        }\n        return activeAlternativeLabel;\n    }\n\n    private static void initTestEnvConfig(Class<?> testClass, String activeAlternativeLabel, TestControl testControl)\n    {\n        if (ClassDeactivationUtils.isActivated(TestConfigSource.class))\n        {\n            TestConfigSource testConfigSource = null;\n\n            for (ConfigSource configSource : ConfigResolver.getConfigSources())\n            {\n                if (configSource instanceof TestConfigSource)\n                {\n                    testConfigSource = (TestConfigSource) configSource;\n                }\n            }\n\n            if (testConfigSource == null)\n            {\n                testConfigSource = new TestConfigSource();\n                ConfigResolver.addConfigSources(Arrays.<ConfigSource>asList(testConfigSource));\n            }\n\n            testConfigSource.getProperties().put(\"activeAlternativeLabel\", activeAlternativeLabel);\n\n            testConfigSource.getProperties().put(\"activeAlternativeLabelSource\", testClass.getName());\n\n            if (testControl != null)\n            {\n                testConfigSource.getProperties().put(TestControl.class.getName(), testClass.getName());\n                testConfigSource.getProperties().put(ClassFilter.class.getName(), testControl.classFilter().getName());\n            }\n            else\n            {\n                testConfigSource.getProperties().put(TestControl.class.getName(), TestControl.class.getName());\n                testConfigSource.getProperties().put(ClassFilter.class.getName(), ClassFilter.class.getName());\n            }\n        }\n        else\n        {\n            System.setProperty(\"activeAlternativeLabel\", activeAlternativeLabel);\n\n            System.setProperty(\"activeAlternativeLabelSource\", testClass.getName());\n\n            if (testControl != null)\n            {\n                System.setProperty(TestControl.class.getName(), testClass.getName());\n                System.setProperty(ClassFilter.class.getName(), testControl.classFilter().getName());\n            }\n            else\n            {\n                System.setProperty(TestControl.class.getName(), TestControl.class.getName());\n                System.setProperty(ClassFilter.class.getName(), ClassFilter.class.getName());\n            }\n        }\n    }\n\n    public static class TestConfigSource implements ConfigSource, Deactivatable\n    {\n        private Map<String, String> testConfig = new ConcurrentHashMap<String, String>();\n\n        @Override\n        public int getOrdinal()\n        {\n            return Integer.MIN_VALUE;\n        }\n\n        @Override\n        public Map<String, String> getProperties()\n        {\n            return testConfig;\n        }\n\n        @Override\n        public String getPropertyValue(String key)\n        {\n            return testConfig.get(key);\n        }\n\n        @Override\n        public String getConfigName()\n        {\n            return \"ds-test5-config\";\n        }\n\n        @Override\n        public boolean isScannable()\n        {\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/junit/TestBaseConfig.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.junit;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.api.config.base.DeltaSpikeBaseConfig;\n\npublic interface TestBaseConfig extends DeltaSpikeBaseConfig\n{\n    interface ContainerIntegration\n    {\n        //default is false to improve the compatibility with @Before and @After\n        Boolean USE_TEST_CLASS_AS_CDI_BEAN = ConfigResolver.resolve(\"deltaspike.testcontrol5.use_test_class_as_cdi_bean\")\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        Boolean STOP_CONTAINER = ConfigResolver.resolve(\"deltaspike.testcontrol5.stop_container\")\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.TRUE)\n                .getValue();\n    }\n\n    interface MockIntegration\n    {\n        String ALLOW_MOCKED_BEANS_KEY = \"deltaspike.testcontrol5.mock-support.allow_mocked_beans\";\n        String ALLOW_MOCKED_PRODUCERS_KEY = \"deltaspike.testcontrol5.mock-support.allow_mocked_producers\";\n        String ALLOW_MANUAL_INJECTION_POINT_MANIPULATION_KEY =\n            \"deltaspike.testcontrol5.mock-support.allow_manual_injection-point_manipulation\";\n\n        Boolean ALLOW_MOCKED_BEANS = ConfigResolver.resolve(ALLOW_MOCKED_BEANS_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        Boolean ALLOW_MOCKED_PRODUCERS = ConfigResolver.resolve(ALLOW_MOCKED_PRODUCERS_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n\n        //if enabled it's possible to change the value of injection-points after the injection-process and\n        //before test-execution. that allows to replace injection-points (e.g. with a mock) conditionally\n        //via a test-rule or @Before\n        Boolean ALLOW_MANUAL_INJECTION_POINT_MANIPULATION =\n            ConfigResolver.resolve(ALLOW_MANUAL_INJECTION_POINT_MANIPULATION_KEY)\n                .as(Boolean.class)\n                .withCurrentProjectStage(true)\n                .withDefault(Boolean.FALSE)\n                .getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/junit/TestConfigSource.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.junit;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.spi.config.ConfigSource;\n\n//config-sources are already stored per classloader\n//keep it public to allow type-safe deactivation (if needed)\npublic class TestConfigSource implements ConfigSource, Deactivatable\n{\n    private Map<String, String> testConfig = new ConcurrentHashMap<String, String>();\n\n    @Override\n    public int getOrdinal()\n    {\n        return Integer.MIN_VALUE;\n    }\n\n    @Override\n    public Map<String, String> getProperties()\n    {\n        return testConfig;\n    }\n\n    @Override\n    public String getPropertyValue(String key)\n    {\n        return testConfig.get(key);\n    }\n\n    @Override\n    public String getConfigName()\n    {\n        return \"ds-test-config\";\n    }\n\n    @Override\n    public boolean isScannable()\n    {\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/literal/TestControlLiteral.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.literal;\n\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\n\nimport jakarta.enterprise.util.AnnotationLiteral;\nimport java.lang.annotation.Annotation;\nimport java.util.logging.Handler;\n\npublic class TestControlLiteral extends AnnotationLiteral<TestControl> implements TestControl\n{\n    private static final long serialVersionUID = 6684011035751678259L;\n\n    private final TestControl defaultInstance;\n\n    public TestControlLiteral()\n    {\n        this.defaultInstance = AnnotationInstanceProvider.of(TestControl.class);\n    }\n\n    @Override\n    public Class<? extends Annotation>[] startScopes()\n    {\n        return defaultInstance.startScopes();\n    }\n\n    @Override\n    public Class<? extends ProjectStage> projectStage()\n    {\n        return defaultInstance.projectStage();\n    }\n\n    @Override\n    public Class<? extends Handler> logHandler()\n    {\n        return defaultInstance.logHandler();\n    }\n\n    @Override\n    public boolean startExternalContainers()\n    {\n        return defaultInstance.startExternalContainers();\n    }\n\n    @Override\n    public Class<? extends Label> activeAlternativeLabel()\n    {\n        return defaultInstance.activeAlternativeLabel();\n    }\n\n    @Override\n    public Class<? extends ClassFilter> classFilter()\n    {\n        return defaultInstance.classFilter();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/mock/ApplicationMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.mock;\n\nimport java.lang.annotation.Annotation;\n\npublic interface ApplicationMockManager\n{\n    void addMock(Object mockInstance, Annotation... qualifiers);\n\n    <T> T getMock(Class<T> beanClass, Annotation... qualifiers);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/mock/DynamicMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.mock;\n\npublic interface DynamicMockManager extends ApplicationMockManager\n{\n    void reset();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/api/mock/TypedMock.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.api.mock;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Target({ FIELD, METHOD, TYPE })\n@Retention(RUNTIME)\npublic @interface TypedMock\n{\n    Class<?>[] value() default { };\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/spi/ExternalContainer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.spi;\n\nimport java.lang.annotation.Annotation;\n\npublic interface ExternalContainer\n{\n    void boot();\n\n    void shutdown();\n\n    int getOrdinal();\n\n    void startScope(Class<? extends Annotation> scopeClass);\n\n    void stopScope(Class<? extends Annotation> scopeClass);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/spi/TestAware.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.spi;\n\nimport java.lang.reflect.Method;\n\npublic interface TestAware\n{\n    void setTestClass(Class testClass);\n\n    void setTestMethod(Method testMethod);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/spi/TestControlValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.spi;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\n\npublic interface TestControlValidator extends Deactivatable\n{\n    void validate(TestControl testControl);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/spi/junit/TestStatementDecoratorFactory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.spi.junit;\n\nimport org.junit.jupiter.api.extension.ExtensionContext;\n\npublic interface TestStatementDecoratorFactory\n{\n    ExtensionContext createContext(ExtensionContext extensionContext);\n\n    int getOrdinal();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/api/src/main/java/org/apache/deltaspike/testcontrol5/spi/mock/MockFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.spi.mock;\n\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\n\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.BeanManager;\n\npublic interface MockFilter extends Deactivatable\n{\n    boolean isMockedImplementationSupported(BeanManager beanManager, Annotated annotated);\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>test-control5-module-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-test-control5-module-impl</artifactId>\n    <packaging>jar</packaging>\n\n    <name>Apache DeltaSpike Test-Control5-Module Impl (JUnit 5)</name>\n\n    <properties>\n        <deltaspike.osgi.export.pkg>\n            org.apache.deltaspike.testcontrol5.impl.*\n        </deltaspike.osgi.export.pkg>\n        <deltaspike.osgi.import>\n            !org.apache.deltaspike.testcontrol5.impl.*,\n            *\n        </deltaspike.osgi.import>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>org.junit</groupId>\n                <artifactId>junit-bom</artifactId>\n                <version>${junit5.version}</version>\n                <type>pom</type>\n                <scope>import</scope>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.modules</groupId>\n            <artifactId>deltaspike-test-control5-module-api</artifactId>\n            <version>${project.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.cdictrl</groupId>\n            <artifactId>deltaspike-cdictrl-api</artifactId>\n            <version>${project.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.geronimo.specs</groupId>\n            <artifactId>geronimo-jpa_2.2_spec</artifactId>\n            <optional>true</optional>\n        </dependency>\n\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter-api</artifactId>\n            <scope>compile</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.junit.jupiter</groupId>\n            <artifactId>junit-jupiter</artifactId>\n            <scope>test</scope>\n        </dependency>\n\n        <!-- Force launcher version to match surefire's bundled platform version -->\n        <dependency>\n            <groupId>org.junit.platform</groupId>\n            <artifactId>junit-platform-launcher</artifactId>\n            <scope>test</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.el</groupId>\n            <artifactId>jakarta.el-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.tomcat</groupId>\n            <artifactId>tomcat-servlet-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.mockito</groupId>\n            <artifactId>mockito-core</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.deltaspike.core</groupId>\n            <artifactId>deltaspike-core-impl</artifactId>\n            <version>${project.version}</version>\n            <scope>runtime</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.junit.platform</groupId>\n            <artifactId>junit-platform-suite-engine</artifactId>\n            <scope>test</scope>\n        </dependency>\n\n    </dependencies>\n\n\n    <profiles>\n        <profile>\n            <id>OWB</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <scope>test</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-owb</artifactId>\n                    <version>${project.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <dependencies>\n                            <dependency>\n                                <groupId>org.apache.maven.surefire</groupId>\n                                <artifactId>surefire-junit-platform</artifactId>\n                                <version>${maven.surefire.plugin.version}</version>\n                            </dependency>\n                        </dependencies>\n                    </plugin>\n                </plugins>\n            </build>\n\n        </profile>\n\n        <profile>\n            <id>Weld</id>\n            <dependencies>\n                <!-- Adding a test dependency needed for Weld -->\n                <dependency>\n                    <groupId>org.apache.deltaspike.cdictrl</groupId>\n                    <artifactId>deltaspike-cdictrl-weld</artifactId>\n                    <version>${project.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n                <!-- The remaining bits of this profile are located under deltaspike/parent/code/pom.xml -->\n            </dependencies>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <dependencies>\n                            <dependency>\n                                <groupId>org.apache.maven.surefire</groupId>\n                                <artifactId>surefire-junit-platform</artifactId>\n                                <version>${maven.surefire.plugin.version}</version>\n                            </dependency>\n                        </dependencies>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <id>tomee-build-managed</id>\n            <!--\n                just to switch off the surefire-plugin changes.\n                We don't run those tests with the EE containers\n            -->\n        </profile>\n        <profile>\n            <id>wildfly-build-managed</id>\n            <!--\n                just to switch off the surefire-plugin changes.\n                We don't run those tests with the EE containers\n            -->\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/AbstractMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol5.api.junit.TestBaseConfig;\nimport org.apache.deltaspike.testcontrol5.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol5.api.mock.TypedMock;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic abstract class AbstractMockManager implements DynamicMockManager\n{\n    private Map<BeanCacheKey, Object> registeredMocks = new HashMap<BeanCacheKey, Object>();\n\n    @Override\n    public void addMock(Object mockInstance, Annotation... qualifiers)\n    {\n        if (!TestBaseConfig.MockIntegration.ALLOW_MOCKED_BEANS &&\n            !TestBaseConfig.MockIntegration.ALLOW_MOCKED_PRODUCERS)\n        {\n            throw new IllegalStateException(\"The support for mocked CDI-Beans is disabled \" +\n                \"due to a reduced portability across different CDI-implementations. \" +\n                \"Please set '\" + TestBaseConfig.MockIntegration.ALLOW_MOCKED_BEANS_KEY + \"' and/or '\" +\n                TestBaseConfig.MockIntegration.ALLOW_MOCKED_PRODUCERS_KEY + \"' to 'true' \" +\n                \"(in 'META-INF/apache-deltaspike.properties') on your test-classpath.\");\n        }\n\n        Class<?> mockClass = mockInstance.getClass();\n        Class<?> beanClass = mockClass.getSuperclass();\n\n        if (beanClass == null)\n        {\n            beanClass = mockClass;\n        }\n        if (Object.class.equals(beanClass))\n        {\n            throw new IllegalArgumentException(mockInstance.getClass().getName() +\n                \" isn't a supported approach for mocking -> please extend from the original class.\");\n        }\n\n        TypedMock typedMock = mockClass.getAnnotation(TypedMock.class);\n\n        if (typedMock == null)\n        {\n            typedMock = beanClass.getAnnotation(TypedMock.class);\n        }\n\n        Class[] specifiedTypes = null;\n\n        if (typedMock != null)\n        {\n            specifiedTypes = typedMock.value();\n        }\n        else\n        {\n            Typed typed = mockClass.getAnnotation(Typed.class);\n\n            if (typed == null || typed.value().length == 0)\n            {\n                typed = beanClass.getAnnotation(Typed.class);\n            }\n\n            if (typed != null && typed.value().length > 0)\n            {\n                specifiedTypes = typed.value();\n            }\n        }\n\n        if (specifiedTypes != null)\n        {\n            for (Class typedClass : specifiedTypes)\n            {\n                this.registeredMocks.put(new BeanCacheKey(typedClass, qualifiers), mockInstance);\n            }\n        }\n        else\n        {\n            this.registeredMocks.put(new BeanCacheKey(beanClass, qualifiers), mockInstance);\n        }\n    }\n\n    @Override\n    public <T> T getMock(Class<T> beanClass, Annotation... qualifiers)\n    {\n        return (T)this.registeredMocks.get(new BeanCacheKey(beanClass, qualifiers));\n    }\n\n    @Override\n    public void reset()\n    {\n        this.registeredMocks.clear();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/BeanCacheKey.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport org.apache.deltaspike.core.util.ReflectionUtils;\n\nimport jakarta.enterprise.util.Nonbinding;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Array;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Type;\nimport java.util.Arrays;\nimport java.util.Comparator;\n\npublic class BeanCacheKey\n{\n    private static final Comparator<Annotation> ANNOTATION_COMPARATOR = new AnnotationComparator();\n\n    private final Type type;\n    private final Annotation qualifier;\n    private final Annotation qualifiers[];\n    private final int hashCode;\n\n    public BeanCacheKey(Type type, Annotation... qualifiers)\n    {\n        this.type = type;\n        final int length = qualifiers != null ? qualifiers.length : 0;\n        if (length == 0)\n        {\n            qualifier = null;\n            this.qualifiers = null;\n        }\n        else if (length == 1)\n        {\n            qualifier = qualifiers[0];\n            this.qualifiers = null;\n        }\n        else\n        {\n            qualifier = null;\n            this.qualifiers = new Annotation[length];\n            System.arraycopy(qualifiers, 0, this.qualifiers, 0, length);\n            Arrays.sort(this.qualifiers, ANNOTATION_COMPARATOR);\n        }\n\n        hashCode = computeHashCode();\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n        {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass())\n        {\n            return false;\n        }\n\n        BeanCacheKey cacheKey = (BeanCacheKey) o;\n\n        if (!type.equals(cacheKey.type))\n        {\n            return false;\n        }\n        if (qualifier != null ? !qualifierEquals(qualifier, cacheKey.qualifier) : cacheKey.qualifier != null)\n        {\n            return false;\n        }\n        if (!qualifierArrayEquals(qualifiers, cacheKey.qualifiers))\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    private boolean qualifierArrayEquals(Annotation[] qualifiers1, Annotation[] qualifiers2)\n    {\n        if (qualifiers1 == qualifiers2)\n        {\n            return true;\n        }\n        else if (qualifiers1 == null || qualifiers2 == null)\n        {\n            return false;\n        }\n        if (qualifiers1.length != qualifiers2.length)\n        {\n            return false;\n        }\n        for (int i = 0; i < qualifiers1.length; i++)\n        {\n            Annotation a1 = qualifiers1[i];\n            Annotation a2 = qualifiers2[i];\n            if (a1 == null ? a2 != null : !qualifierEquals(a1, a2))\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode()\n    {\n        return hashCode;\n    }\n\n    private int computeHashCode()\n    {\n        int computedHashCode = 31 * ReflectionUtils.calculateHashCodeOfType(type);\n        if (qualifier != null)\n        {\n            computedHashCode = 31 * computedHashCode + getQualifierHashCode(qualifier);\n        }\n        if (qualifiers != null)\n        {\n            for (int i = 0; i < qualifiers.length; i++)\n            {\n                computedHashCode = 31 * computedHashCode + getQualifierHashCode(qualifiers[i]);\n            }\n        }\n        return computedHashCode;\n    }\n\n    private int getQualifierHashCode(Annotation a)\n    {\n        return ReflectionUtils.calculateHashCodeOfAnnotation(a, true);\n    }\n\n    private boolean qualifierEquals(Annotation qualifier1, Annotation qualifier2)\n    {\n        return ANNOTATION_COMPARATOR.compare(qualifier1, qualifier2) == 0;\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"BeanCacheKey{\" + \"type=\" + type + \", qualifiers=\"\n                + (qualifiers == null ? qualifier : Arrays.asList(qualifiers)) + \", hashCode=\" + hashCode + '}';\n    }\n\n    private static class AnnotationComparator implements Comparator<Annotation>\n    {\n        @Override\n        public int compare(Annotation annotation1, Annotation annotation2)\n        {\n            final Class<? extends Annotation> type1 = annotation1.annotationType();\n            final Class<? extends Annotation> type2 = annotation2.annotationType();\n            final int temp = type1.getName().compareTo(type2.getName());\n            if (temp != 0)\n            {\n                return temp;\n            }\n            final Method[] member1 = type1.getDeclaredMethods();\n            final Method[] member2 = type2.getDeclaredMethods();\n\n            int i = 0;\n            int j = 0;\n            final int length1 = member1.length;\n            final int length2 = member2.length;\n\n            for (;; i++, j++)\n            {\n                while (i < length1 && member1[i].isAnnotationPresent(Nonbinding.class))\n                {\n                    i++;\n                }\n                while (j < length2 && member2[j].isAnnotationPresent(Nonbinding.class))\n                {\n                    j++;\n                }\n                if (i >= length1 && j >= length2)\n                {\n                    return 0;\n                }\n                else if (i >= length1)\n                {\n                    return 1;\n                }\n                else if (j >= length2)\n                {\n                    return -1;\n                }\n                else\n                {\n                    int c = member1[i].getName().compareTo(member2[j].getName());\n                    if (c != 0)\n                    {\n                        return c;\n                    }\n                    final Object value1 = ReflectionUtils.invokeMethod(annotation1, member1[i], Object.class, true);\n                    final Object value2 = ReflectionUtils.invokeMethod(annotation2, member2[j], Object.class, true);\n                    assert value1.getClass().equals(value2.getClass());\n\n                    if (value1 instanceof Comparable)\n                    {\n                        c = ((Comparable)value1).compareTo(value2);\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n                    }\n                    else if (value1.getClass().isArray())\n                    {\n                        c = value1.getClass().getComponentType().getName()\n                                .compareTo(value2.getClass().getComponentType().getName());\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n\n                        final int length = Array.getLength(value1);\n                        c = length - Array.getLength(value2);\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n                        for (int k = 0; k < length; k++)\n                        {\n                            c = ((Comparable)Array.get(value1, k)).compareTo(Array.get(value2, k));\n                            if (c != 0)\n                            {\n                                return c;\n                            }\n                        }\n\n                    }\n                    else if (value1 instanceof Class)\n                    {\n\n                        c = ((Class)value1).getName().compareTo(((Class) value2).getName());\n                        if (c != 0)\n                        {\n                            return c;\n                        }\n                    }\n                    else\n                    {\n                        assert false;\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/DefaultMockFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport org.apache.deltaspike.testcontrol5.api.junit.TestBaseConfig;\nimport org.apache.deltaspike.testcontrol5.spi.mock.MockFilter;\n\nimport jakarta.enterprise.inject.Produces;\nimport jakarta.enterprise.inject.spi.Annotated;\nimport jakarta.enterprise.inject.spi.AnnotatedField;\nimport jakarta.enterprise.inject.spi.AnnotatedMember;\nimport jakarta.enterprise.inject.spi.AnnotatedMethod;\nimport jakarta.enterprise.inject.spi.AnnotatedType;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Member;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\npublic class DefaultMockFilter implements MockFilter\n{\n    private static final Logger LOG = Logger.getLogger(DefaultMockFilter.class.getName());\n\n    private static final String DS_BASE_PACKAGE = \"org.apache.deltaspike.\";\n    private static final String JAVA_BASE_PACKAGE = \"java.\";\n    private static final String JAVAX_BASE_PACKAGE = \"javax.\";\n    private static final String JAKARTA_BASE_PACKAGE = \"jakarta.\";\n    private static final String EJB_BASE_PACKAGE = \"javax.ejb.\";\n    private static final String OWB_BASE_PACKAGE = \"org.apache.webbeans.\";\n    private static final String WELD_BASE_PACKAGE = \"org.jboss.weld.\";\n\n    @Override\n    public boolean isMockedImplementationSupported(BeanManager beanManager, Annotated annotated)\n    {\n        if (!isMockSupportEnabled(annotated))\n        {\n            return false;\n        }\n\n        Class origin = null;\n        if (annotated instanceof AnnotatedType)\n        {\n            origin = ((AnnotatedType)annotated).getJavaClass();\n            Set<Annotation> annotations = new HashSet<Annotation>();\n            annotations.addAll(annotated.getAnnotations());\n\n            for (AnnotatedMethod annotatedMethod :\n                (Set<jakarta.enterprise.inject.spi.AnnotatedMethod>)((AnnotatedType) annotated).getMethods())\n            {\n                annotations.addAll(annotatedMethod.getAnnotations());\n            }\n\n            if (isEjbOrAnnotatedTypeWithInterceptorAnnotation(\n                beanManager, annotations, origin.getName()))\n            {\n                return false;\n            }\n        }\n        else if (annotated instanceof AnnotatedMember)\n        {\n            Member member = ((AnnotatedMember)annotated).getJavaMember();\n            origin = member.getDeclaringClass();\n            if (isEjbOrAnnotatedTypeWithInterceptorAnnotation(\n                beanManager, annotated.getAnnotations(), member.toString()))\n            {\n                return false;\n            }\n        }\n\n        if (origin != null && origin.getPackage() == null)\n        {\n            LOG.warning(\"Please don't use the default-package for \" + origin.getName());\n            return true;\n        }\n\n        return origin != null && !isInternalPackage(origin.getPackage().getName());\n    }\n\n    protected boolean isMockSupportEnabled(Annotated annotated)\n    {\n        if ((annotated instanceof AnnotatedMethod || annotated instanceof AnnotatedField) &&\n                annotated.getAnnotation(Produces.class) != null)\n        {\n            return TestBaseConfig.MockIntegration.ALLOW_MOCKED_PRODUCERS;\n        }\n        else\n        {\n            return TestBaseConfig.MockIntegration.ALLOW_MOCKED_BEANS;\n        }\n    }\n\n    protected boolean isEjbOrAnnotatedTypeWithInterceptorAnnotation(BeanManager beanManager,\n                                                                      Set<Annotation> annotations,\n                                                                      String origin)\n    {\n        for (Annotation annotation : annotations)\n        {\n            if (annotation.annotationType().getName().startsWith(EJB_BASE_PACKAGE))\n            {\n                return true;\n            }\n\n            if (isStandardAnnotation(annotation))\n            {\n                continue;\n            }\n\n            if (beanManager.isInterceptorBinding(annotation.annotationType()) ||\n                (beanManager.isStereotype(annotation.annotationType()) &&\n                    isStereotypeWithInterceptor(annotation, beanManager)))\n            {\n                LOG.warning(\"Skip mocking intercepted bean \" + origin);\n\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected boolean isStereotypeWithInterceptor(Annotation stereotypeAnnotation, BeanManager beanManager)\n    {\n        for (Annotation annotation : stereotypeAnnotation.annotationType().getAnnotations())\n        {\n            if (isStandardAnnotation(annotation))\n            {\n                continue;\n            }\n\n            if (beanManager.isInterceptorBinding(annotation.annotationType()) ||\n                isStereotypeWithInterceptor(annotation, beanManager))\n            {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected boolean isStandardAnnotation(Annotation annotation)\n    {\n        return annotation.annotationType().getName().startsWith(JAVA_BASE_PACKAGE) ||\n            annotation.annotationType().getName().startsWith(JAVAX_BASE_PACKAGE) ||\n            annotation.annotationType().getName().startsWith(JAKARTA_BASE_PACKAGE);\n    }\n\n    protected boolean isInternalPackage(String packageName)\n    {\n        return packageName.startsWith(OWB_BASE_PACKAGE) || packageName.startsWith(WELD_BASE_PACKAGE) ||\n            isDeltaSpikePackage(packageName);\n    }\n\n    protected boolean isDeltaSpikePackage(String packageName)\n    {\n        return packageName.startsWith(DS_BASE_PACKAGE);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/MockAwareInjectionTargetWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.testcontrol5.api.mock.DynamicMockManager;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.List;\nimport java.util.Set;\n\npublic class MockAwareInjectionTargetWrapper<T> implements InjectionTarget<T>\n{\n    private BeanManager beanManager;\n    private final InjectionTarget<T> wrapped;\n    private final List<Type> beanTypes;\n    private final List<Annotation> qualifiers;\n\n    public MockAwareInjectionTargetWrapper(BeanManager beanManager,\n                                           InjectionTarget<T> wrapped,\n                                           List<Type> beanTypes,\n                                           List<Annotation> qualifiers)\n    {\n        this.beanManager = beanManager;\n        this.wrapped = wrapped;\n        this.beanTypes = beanTypes;\n        this.qualifiers = qualifiers;\n    }\n\n    @Override\n    public T produce(CreationalContext<T> creationalContext)\n    {\n        DynamicMockManager mockManager =\n            BeanProvider.getContextualReference(this.beanManager, DynamicMockManager.class, false);\n\n        for (Type beanType : this.beanTypes)\n        {\n            Object mockInstance = mockManager.getMock(\n                    (Class)beanType, this.qualifiers.toArray(new Annotation[this.qualifiers.size()]));\n\n            if (mockInstance != null)\n            {\n                return (T)mockInstance;\n            }\n        }\n        return wrapped.produce(creationalContext);\n    }\n\n    @Override\n    public void inject(T instance, CreationalContext<T> ctx)\n    {\n        wrapped.inject(instance, ctx);\n    }\n\n    @Override\n    public void postConstruct(T instance)\n    {\n        wrapped.postConstruct(instance);\n    }\n\n    @Override\n    public void preDestroy(T instance)\n    {\n        wrapped.preDestroy(instance);\n    }\n\n    @Override\n    public void dispose(T instance)\n    {\n        wrapped.dispose(instance);\n    }\n\n    @Override\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return wrapped.getInjectionPoints();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/MockAwareProducerWrapper.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.testcontrol5.api.mock.DynamicMockManager;\n\nimport jakarta.enterprise.context.spi.CreationalContext;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.InjectionPoint;\nimport jakarta.enterprise.inject.spi.Producer;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.List;\nimport java.util.Set;\n\npublic class MockAwareProducerWrapper<T> implements Producer<T>\n{\n    private final BeanManager beanManager;\n    private final Producer<T> wrapped;\n    private final List<Type> beanTypes;\n    private final List<Annotation> qualifiers;\n\n    public MockAwareProducerWrapper(BeanManager beanManager,\n                                    Producer<T> wrapped,\n                                    List<Type> beanTypes,\n                                    List<Annotation> qualifiers)\n    {\n        this.beanManager = beanManager;\n        this.wrapped = wrapped;\n        this.beanTypes = beanTypes;\n        this.qualifiers = qualifiers;\n    }\n\n    @Override\n    public T produce(CreationalContext<T> creationalContext)\n    {\n        DynamicMockManager mockManager =\n            BeanProvider.getContextualReference(this.beanManager, DynamicMockManager.class, false);\n\n        for (Type beanType : this.beanTypes)\n        {\n            Object mockInstance = mockManager.getMock(\n                (Class)beanType, this.qualifiers.toArray(new Annotation[this.qualifiers.size()]));\n\n            if (mockInstance != null)\n            {\n                return (T)mockInstance;\n            }\n        }\n\n        return wrapped.produce(creationalContext);\n    }\n\n    @Override\n    public void dispose(T instance)\n    {\n        wrapped.dispose(instance);\n    }\n\n    @Override\n    public Set<InjectionPoint> getInjectionPoints()\n    {\n        return wrapped.getInjectionPoints();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/MockExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.core.util.ClassDeactivationUtils;\nimport org.apache.deltaspike.core.util.ServiceUtils;\nimport org.apache.deltaspike.testcontrol5.spi.mock.MockFilter;\n\nimport jakarta.enterprise.event.Observes;\nimport jakarta.enterprise.inject.spi.AnnotatedMember;\nimport jakarta.enterprise.inject.spi.BeanManager;\nimport jakarta.enterprise.inject.spi.BeforeBeanDiscovery;\nimport jakarta.enterprise.inject.spi.Extension;\nimport jakarta.enterprise.inject.spi.InjectionTarget;\nimport jakarta.enterprise.inject.spi.ProcessInjectionTarget;\nimport jakarta.enterprise.inject.spi.ProcessProducer;\nimport jakarta.enterprise.inject.spi.Producer;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class MockExtension implements Extension, Deactivatable\n{\n    private Boolean isActivated = true;\n    private List<MockFilter> mockFilters;\n\n    protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)\n    {\n        isActivated = ClassDeactivationUtils.isActivated(getClass());\n        mockFilters = ServiceUtils.loadServiceImplementations(MockFilter.class);\n    }\n\n    public <X> void onProcessInjectionTarget(@Observes ProcessInjectionTarget<X> processInjectionTarget,\n                                             BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        for (MockFilter mockFilter : mockFilters)\n        {\n            if (!mockFilter.isMockedImplementationSupported(beanManager, processInjectionTarget.getAnnotatedType()))\n            {\n                return;\n            }\n        }\n\n        List<Annotation> qualifiers = new ArrayList<Annotation>();\n        for (Annotation annotation : processInjectionTarget.getAnnotatedType().getAnnotations())\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                qualifiers.add(annotation);\n            }\n        }\n\n        Typed typed = processInjectionTarget.getAnnotatedType().getAnnotation(Typed.class);\n\n        List<Type> foundTypes = new ArrayList<>();\n        if (typed != null)\n        {\n            Collections.addAll(foundTypes, typed.value());\n        }\n        else\n        {\n            foundTypes.addAll(extractTypes(processInjectionTarget.getAnnotatedType().getJavaClass()));\n        }\n\n        if (foundTypes.isEmpty())\n        {\n            return;\n        }\n\n        final InjectionTarget<X> originalInjectionTarget = processInjectionTarget.getInjectionTarget();\n        processInjectionTarget.setInjectionTarget(new MockAwareInjectionTargetWrapper<X>(\n            beanManager, originalInjectionTarget, foundTypes, qualifiers));\n    }\n\n    public <X, T> void onProcessProducer(@Observes ProcessProducer<X, T> processProducer, BeanManager beanManager)\n    {\n        if (!isActivated)\n        {\n            return;\n        }\n\n        for (MockFilter mockFilter : mockFilters)\n        {\n            if (!mockFilter.isMockedImplementationSupported(beanManager, processProducer.getAnnotatedMember()))\n            {\n                return;\n            }\n        }\n\n        final Producer<T> originalProducer = processProducer.getProducer();\n        AnnotatedMember<X> annotatedMember = processProducer.getAnnotatedMember();\n        List<Annotation> qualifiers = new ArrayList<Annotation>();\n        for (Annotation annotation : annotatedMember.getAnnotations())\n        {\n            if (beanManager.isQualifier(annotation.annotationType()))\n            {\n                qualifiers.add(annotation);\n            }\n        }\n\n        Typed typed = annotatedMember.getAnnotation(Typed.class);\n\n        List<Type> foundTypes = new ArrayList<Type>();\n        if (typed != null)\n        {\n            Collections.addAll(foundTypes, typed.value());\n        }\n        else if (annotatedMember.getBaseType() instanceof Class)\n        {\n            foundTypes.addAll(extractTypes((Class)annotatedMember.getBaseType()));\n        }\n\n        if (foundTypes.isEmpty())\n        {\n            return;\n        }\n\n        processProducer.setProducer(new MockAwareProducerWrapper<T>(\n            beanManager, originalProducer, foundTypes, qualifiers));\n    }\n\n    protected List<Type> extractTypes(Class currentClass)\n    {\n        List<Type> result = new ArrayList<Type>();\n        for (Class<?> c = currentClass; c != Object.class && c != null; c = c.getSuperclass())\n        {\n            result.add(c);\n        }\n        Collections.addAll(result, currentClass.getInterfaces());\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/SimpleApplicationMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol5.api.mock.ApplicationMockManager;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\n@Typed(ApplicationMockManager.class)\npublic class SimpleApplicationMockManager extends AbstractMockManager implements ApplicationMockManager\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/mock/SimpleMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.mock;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol5.api.mock.ApplicationMockManager;\nimport org.apache.deltaspike.testcontrol5.api.mock.DynamicMockManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.inject.Inject;\nimport java.lang.annotation.Annotation;\n\n@RequestScoped\n@Typed(DynamicMockManager.class)\npublic class SimpleMockManager extends AbstractMockManager\n{\n    @Inject\n    private ApplicationMockManager applicationMockManager;\n\n    @Override\n    public <T> T getMock(Class<T> beanClass, Annotation... qualifiers)\n    {\n        T result = applicationMockManager.getMock(beanClass, qualifiers);\n\n        if (result != null)\n        {\n            return result;\n        }\n        return super.getMock(beanClass, qualifiers);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/request/ContextControlDecorator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.request;\n\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.apache.deltaspike.testcontrol5.spi.ExternalContainer;\n\nimport jakarta.decorator.Decorator;\nimport jakarta.decorator.Delegate;\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.context.ConversationScoped;\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\nimport jakarta.inject.Singleton;\nimport java.lang.annotation.Annotation;\n\n@Decorator\npublic class ContextControlDecorator implements ContextControl\n{\n    @Inject\n    @Delegate\n    private ContextControl wrapped;\n\n    @Override\n    public void startContexts()\n    {\n        wrapped.startContexts();\n\n        if (isManualScopeHandling())\n        {\n            for (ExternalContainer externalContainer : CdiTestExtension.getActiveExternalContainers())\n            {\n                externalContainer.startScope(Singleton.class);\n                externalContainer.startScope(ApplicationScoped.class);\n                externalContainer.startScope(RequestScoped.class);\n                externalContainer.startScope(SessionScoped.class);\n                externalContainer.startScope(ConversationScoped.class);\n            }\n        }\n    }\n\n    @Override\n    public void stopContexts()\n    {\n        if (isManualScopeHandling())\n        {\n            for (ExternalContainer externalContainer : CdiTestExtension.getActiveExternalContainers())\n            {\n                externalContainer.stopScope(ConversationScoped.class);\n                externalContainer.stopScope(SessionScoped.class);\n                externalContainer.stopScope(RequestScoped.class);\n                externalContainer.stopScope(ApplicationScoped.class);\n                externalContainer.stopScope(Singleton.class);\n            }\n        }\n\n        wrapped.stopContexts();\n    }\n\n    @Override\n    public void startContext(Class<? extends Annotation> scopeClass)\n    {\n        wrapped.startContext(scopeClass);\n\n        if (isManuallyHandledRequest(scopeClass))\n        {\n            for (ExternalContainer externalContainer : CdiTestExtension.getActiveExternalContainers())\n            {\n                externalContainer.startScope(scopeClass);\n            }\n        }\n    }\n\n    @Override\n    public void stopContext(Class<? extends Annotation> scopeClass)\n    {\n        wrapped.stopContext(scopeClass);\n\n        if (isManuallyHandledRequest(scopeClass))\n        {\n            for (ExternalContainer externalContainer : CdiTestExtension.getActiveExternalContainers())\n            {\n                externalContainer.stopScope(scopeClass);\n            }\n        }\n    }\n\n    private boolean isManuallyHandledRequest(Class<? extends Annotation> scopeClass)\n    {\n        return RequestScoped.class.equals(scopeClass) && isManualScopeHandling();\n    }\n\n    private boolean isManualScopeHandling()\n    {\n        return !Boolean.TRUE.equals(CdiTestExtension.isAutomaticScopeHandlingActive());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/java/org/apache/deltaspike/testcontrol5/impl/validation/StandardContextTestControlValidator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.testcontrol5.impl.validation;\n\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.spi.TestAware;\nimport org.apache.deltaspike.testcontrol5.spi.TestControlValidator;\n\nimport jakarta.enterprise.inject.Vetoed;\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n@Vetoed\npublic class StandardContextTestControlValidator implements TestAware, TestControlValidator\n{\n    private static Boolean customContextControlDetected;\n\n    private static ThreadLocal<Class> currentTestClass = new ThreadLocal<Class>();\n    private static ThreadLocal<Method> currentTestMethod = new ThreadLocal<Method>();\n\n    @Override\n    public void validate(TestControl testControl)\n    {\n        checkActiveContextControlImplementation();\n\n        List<Class<? extends Annotation>> scopeClasses = new ArrayList<Class<? extends Annotation>>();\n        Collections.addAll(scopeClasses, testControl.startScopes());\n\n        validateSupportedScopes(scopeClasses, currentTestClass.get(), currentTestMethod.get());\n    }\n\n    private void checkActiveContextControlImplementation()\n    {\n        if (customContextControlDetected != null)\n        {\n            return;\n        }\n\n        customContextControlDetected = !CdiContainerLoader.getCdiContainer().getContextControl()\n            .getClass().getName().startsWith(\"org.apache.deltaspike.\");\n    }\n\n    private void validateSupportedScopes(List<Class<? extends Annotation>> scopeClasses,\n                                         Class<?> declaringClass,\n                                         Method testMethod)\n    {\n        if (Boolean.TRUE.equals(customContextControlDetected))\n        {\n            return;\n        }\n\n        for (Class<? extends Annotation> scopeClass : scopeClasses)\n        {\n            if (!scopeClass.getName().startsWith(\"jakarta.enterprise.context.\"))\n            {\n                throw new IllegalStateException(\"Please remove \" + scopeClass.getName() + \" at \" + declaringClass +\n                        (testMethod != null ? \"#\" + testMethod.getName() : \"\") +\n                        \" from @\" + TestControl.class.getName() + \". @\" + TestControl.class.getName() +\n                        \" only supports standard Scope-Annotations provided by the CDI-Specification. \" +\n                        \"Other Contexts start automatically or need to get started with a specific Management-API. \" +\n                        \"Examples: \" +\n                        \"@TransactionScoped gets started automatically once the @Transactional-Interceptor is used. \" +\n                        \"Whereas @WindowScoped starts once WindowContext#activateWindow gets called.\");\n            }\n        }\n    }\n\n    @Override\n    public void setTestClass(Class testClass)\n    {\n        currentTestClass.set(testClass);\n        if (testClass == null)\n        {\n            currentTestClass.remove();\n        }\n    }\n\n    @Override\n    public void setTestMethod(Method testMethod)\n    {\n        currentTestMethod.set(testMethod);\n        if (testMethod == null)\n        {\n            currentTestMethod.remove();\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/resources/META-INF/apache-deltaspike_test-container.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\n#can be used to configure the underlying test-container\n#(currently the only container supported by deltaspike\n#(out-of-the-box) which supports that config is openejb-embedded)\n\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.testcontrol5.impl.mock.MockExtension"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.TestControlValidator",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.testcontrol5.impl.validation.StandardContextTestControlValidator"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/main/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.mock.MockFilter",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.testcontrol5.impl.mock.DefaultMockFilter"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/CustomMockManager.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5;\n\nimport jakarta.annotation.Priority;\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.testcontrol5.api.mock.DynamicMockManager;\nimport org.apache.deltaspike.testcontrol5.impl.mock.SimpleMockManager;\n\nimport jakarta.enterprise.context.RequestScoped;\nimport jakarta.enterprise.inject.Alternative;\nimport java.lang.annotation.Annotation;\n\n@Alternative\n\n@RequestScoped\n@Typed(DynamicMockManager.class)\n@Priority(1000)\npublic class CustomMockManager extends SimpleMockManager\n{\n    private static boolean isCalled;\n\n    @Override\n    public <T> T getMock(Class<T> beanClass, Annotation... qualifiers)\n    {\n        isCalled = true;\n\n        return super.getMock(beanClass, qualifiers);\n    }\n\n    public static boolean isIsCalled()\n    {\n        return isCalled;\n    }\n\n    public static void resetInternals()\n    {\n        isCalled = false;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/InternalTestClassDeactivator.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5;\n\nimport org.apache.deltaspike.core.spi.activation.ClassDeactivator;\nimport org.apache.deltaspike.core.spi.activation.Deactivatable;\nimport org.apache.deltaspike.testcontrol5.impl.mock.DefaultMockFilter;\n\n//just needed because the internal test-packages need to be handled differently\npublic class InternalTestClassDeactivator implements ClassDeactivator\n{\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        return !DefaultMockFilter.class.equals(targetClass);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/InternalTestMockFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5;\n\nimport org.apache.deltaspike.testcontrol5.impl.mock.DefaultMockFilter;\n\npublic class InternalTestMockFilter extends DefaultMockFilter\n{\n    private static final String DS_TEST_BASE_PACKAGE = \"org.apache.deltaspike.test.testcontrol.mock.\";\n\n    protected boolean isInternalPackage(String packageName)\n    {\n        return super.isInternalPackage(packageName) &&\n                (!packageName.startsWith(DS_TEST_BASE_PACKAGE) ||\n                    packageName.equals(CustomMockManager.class.getPackage().getName()));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/mock/uc015/InterceptedBeanClassLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.mock.uc015;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\n@TestInterceptor\npublic class InterceptedBeanClassLevel\n{\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/mock/uc015/InterceptedBeanMethodLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.mock.uc015;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptedBeanMethodLevel\n{\n    @TestInterceptor\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/mock/uc015/InterceptedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.mock.uc015;\n\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertFalse;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\npublic class InterceptedBeanTest\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @Inject\n    private InterceptedBeanClassLevel interceptedBeanClassLevel;\n\n    @Inject\n    private InterceptedBeanMethodLevel interceptedBeanMethodLevel;\n\n    @Test\n    public void classLevelInterception()\n    {\n        assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanClassLevel.test();\n        assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n\n    @Test\n    public void methodLevelInterception()\n    {\n        assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanMethodLevel.test();\n        assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/mock/uc015/InterceptionResultStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.mock.uc015;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptionResultStorage\n{\n    private boolean intercepted;\n\n    public void markAsIntercepted()\n    {\n        this.intercepted = true;\n    }\n\n    public boolean isInterceptionDetected()\n    {\n        return intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/mock/uc015/TestInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.mock.uc015;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@InterceptorBinding\n\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\npublic @interface TestInterceptor\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/mock/uc015/TestInterceptorImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.mock.uc015;\n\nimport jakarta.annotation.Priority;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@TestInterceptor\n@Interceptor\n@Priority(1000)\npublic class TestInterceptorImplementation implements Serializable\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @AroundInvoke\n    public Object intercept(InvocationContext ctx) throws Exception\n    {\n        this.interceptionResultStorage.markAsIntercepted();\n        return ctx.proceed();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/shared/ApplicationScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.shared;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ApplicationScopedBean\n{\n    private int count = 0;\n    private static int instanceCount = 0;\n\n    @PostConstruct\n    protected void init()\n    {\n        instanceCount++;\n    }\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n\n    public void resetCount()\n    {\n        this.count = 0;\n    }\n\n    public static int getInstanceCount()\n    {\n        return instanceCount;\n    }\n\n    public static void resetInstanceCount()\n    {\n        instanceCount = 0;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/shared/RequestScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.shared;\n\nimport jakarta.annotation.PostConstruct;\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class RequestScopedBean\n{\n    private int count = 0;\n    private static int instanceCount = 0;\n\n    @PostConstruct\n    protected void init()\n    {\n        instanceCount++;\n    }\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n\n    public static int getInstanceCount()\n    {\n        return instanceCount;\n    }\n\n    public static int resetInstanceCount()\n    {\n        return instanceCount = 0;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/shared/SessionScopedBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.shared;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport java.io.Serializable;\n\n@SessionScoped\npublic class SessionScopedBean implements Serializable\n{\n    private static final long serialVersionUID = -6055362670706159152L;\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/shared/TestUtils.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.shared;\n\nimport org.junit.jupiter.api.Test;\n\nimport java.lang.reflect.Method;\n\npublic abstract class TestUtils\n{\n    private TestUtils()\n    {\n    }\n\n    public static int getTestMethodCount(Class testClass)\n    {\n        int result = 0;\n        for (Method method : testClass.getDeclaredMethods())\n        {\n            if (method.isAnnotationPresent(Test.class))\n            {\n                result++;\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc001/RequestAndSessionScopePerTestMethodTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc001;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.SessionScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.TestUtils;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.AfterAll;\nimport org.junit.jupiter.api.BeforeAll;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n\n@ExtendWith(CdiTestExtension.class) //starts container once and one session + request per test-method\n//implicitly annotated with @TestControl without the default-scope settings\npublic class RequestAndSessionScopePerTestMethodTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n\n        assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        assertEquals(1, sessionScopedBean.getCount());\n    }\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n\n        assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        assertEquals(1, sessionScopedBean.getCount());\n    }\n\n    @BeforeAll\n    public static void resetSharedState()\n    {\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n        RequestScopedBean.resetInstanceCount();\n    }\n\n    @AfterAll\n    public static void finalCheckAndCleanup()\n    {\n        int testCount = TestUtils.getTestMethodCount(RequestAndSessionScopePerTestMethodTest.class);\n\n        if (RequestScopedBean.getInstanceCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected instance count\");\n        }\n        RequestScopedBean.resetInstanceCount();\n\n        if (BeanProvider.getContextualReference(ApplicationScopedBean.class).getCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc002/SessionScopePerTestClassTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc002;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.SessionScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.TestUtils;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.AfterAll;\nimport org.junit.jupiter.api.BeforeAll;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class) //starts container and session once and one request per test-method\n@TestControl(startScopes = SessionScoped.class)\npublic class SessionScopePerTestClassTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n    }\n\n    @Test\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n    }\n\n    @BeforeAll\n    public static void resetSharedState()\n    {\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n        RequestScopedBean.resetInstanceCount();\n    }\n\n    @AfterAll\n    public static void finalCheckAndCleanup()\n    {\n        int testCount = TestUtils.getTestMethodCount(SessionScopePerTestClassTest.class);\n\n        if (RequestScopedBean.getInstanceCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected instance count\");\n        }\n        RequestScopedBean.resetInstanceCount();\n\n        if (BeanProvider.getContextualReference(ApplicationScopedBean.class).getCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n\n        if (BeanProvider.getContextualReference(SessionScopedBean.class).getCount() != testCount)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n        BeanProvider.getContextualReference(ApplicationScopedBean.class).resetCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc003/RequestAndSessionScopePerTestMethodTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc003;\n\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestSuiteExtension;\nimport org.junit.jupiter.api.Disabled;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestSuiteExtension.class) //starts container once and one session + request per test-method\n@Disabled //X TODO Disabled for now. We need to define how the test suites in Junit5 work with CDI\n//implicitly annotated with @TestControl without the default-scope settings\npublic class RequestAndSessionScopePerTestMethodTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n\n        assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        assertEquals(1, sessionScopedBean.getCount());\n    }\n\n    @Test\n    //implicitly annotated with @TestControl and its default-values\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n\n        assertEquals(0, sessionScopedBean.getCount());\n        sessionScopedBean.increaseCount();\n        assertEquals(1, sessionScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc003/SessionScopePerTestClassTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc003;\n\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.SessionScopedBean;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestSuiteExtension;\nimport org.junit.jupiter.api.Disabled;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.enterprise.context.SessionScoped;\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestSuiteExtension.class) //starts container and session once and one request per test-method\n@Disabled //X TODO Disabled for now. We need to define how the test suites in Junit5 work with CDI\n@TestControl(startScopes = SessionScoped.class)\npublic class SessionScopePerTestClassTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Test\n    public void firstTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n    }\n\n    @Test\n    public void secondTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc003/TestSuite.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc003;\n\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestSuiteExtension;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.jupiter.api.Disabled;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.extension.ExtendWith;\nimport org.junit.platform.suite.api.SelectClasses;\nimport org.junit.platform.suite.api.Suite;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n/**\n * JUnit 5 replacement for the JUnit 4 Suite.\n * Each test class with @ExtendWith(CdiTestExtension.class) shares the same CDI container.\n */\n@Suite\n@SelectClasses({\n    RequestAndSessionScopePerTestMethodTest.class,\n    SessionScopePerTestClassTest.class\n})\n@ExtendWith(CdiTestSuiteExtension.class) //starts container and session once and one request per test-method\n@Disabled //X TODO Disabled for now. We need to define how the test suites in Junit5 work with CDI\npublic class TestSuite\n{\n    @BeforeClass\n    public static void resetSharedState()\n    {\n        ApplicationScopedBean.resetInstanceCount();\n    }\n\n    @AfterClass\n    public static void finalCheckAndCleanup()\n    {\n        if (ApplicationScopedBean.getInstanceCount() != 1)\n        {\n            throw new IllegalStateException(\"unexpected count\");\n        }\n        ApplicationScopedBean.resetInstanceCount();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc004/ProjectStageTestControlTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc004;\n\nimport jakarta.enterprise.inject.Typed;\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.test.testcontrol5.uc001.RequestAndSessionScopePerTestMethodTest;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\n@TestControl(projectStage = ProjectStage.Development.class) //can be a custom stage\n@Typed() //needed due to RequestAndSessionScopePerTestMethodTest\npublic class ProjectStageTestControlTest extends RequestAndSessionScopePerTestMethodTest //just to inherit the tests - to check that @TestControl#projectStage doesn't influence the default handling\n{\n    @Inject\n    private ProjectStage projectStage;\n\n    @Test\n    public void firstProjectStageTest()\n    {\n        assertEquals(ProjectStage.Development, this.projectStage);\n    }\n\n    @Test\n    @TestControl(projectStage = ProjectStage.UnitTest.class) //can be a custom stage - e.g. for a special test\n    public void secondProjectStageTest()\n    {\n        assertEquals(ProjectStage.UnitTest, this.projectStage);\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc007/BaseTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc007;\n\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.RequestScopedBean;\nimport org.apache.deltaspike.test.testcontrol5.shared.SessionScopedBean;\n\nimport jakarta.inject.Inject;\n\npublic abstract class BaseTest\n{\n    @Inject\n    protected ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    protected SessionScopedBean sessionScopedBean;\n\n    @Inject\n    protected RequestScopedBean requestScopedBean;\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc007/ExtendedTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc007;\n\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\npublic class ExtendedTest extends BaseTest\n{\n    @Test\n    public void inheritedInjectionTest()\n    {\n        applicationScopedBean.increaseCount();\n        sessionScopedBean.increaseCount();\n\n        assertEquals(0, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        assertEquals(1, requestScopedBean.getCount());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc008/BeforeAndAfterInjectionTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc008;\n\nimport org.apache.deltaspike.test.testcontrol5.shared.ApplicationScopedBean;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.AfterEach;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertNotNull;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\npublic class BeforeAndAfterInjectionTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    private Integer foundValue;\n\n    @BeforeEach\n    public void before()\n    {\n        if (this.applicationScopedBean == null)\n        {\n            throw new IllegalStateException(\"injection failed\");\n        }\n\n        this.foundValue = this.applicationScopedBean.getCount();\n    }\n\n    @Test\n    public void injectionTest()\n    {\n        assertNotNull(this.applicationScopedBean);\n        assertNotNull(this.foundValue);\n    }\n\n    @AfterEach\n    public void after()\n    {\n        if (this.applicationScopedBean == null)\n        {\n            throw new IllegalStateException(\"injection failed\");\n        }\n        if (this.foundValue == null)\n        {\n            throw new IllegalStateException(\"different instance without initialized value found\");\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc011/InterceptedBeanClassLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc011;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\n@TestInterceptor\npublic class InterceptedBeanClassLevel\n{\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc011/InterceptedBeanMethodLevel.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc011;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptedBeanMethodLevel\n{\n    @TestInterceptor\n    public void test()\n    {\n        //do nothing - any method is fine\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc011/InterceptedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc011;\n\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertFalse;\nimport static org.junit.jupiter.api.Assertions.assertTrue;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\npublic class InterceptedBeanTest\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @Inject\n    private InterceptedBeanClassLevel interceptedBeanClassLevel;\n\n    @Inject\n    private InterceptedBeanMethodLevel interceptedBeanMethodLevel;\n\n    @Test\n    public void classLevelInterception()\n    {\n        assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanClassLevel.test();\n        assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n\n    @Test\n    public void methodLevelInterception()\n    {\n        assertFalse(this.interceptionResultStorage.isInterceptionDetected());\n        this.interceptedBeanMethodLevel.test();\n        assertTrue(this.interceptionResultStorage.isInterceptionDetected());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc011/InterceptionResultStorage.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc011;\n\nimport jakarta.enterprise.context.RequestScoped;\n\n@RequestScoped\npublic class InterceptionResultStorage\n{\n    private boolean intercepted;\n\n    public void markAsIntercepted()\n    {\n        this.intercepted = true;\n    }\n\n    public boolean isInterceptionDetected()\n    {\n        return intercepted;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc011/TestInterceptor.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc011;\n\nimport jakarta.interceptor.InterceptorBinding;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@InterceptorBinding\n\n@Target({ METHOD, TYPE })\n@Retention(RUNTIME)\npublic @interface TestInterceptor\n{\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc011/TestInterceptorImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc011;\n\nimport jakarta.annotation.Priority;\nimport jakarta.inject.Inject;\nimport jakarta.interceptor.AroundInvoke;\nimport jakarta.interceptor.Interceptor;\nimport jakarta.interceptor.InvocationContext;\nimport java.io.Serializable;\n\n@TestInterceptor\n@Interceptor\n@Priority(1000)\npublic class TestInterceptorImplementation implements Serializable\n{\n    @Inject\n    private InterceptionResultStorage interceptionResultStorage;\n\n    @AroundInvoke\n    public Object intercept(InvocationContext ctx) throws Exception\n    {\n        this.interceptionResultStorage.markAsIntercepted();\n        return ctx.proceed();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc012/ApplicationScopedBeanTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc012;\n\nimport org.apache.deltaspike.core.api.provider.BeanProvider;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.AfterAll;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\npublic class ApplicationScopedBeanTest\n{\n    @Inject\n    private ApplicationScopedTestBean testBean;\n\n    @Inject\n    private ApplicationScopedTestBeanClient testBeanClient;\n\n    @Test\n    public void beanAccess()\n    {\n        this.testBean.setValue(0);\n        assertEquals(1, this.testBeanClient.getNextValue());\n        assertEquals(1, this.testBean.getValue());\n    }\n\n    @AfterAll\n    public static void finalCheck()\n    {\n        int value = BeanProvider.getContextualReference(ApplicationScopedTestBean.class).getValue();\n        int nextValue = BeanProvider.getContextualReference(ApplicationScopedTestBeanClient.class).getNextValue();\n\n        if (value == 0)\n        {\n            throw new IllegalStateException(\"new application-scoped bean instance was created\");\n        }\n\n        if (nextValue == 1)\n        {\n            throw new IllegalStateException(\"new application-scoped bean instance was created\");\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc012/ApplicationScopedTestBean.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc012;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ApplicationScopedTestBean\n{\n    private int value = 0;\n\n    public void increaseValue()\n    {\n        this.value++;\n    }\n\n    public int getValue()\n    {\n        return value;\n    }\n\n    public void setValue(int value)\n    {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc012/ApplicationScopedTestBeanClient.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc012;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.inject.Inject;\n\n@ApplicationScoped\npublic class ApplicationScopedTestBeanClient\n{\n    @Inject\n    private ApplicationScopedTestBean testBean;\n\n    public int getNextValue()\n    {\n        this.testBean.increaseValue();\n        return this.testBean.getValue();\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc013/ContainerConfigTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc013;\n\nimport org.apache.deltaspike.core.api.projectstage.ProjectStage;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestSuiteExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\nimport static org.junit.jupiter.api.Assertions.assertNotNull;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\npublic class ContainerConfigTest\n{\n\n    @Test\n    @TestControl(projectStage = ProjectStage.UnitTest.class) //just for internal tests\n    public void configForTestContainerStageUnitTest()\n    {\n        assertNotNull(CdiTestSuiteExtension.getTestContainerConfig());\n        assertEquals(\"jdbc:hsqldb:mem:demoDB\",\n            CdiTestSuiteExtension.getTestContainerConfig().getProperty(\"demoDatabase.JdbcUrl\"));\n    }\n\n    @Test\n    @TestControl(projectStage = ProjectStage.IntegrationTest.class) //just for internal tests\n    public void configForTestContainerStageIntegrationTest()\n    {\n        assertNotNull(CdiTestSuiteExtension.getTestContainerConfig());\n        assertEquals(\"jdbc:hsqldb:file:demoDB\",\n            CdiTestSuiteExtension.getTestContainerConfig().getProperty(\"demoDatabase.JdbcUrl\"));\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/DefaultTestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DefaultTestService implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"default-result\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestBeanClassFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport org.apache.deltaspike.core.api.config.ConfigResolver;\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.core.util.ClassUtils;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\n\n//!!!not!!! needed with cdi 1.1+ and @Priority (which is the target of this use-case)\n//only needed because our test-suite is based on cdi v1.0\n\n//also useful to test DELTASPIKE-1337\npublic class TestBeanClassFilter implements ClassFilter\n{\n    @Override\n    public boolean isFiltered(Class<?> targetClass)\n    {\n        if (!targetClass.getName().startsWith(\"org.apache.deltaspike.test.\"))\n        {\n            return false;\n        }\n\n        String currentTestOrigin = ConfigResolver.getPropertyValue(TestControl.class.getName());\n\n        if (currentTestOrigin == null) //no known origin (no @TestControl is used)\n        {\n            //filter all classes which are located in packages using tests with class-filters\n            //(since we test the feature with ambiguous beans which isn't valid without filtering)\n            return getClass().getPackage().getName().equals(targetClass.getPackage().getName());\n        }\n        else\n        {\n            Class<?> currentOrigin = ClassUtils.tryToLoadClassForName(currentTestOrigin);\n            //origin is in one of the packages for class-filtering tests\n            if (getClass().getPackage().getName().equals(currentOrigin.getPackage().getName()))\n            {\n                TestControl testControl = currentOrigin.getAnnotation(TestControl.class);\n                return ClassUtils.tryToInstantiateClass(testControl.classFilter()).isFiltered(targetClass);\n            }\n            return isInSamePackage(targetClass);\n        }\n    }\n\n    private boolean isInSamePackage(Class<?> targetClass)\n    {\n        return targetClass.getPackage().getName().equals(getClass().getPackage().getName());\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestLabeled.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target(TYPE)\npublic @interface TestLabeled\n{\n    Class<? extends TestControl.Label> value();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestLabeledAlternativeFilter.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport org.apache.deltaspike.core.spi.filter.ClassFilter;\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\n\nimport jakarta.enterprise.inject.Alternative;\n\npublic abstract class TestLabeledAlternativeFilter implements ClassFilter\n{\n    private final Class<? extends TestControl.Label> activeLabel;\n\n    protected TestLabeledAlternativeFilter(Class<? extends TestControl.Label> activeLabel)\n    {\n        this.activeLabel = activeLabel;\n    }\n\n    @Override\n    public boolean isFiltered(Class<?> targetClass)\n    {\n        if (!targetClass.isAnnotationPresent(Alternative.class))\n        {\n            return false;\n        }\n\n        TestLabeled testLabeled = targetClass.getAnnotation(TestLabeled.class);\n\n        if (testLabeled == null)\n        {\n            return false;\n        }\n\n        if (testLabeled.value().equals(activeLabel))\n        {\n            return false;\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestService.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\npublic interface TestService\n{\n    String getValue();\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestServiceLabelX.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@TestLabeled(TestServiceLabelXTest.TestLabelX.class)\n@ApplicationScoped\npublic class TestServiceLabelX implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-x\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestServiceLabelXTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\n@TestControl(\n    activeAlternativeLabel = TestServiceLabelXTest.TestLabelX.class,\n    classFilter = TestServiceLabelXTest.LabelXFilter.class)\npublic class TestServiceLabelXTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultX()\n    {\n        assertEquals(\"result-x\", testService.getValue());\n    }\n\n    public static class TestLabelX implements TestControl.Label\n    {\n    }\n\n    //replaces the text based config of labeled-alternatives\n    public static class LabelXFilter extends TestLabeledAlternativeFilter\n    {\n        public LabelXFilter()\n        {\n            super(TestLabelX.class);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestServiceLabelY.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport jakarta.enterprise.context.ApplicationScoped;\nimport jakarta.enterprise.inject.Alternative;\n\n@Alternative\n@TestLabeled(TestServiceLabelYTest.TestLabelY.class)\n@ApplicationScoped\npublic class TestServiceLabelY implements TestService\n{\n    @Override\n    public String getValue()\n    {\n        return \"result-y\";\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/java/org/apache/deltaspike/test/testcontrol5/uc019/TestServiceLabelYTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.testcontrol5.uc019;\n\nimport org.apache.deltaspike.testcontrol5.api.TestControl;\nimport org.apache.deltaspike.testcontrol5.api.junit.CdiTestExtension;\nimport org.junit.jupiter.api.Tag;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport jakarta.inject.Inject;\n\nimport static org.junit.jupiter.api.Assertions.assertEquals;\n\n//Usually NOT needed! Currently only needed due to our arquillian-setup\n@Tag(\"SeCategory\")\n\n@ExtendWith(CdiTestExtension.class)\n@TestControl(\n        activeAlternativeLabel = TestServiceLabelYTest.TestLabelY.class,\n        classFilter = TestServiceLabelYTest.LabelYFilter.class)\npublic class TestServiceLabelYTest\n{\n    @Inject\n    private TestService testService;\n\n    @Test\n    public void resultY()\n    {\n        assertEquals(\"result-y\", testService.getValue());\n    }\n\n    public static class TestLabelY implements TestControl.Label\n    {\n    }\n\n    //replaces the text based config of labeled-alternatives\n    public static class LabelYFilter extends TestLabeledAlternativeFilter\n    {\n        public LabelYFilter()\n        {\n            super(TestLabelY.class);\n        }\n    }\n}\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/resources/META-INF/apache-deltaspike.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\ndeltaspike.testcontrol.mock-support.allow_mocked_beans=true\ndeltaspike.testcontrol.mock-support.allow_mocked_producers=true\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.test.testcontrol5.InternalTestClassDeactivator\n\ndeltaspike.testcontrol.test-container.config-file.UnitTest=META-INF/test/dsTestContainerBootConfig.properties\n\n#only needed because our test-suite is based on cdi v1.0. with v1.1+ and @Priority (which is the target of this use-case) the following part isn't needed:\norg.apache.deltaspike.core.spi.filter.ClassFilter=org.apache.deltaspike.test.testcontrol5.uc019.TestBeanClassFilter"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/resources/META-INF/apache-deltaspike_test-container.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\n#can be used to configure the underlying test-container\n#(currently the only container supported by deltaspike\n#(out-of-the-box) which supports that config is openejb-embedded)\n\n#just random config-entries\ndemoDatabase.JdbcUrl=jdbc:hsqldb:file:demoDB\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n       version=\"3.0\" bean-discovery-mode=\"all\">\n    <trim/>\n\n    <alternatives>\n        <!-- with cdi 1.1+ the following can be replaced with @Priority(...)-->\n        <class>org.apache.deltaspike.test.testcontrol5.uc019.TestServiceLabelX</class>\n        <class>org.apache.deltaspike.test.testcontrol5.uc019.TestServiceLabelY</class>\n    </alternatives>\n</beans>\n"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.alternative.AlternativeBeanClassProvider",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.testcontrol.uc016.CustomAlternativeBeanClassProvider"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/resources/META-INF/services/org.apache.deltaspike.testcontrol5.spi.mock.MockFilter",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.testcontrol5.InternalTestMockFilter"
  },
  {
    "path": "deltaspike/modules/test-control5/impl/src/test/resources/META-INF/test/dsTestContainerBootConfig.properties",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\n\n#can be used to configure the underlying test-container\n#(currently the only container supported by deltaspike\n#(out-of-the-box) which supports that config is openejb-embedded)\n\n#just random config-entries\ndemoDatabase.JdbcUrl=jdbc:hsqldb:mem:demoDB\n"
  },
  {
    "path": "deltaspike/modules/test-control5/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike.modules</groupId>\n        <artifactId>modules-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>test-control5-module-project</artifactId>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Test-Control5-Module (JUnit 5)</name>\n\n    <modules>\n        <module>api</module>\n        <module>impl</module>\n    </modules>\n</project>\n"
  },
  {
    "path": "deltaspike/parent/code/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>parent</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>parent-code</artifactId>\n\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Code Parent</name>\n    <description>Apache DeltaSpike Parent for container projects</description>\n\n    <properties>\n        <container.unpack.directory>${java.io.tmpdir}/deltaspike-arquillian-containers</container.unpack.directory>\n        <wildfly.version>31.0.0.Final</wildfly.version>\n        <weld.sfl4j>2.0.11</weld.sfl4j>\n        <wildfly.arquillian.version>5.0.1.Final</wildfly.arquillian.version>\n        <payara.version>6.2024.2</payara.version>\n    </properties>\n\n\n    <dependencyManagement>\n        <dependencies>\n            <!-- imports don't get inherited! -->\n            <dependency>\n                <groupId>org.jboss.arquillian</groupId>\n                <artifactId>arquillian-bom</artifactId>\n                <version>${arquillian.version}</version>\n                <scope>import</scope>\n                <type>pom</type>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.annotation</groupId>\n                <artifactId>jakarta.annotation-api</artifactId>\n                <version>${jakarta.annotation-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.inject</groupId>\n                <artifactId>jakarta.inject-api</artifactId>\n                <version>${jakarta.atinject-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.enterprise</groupId>\n                <artifactId>jakarta.enterprise.cdi-api</artifactId>\n                <version>${jakarta.cdi-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.interceptor</groupId>\n                <artifactId>jakarta.interceptor-api</artifactId>\n                <version>${jakarta.interceptor-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.el</groupId>\n                <artifactId>jakarta.el-api</artifactId>\n                <version>${jakarta.el-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.transaction</groupId>\n                <artifactId>jakarta.transaction-api</artifactId>\n                <version>${jakarta.transaction-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.tomcat</groupId>\n                <artifactId>tomcat-servlet-api</artifactId>\n                <version>${tomcat.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.geronimo.specs</groupId>\n                <artifactId>geronimo-jpa_2.2_spec</artifactId>\n                <version>1.1</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-impl</artifactId>\n                <version>${owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.openwebbeans</groupId>\n                <artifactId>openwebbeans-spi</artifactId>\n                <version>${owb.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.openwebbeans.arquillian</groupId>\n                <artifactId>owb-arquillian-standalone</artifactId>\n                <version>${owb.version}</version>\n                <scope>test</scope>\n            </dependency>\n            <dependency>\n                <groupId>org.jboss.arquillian.testenricher</groupId>\n                <artifactId>arquillian-testenricher-cdi-jakarta</artifactId>\n                <version>${arquillian.version}</version>\n                <scope>test</scope>\n            </dependency>\n\n        </dependencies>\n    </dependencyManagement>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.test</groupId>\n            <artifactId>test-utils</artifactId>\n            <version>${project.version}</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <pluginManagement>\n            <plugins>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-surefire-plugin</artifactId>\n                    <version>${maven.surefire.plugin.version}</version>\n                    <configuration>\n                        <systemPropertyVariables>\n                            <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                            <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                        </systemPropertyVariables>\n                    </configuration>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-jar-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <goals>\n                            <goal>test-jar</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n\n\n    <profiles>\n\n        <profile>\n            <id>JBossArchive</id>\n            <repositories>\n                <repository>\n                    <id>JBoss-Archive</id>\n                    <name>JBoss Archive</name>\n                    <url>https://repository.jboss.org/nexus/content/groups/public</url>\n                </repository>\n            </repositories>\n        </profile>\n\n        <profile>\n            <id>JBossSnapshots</id>\n            <repositories>\n                <repository>\n                    <id>JBoss-Snapshots</id>\n                    <name>JBoss Snapshots</name>\n                    <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>\n                </repository>\n            </repositories>\n        </profile>\n\n\n        <profile>\n            <!-- use this profile to compile and test DeltaSpike with Apache OpenWebBeans -->\n            <id>OWB</id>\n\n            <!-- ensures a correct build at analysis.apache.org -->\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n\n            <properties>\n                <cdicontainer.version>owb-${owb.version}</cdicontainer.version>\n\n            </properties>\n\n            <repositories>\n                <repository>\n                    <id>apache-snapshot-repository</id>\n                    <url>https://repository.apache.org/snapshots/</url>\n                    <releases>\n                        <enabled>false</enabled>\n                    </releases>\n                    <snapshots>\n                        <enabled>true</enabled>\n                    </snapshots>\n                </repository>\n            </repositories>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n\n                            <!-- Ignore these groups because they don't work with embedded OWB -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.WebProfileCategory,\n                                org.apache.deltaspike.test.category.WebEEProfileCategory,\n                                org.apache.deltaspike.test.category.FullProfileCategory,\n                                org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n\n            <dependencies>\n                <dependency>\n                    <groupId>jakarta.annotation</groupId>\n                    <artifactId>jakarta.annotation-api</artifactId>\n                    <version>${jakarta.annotation-api.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.inject</groupId>\n                    <artifactId>jakarta.inject-api</artifactId>\n                    <version>${jakarta.atinject-api.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.enterprise</groupId>\n                    <artifactId>jakarta.enterprise.cdi-api</artifactId>\n                    <version>${jakarta.cdi-api.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.interceptor</groupId>\n                    <artifactId>jakarta.interceptor-api</artifactId>\n                    <version>${jakarta.interceptor-api.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.el</groupId>\n                    <artifactId>jakarta.el-api</artifactId>\n                    <version>${jakarta.el-api.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>jakarta.transaction</groupId>\n                    <artifactId>jakarta.transaction-api</artifactId>\n                    <version>${jakarta.transaction-api.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.tomcat</groupId>\n                    <artifactId>tomcat-servlet-api</artifactId>\n                    <version>${tomcat.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.geronimo.specs</groupId>\n                    <artifactId>geronimo-jpa_2.2_spec</artifactId>\n                    <version>1.1</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-impl</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.apache.openwebbeans</groupId>\n                    <artifactId>openwebbeans-spi</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n\n                <dependency>\n                    <groupId>org.apache.openwebbeans.arquillian</groupId>\n                    <artifactId>owb-arquillian-standalone</artifactId>\n                    <version>${owb.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.arquillian.testenricher</groupId>\n                    <artifactId>arquillian-testenricher-cdi-jakarta</artifactId>\n                    <version>${arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n            </dependencies>\n        </profile>\n        <!-- please note that when changing any of these weld profiles, they are also used in some projects.\n        Make sure to update all pom's, if required -->\n\n\n        <profile>\n            <!-- use this profile to compile and test DeltaSpike with JBoss Weld 3.x on an embedded container -->\n            <id>Weld</id>\n\n            <activation>\n                <activeByDefault>false</activeByDefault>\n            </activation>\n            \n            <properties>\n                <!-- Actual Weld version used with this profile -->\n                <weld.version>5.1.2.Final</weld.version>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n            </properties>\n            \n            <dependencyManagement>\n                <dependencies>\n                    <!-- Weld Core BOM - used to fetch version of artifacts only -->\n                    <dependency>\n                        <groupId>org.jboss.weld</groupId>\n                        <artifactId>weld-core-bom</artifactId>\n                        <version>${weld.version}</version>\n                        <type>pom</type>\n                        <scope>import</scope>\n                    </dependency>\n                </dependencies>\n            </dependencyManagement>\n            \n            <dependencies>\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.module</groupId>\n                    <artifactId>weld-ejb</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.module</groupId>\n                    <artifactId>weld-jsf</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.module</groupId>\n                    <artifactId>weld-jta</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.module</groupId>\n                    <artifactId>weld-web</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.servlet</groupId>\n                    <artifactId>weld-servlet-shaded</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.servlet</groupId>\n                    <artifactId>weld-servlet-core</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.se</groupId>\n                    <artifactId>weld-se-shaded</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld.se</groupId>\n                    <artifactId>weld-se-core</artifactId>\n                </dependency>         \n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-api</artifactId>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-spi</artifactId>\n                </dependency>\n\n                <!--Other than Weld dependencies-->\n                <dependency>\n                    <groupId>jakarta.el</groupId>\n                    <artifactId>jakarta.el-api</artifactId>\n                    <version>${jakarta.el-api.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.transaction</groupId>\n                    <artifactId>jakarta.transaction-api</artifactId>\n                    <version>${jakarta.transaction-api.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.interceptor</groupId>\n                    <artifactId>jakarta.interceptor-api</artifactId>\n                    <version>${jakarta.interceptor-api.version}</version>\n                </dependency>\n\n                <!-- Test dependencies -->\n                <dependency>\n                    <groupId>org.slf4j</groupId>\n                    <artifactId>slf4j-simple</artifactId>\n                    <version>${weld.sfl4j}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.hibernate</groupId>\n                    <artifactId>hibernate-validator</artifactId>\n                    <version>8.0.0.Final</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.arquillian.container</groupId>\n                    <artifactId>arquillian-weld-embedded</artifactId>\n                    <version>${arquillian-weld.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n            \n            <build>\n                <plugins>\n                    <plugin>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n                            <!-- Ignore these groups because they don't work with embedded Weld -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.WebProfileCategory,\n                                org.apache.deltaspike.test.category.WebEEProfileCategory,\n                                org.apache.deltaspike.test.category.FullProfileCategory,\n                                org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <!--\n             * arquillian-tomee-remote isn't a real remote connector for a running server-instance\n             *\n             * DEBUGGING:\n             * mvn test -Ptomee8-build-managed -Dtest=UnitTestName -Dopenejb.server.debug=true\n             * then use remote debuggig at port 5005\n             *\n            -->\n            <id>tomee-build-managed</id>\n\n            <properties>\n                <jakartaeeapi.version>10.0</jakartaeeapi.version>\n                <owb.version>4.0.3</owb.version>\n                <cdicontainer.version>owb-${owb.version}</cdicontainer.version>\n            </properties>\n\n            <dependencies>\n                <dependency>\n                    <groupId>org.apache.tomee</groupId>\n                    <artifactId>jakartaee-api</artifactId>\n                    <version>${jakartaeeapi.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.apache.tomee</groupId>\n                    <artifactId>apache-tomee</artifactId>\n                    <classifier>webprofile</classifier>\n                    <version>${tomee.version}</version>\n                    <scope>test</scope>\n                    <type>zip</type>\n                </dependency>\n                <dependency>\n                    <groupId>org.apache.tomee</groupId>\n                    <artifactId>arquillian-tomee-remote</artifactId>\n                    <version>${tomee.version}</version>\n                </dependency>\n\n                <!-- needed by arquillian-tomee-remote -->\n                <dependency>\n                    <groupId>commons-logging</groupId>\n                    <artifactId>commons-logging</artifactId>\n                    <version>1.1.1</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <version>${maven.surefire.plugin.version}</version>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <tomee.version>${tomee.version}</tomee.version>\n                                <arquillian.launch>tomee-build-managed</arquillian.launch>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.WebEEProfileCategory,\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <!--\n             * WildFly has to be locally installed\n             *\n             * JBOSS_HOME must be set for this to work correctly!\n             *\n             * Start the build with:\n             * $> mvn clean install -Pwildfly-managed -Dweld.version=xxx\n             *\n             -->\n            <id>wildfly-managed</id>\n            <properties>\n                <!-- Actual default Weld version used with this profile -->\n                <weld.version>5.1.2.Final</weld.version>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n            </properties>\n\n            <dependencies>\n                <!--This brings in the cdi-api in correct version corresponding to Weld version specified with ${weld.version}-->\n                <!--Only for build purposes, for tests, Wildfly provides that-->\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.wildfly.arquillian</groupId>\n                    <artifactId>wildfly-arquillian-container-managed</artifactId>\n                    <version>${wildfly.arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.arquillian.protocol</groupId>\n                    <artifactId>arquillian-protocol-servlet-jakarta</artifactId>\n                    <version>${arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <version>${maven.surefire.plugin.version}</version>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <arquillian.launch>wildfly-managed</arquillian.launch>\n                                <arquillian.xml>arquillian-jboss.xml</arquillian.xml>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                                <jacoco.agent>${jacoco.agent}</jacoco.agent>\n                            </systemPropertyVariables>\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.FullProfileCategory,\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <!--\n             * WildFly will be downloaded as maven dependency\n             *\n             * JBOSS_HOME need not be set for this.\n             *\n             * Start the build with:\n             * $> mvn clean install -Pwildfly-build-managed -Dwildfly.version=10.0.0.Final -Dweld.version=xxx\n             *\n             -->\n            <id>wildfly-build-managed</id>\n\n            <properties>\n                <!-- Actual default Weld version used with this profile -->\n                <weld.version>5.1.2.Final</weld.version>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n            </properties>\n\n            <dependencies>\n                <!--This brings in the cdi-api in correct version corresponding to Weld version specified with ${weld.version}-->\n                <!--Only for build purposes, for tests, Wildfly provides that-->\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.wildfly.arquillian</groupId>\n                    <artifactId>wildfly-arquillian-container-managed</artifactId>\n                    <version>${wildfly.arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.arquillian.protocol</groupId>\n                    <artifactId>arquillian-protocol-servlet-jakarta</artifactId>\n                    <version>${arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.servlet</groupId>\n                    <artifactId>jakarta.servlet-api</artifactId>\n                    <version>${jakarta.servlet-api.version}</version>\n                </dependency>\n            </dependencies>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <version>${maven.surefire.plugin.version}</version>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <arquillian.launch>wildfly-build-managed</arquillian.launch>\n                                <arquillian.xml>arquillian-jboss.xml</arquillian.xml>\n                                <arquillian.jboss_home>\n                                    ${container.unpack.directory}/wildfly-${wildfly.version}\n                                </arquillian.jboss_home>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory,\n                                org.apache.deltaspike.test.category.FullProfileCategory,\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-dependency-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>unpack-wf</id>\n                                <phase>process-test-classes</phase>\n                                <goals>\n                                    <goal>unpack</goal>\n                                </goals>\n                                <configuration>\n                                    <artifactItems>\n                                        <artifactItem>\n                                            <groupId>org.wildfly</groupId>\n                                            <artifactId>wildfly-dist</artifactId>\n                                            <version>${wildfly.version}</version>\n                                            <outputDirectory>${container.unpack.directory}</outputDirectory>\n                                            <type>zip</type>\n                                            <overWrite>false</overWrite>\n                                        </artifactItem>\n                                    </artifactItems>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <id>wildfly-remote</id>\n            <!-- Wildfly must be started manually for this work correctly - for debug hints see arquillian-jboss.xml -->\n\n            <properties>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n            </properties>\n\n            <dependencies>\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.wildfly.arquillian</groupId>\n                    <artifactId>wildfly-arquillian-container-remote</artifactId>\n                    <version>${wildfly.arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.jboss.arquillian.protocol</groupId>\n                    <artifactId>arquillian-protocol-servlet-jakarta</artifactId>\n                    <version>${arquillian.version}</version>\n                    <scope>test</scope>\n                </dependency>\n\n            </dependencies>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <version>${maven.surefire.plugin.version}</version>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <arquillian.launch>wildfly-remote</arquillian.launch>\n                                <arquillian.xml>arquillian-jboss.xml</arquillian.xml>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.FullProfileCategory,\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <id>payara-embedded</id>\n\n            <properties>\n                <weld.version>5.0.1.Final</weld.version>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n            </properties>\n\n            <dependencies>\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>fish.payara.extras</groupId>\n                    <artifactId>payara-embedded-all</artifactId>\n                    <version>${payara.version}</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>fish.payara.arquillian</groupId>\n                    <artifactId>arquillian-payara-server-embedded</artifactId>\n                    <version>3.0.alpha8</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <arquillian.launch>payara-build-managed</arquillian.launch>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n        <profile>\n            <!--\n             * Payara will be downloaded as maven dependency\n             *\n             * Start the build with:\n             * $> mvn clean install -Ppayara-build-managed\n             *\n             -->\n            <id>payara-build-managed</id>\n\n            <properties>\n                <weld.version>5.0.1.Final</weld.version>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n            </properties>\n\n            <dependencies>\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.servlet</groupId>\n                    <artifactId>jakarta.servlet-api</artifactId>\n                    <version>${jakarta.servlet-api.version}</version>\n                </dependency>\n                <dependency>\n                    <groupId>fish.payara.arquillian</groupId>\n                    <artifactId>arquillian-payara-server-managed</artifactId>\n                    <version>3.0.alpha8</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <arquillian.launch>payara-build-managed</arquillian.launch>\n                                <arquillian.payara_home>${container.unpack.directory}/payara6</arquillian.payara_home>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-dependency-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>unpack-payara</id>\n                                <phase>generate-test-resources</phase>\n                                <goals>\n                                    <goal>unpack</goal>\n                                </goals>\n                                <configuration>\n                                    <artifactItems>\n                                        <artifactItem>\n                                            <groupId>fish.payara.distributions</groupId>\n                                            <artifactId>payara</artifactId>\n                                            <version>${payara.version}</version>\n                                            <outputDirectory>${container.unpack.directory}</outputDirectory>\n                                            <type>zip</type>\n                                            <overWrite>false</overWrite>\n                                        </artifactItem>\n                                    </artifactItems>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-antrun-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>prepare-payara</id>\n                                <phase>process-test-resources</phase>\n                                <goals>\n                                    <goal>run</goal>\n                                </goals>\n                                <configuration>\n                                    <target>\n                                        <!-- Change all TCP ports from \"xxxx\" to \"2xxxx\" -->\n                                        <replaceregexp file=\"${container.unpack.directory}/payara6/glassfish/domains/domain1/config/domain.xml\" match=\"port=&quot;(\\d{4})&quot;\" replace=\"port=&quot;2\\1&quot;\" flags=\"g\" />\n                                        <replace file=\"${container.unpack.directory}/payara6/glassfish/domains/domain1/config/domain.xml\" token=\"value=&quot;7676&quot;\" value=\"value=&quot;27676&quot;\" />\n\n                                        <!-- Replace the default datasource with an in-memory one -->\n                                        <replace file=\"${container.unpack.directory}/payara6/glassfish/domains/domain1/config/domain.xml\" token=\"datasource-classname=&quot;org.apache.derby.jdbc.ClientDataSource&quot;\" value=\"datasource-classname=&quot;org.apache.derby.jdbc.EmbeddedDataSource&quot;\" />\n                                        <replace file=\"${container.unpack.directory}/payara6/glassfish/domains/domain1/config/domain.xml\" token=\"value=&quot;sun-appserv-samples&quot;\" value=\"value=&quot;memory:deltaspike&quot;\" />\n                                    </target>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n\n        <profile>\n            <!--\n             * Glassfish will be downloaded as maven dependency\n             *\n             * Start the build with:\n             * $> mvn clean install -Pglassfish-build-managed\n             *\n             -->\n            <id>glassfish-build-managed</id>\n\n            <properties>\n                <weld.version>5.1.2.Final</weld.version>\n                <cdicontainer.version>weld-${weld.version}</cdicontainer.version>\n                <glassfish.version>7.0.13</glassfish.version>\n            </properties>\n\n            <dependencies>\n                <dependency>\n                    <groupId>org.jboss.weld</groupId>\n                    <artifactId>weld-core-impl</artifactId>\n                    <version>${weld.version}</version>\n                    <scope>provided</scope>\n                </dependency>\n                <dependency>\n                    <groupId>jakarta.servlet</groupId>\n                    <artifactId>jakarta.servlet-api</artifactId>\n                    <version>${jakarta.servlet-api.version}</version>\n                </dependency>\n                <dependency>\n                    <groupId>org.omnifaces.arquillian</groupId>\n                    <artifactId>arquillian-glassfish-server-managed</artifactId>\n                    <version>1.4</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-surefire-plugin</artifactId>\n                        <configuration>\n                            <systemPropertyVariables>\n                                <arquillian.launch>glassfish-build-managed</arquillian.launch>\n                                <arquillian.glassfish_home>${container.unpack.directory}/glassfish7</arquillian.glassfish_home>\n                                <org.apache.deltaspike.ProjectStage>UnitTest</org.apache.deltaspike.ProjectStage>\n                                <cdicontainer.version>${cdicontainer.version}</cdicontainer.version>\n                            </systemPropertyVariables>\n                            <!-- we just use groups to mark that a test should be executed only\n                            with specific environments. even though a java-ee6 application server has to be able to run\n                            all tests in theory, we have to exclude some tests because there are e.g. packaging issues or\n                            there are currently issues with arquillian. if a test isn't restricted to an environment,\n                            no category is used for the test-class. -->\n                            <excludedGroups>\n                                org.apache.deltaspike.test.category.SeCategory\n                            </excludedGroups>\n                        </configuration>\n                    </plugin>\n\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-dependency-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>unpack-glassfish</id>\n                                <phase>generate-test-resources</phase>\n                                <goals>\n                                    <goal>unpack</goal>\n                                </goals>\n                                <configuration>\n                                    <artifactItems>\n                                        <artifactItem>\n                                            <groupId>org.glassfish.main.distributions</groupId>\n                                            <artifactId>glassfish</artifactId>\n                                            <version>${glassfish.version}</version>\n                                            <outputDirectory>${container.unpack.directory}</outputDirectory>\n                                            <type>zip</type>\n                                            <overWrite>false</overWrite>\n                                        </artifactItem>\n                                    </artifactItems>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-antrun-plugin</artifactId>\n                        <executions>\n                            <execution>\n                                <id>prepare-glassfish</id>\n                                <phase>process-test-resources</phase>\n                                <goals>\n                                    <goal>run</goal>\n                                </goals>\n                                <configuration>\n                                    <target>\n                                        <!-- Change all TCP ports from \"xxxx\" to \"2xxxx\" -->\n                                        <replaceregexp file=\"${container.unpack.directory}/glassfish7/glassfish/domains/domain1/config/domain.xml\" match=\"port=&quot;(\\d{4})&quot;\" replace=\"port=&quot;2\\1&quot;\" flags=\"g\" />\n                                        <replace file=\"${container.unpack.directory}/glassfish7/glassfish/domains/domain1/config/domain.xml\" token=\"value=&quot;7676&quot;\" value=\"value=&quot;27676&quot;\" />\n\n                                        <!-- Replace the default datasource with an in-memory one -->\n                                        <replace file=\"${container.unpack.directory}/glassfish7/glassfish/domains/domain1/config/domain.xml\" token=\"datasource-classname=&quot;org.apache.derby.jdbc.ClientDataSource&quot;\" value=\"datasource-classname=&quot;org.apache.derby.jdbc.EmbeddedDataSource&quot;\" />\n                                        <replace file=\"${container.unpack.directory}/glassfish7/glassfish/domains/domain1/config/domain.xml\" token=\"value=&quot;sun-appserv-samples&quot;\" value=\"value=&quot;memory:deltaspike&quot;\" />\n                                    </target>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "deltaspike/parent/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>deltaspike-project</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <artifactId>parent</artifactId>\n\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Parent</name>\n    <description>Apache DeltaSpike Parent</description>\n\n    <issueManagement>\n        <system>jira</system>\n        <url>https://issues.apache.org/jira/browse/DELTASPIKE</url>\n    </issueManagement>\n\n    <ciManagement>\n        <system>cjenkins</system>\n        <url>http://builds.apache.org/</url>\n    </ciManagement>\n\n    <inceptionYear>2011</inceptionYear>\n\n    <properties>\n        <java.version>11</java.version>\n        <owb.version>4.0.3</owb.version>\n\n        <!-- Weld profiles (in parent/code/pom.xml) override this version -->\n        <weld.version>5.1.7.Final</weld.version>\n\n        <!-- for cdictrl-openejb -->\n        <tomee.version>10.1.5</tomee.version>\n        <tomee-api.version>10.0.1</tomee-api.version>\n\n        <openejb.owb.version>${owb.version}</openejb.owb.version>\n        <openejb.owb.version>${owb.version}</openejb.owb.version>\n\n        <!-- testing stuff -->\n        <junit.version>4.13.2</junit.version>\n        <junit5.version>5.14.4</junit5.version>\n        <arquillian.version>1.8.0.Final</arquillian.version>\n\n        <!-- Faces implementations -->\n        <myfaces.version>4.0.2</myfaces.version>\n\n        <tomcat.version>10.1.13</tomcat.version>\n\n        <!-- used for some bytecode proxy stuff. Shaded in -->\n        <asm.version>9.9.1</asm.version>\n\n        <maven.surefire.plugin.version>3.5.5</maven.surefire.plugin.version>\n        <maven.bundle.plugin.version>3.5.0</maven.bundle.plugin.version>\n        <maven.jar.plugin.version>3.1.2</maven.jar.plugin.version>\n        <maven.dependency.plugin.version>2.4</maven.dependency.plugin.version>\n        <maven.checkstyle.plugin.version>2.16</maven.checkstyle.plugin.version>\n        <maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version>\n        <maven.assembly.plugin.version>3.2.0</maven.assembly.plugin.version>\n        <maven.artifact.version>3.0</maven.artifact.version>\n\n        <hamcrest.version>1.3</hamcrest.version>\n\n        <jacoco.version>0.7.4.201502262128</jacoco.version>\n\n        <arquillian-weld.version>4.0.0.Final</arquillian-weld.version>\n\n        <!-- OSGi bundles properties -->\n        <deltaspike.osgi.import.deltaspike.version>version=\"[$(version;==;${deltaspike.osgi.version.clean}),$(version;=+;${deltaspike.osgi.version.clean}))\"</deltaspike.osgi.import.deltaspike.version>\n        <deltaspike.osgi.import.strict.version>version=\"[$(version;===;${deltaspike.osgi.version.clean}),$(version;==+;${deltaspike.osgi.version.clean}))\"</deltaspike.osgi.import.strict.version>\n        <deltaspike.osgi.import.default.version>[$(version;==;$(@)),$(version;+;$(@)))</deltaspike.osgi.import.default.version>\n        <deltaspike.osgi.import.defaults>\n            org.springframework.*;version=\"[3,4)\",\n        </deltaspike.osgi.import.defaults>\n        <deltaspike.osgi.import.before.defaults />\n        <deltaspike.osgi.import.additional />\n        <deltaspike.osgi.import.pkg>\n            !${deltaspike.osgi.export.pkg},\n            org.apache.deltaspike.*;${deltaspike.osgi.import.deltaspike.version},\n            ${deltaspike.osgi.import.before.defaults},\n            ${deltaspike.osgi.import.defaults},\n            ${deltaspike.osgi.import.additional},\n            *\n        </deltaspike.osgi.import.pkg>\n        <deltaspike.osgi.activator />\n        <deltaspike.osgi.failok>false</deltaspike.osgi.failok>\n        <deltaspike.osgi.private.pkg>!*</deltaspike.osgi.private.pkg>\n        <deltaspike.osgi.export>${deltaspike.osgi.export.pkg};${deltaspike.osgi.version}</deltaspike.osgi.export>\n        <deltaspike.osgi.version>version=${project.version}</deltaspike.osgi.version>\n        <deltaspike.osgi.split.pkg>-split-package:=first</deltaspike.osgi.split.pkg>\n        <deltaspike.osgi.import>${deltaspike.osgi.import.pkg}</deltaspike.osgi.import>\n        <deltaspike.osgi.dynamic />\n        <deltaspike.osgi.symbolic.name>${project.groupId}.${project.artifactId}</deltaspike.osgi.symbolic.name>\n        <deltaspike.osgi.exclude.dependencies>false</deltaspike.osgi.exclude.dependencies>\n        <deltaspike.osgi.provide.capability />\n        <deltaspike.osgi.require.capability />\n        <cdi.osgi.beans-managed />\n\n\n        <jakarta.atinject-api.version>2.0.0</jakarta.atinject-api.version>\n        <jakarta.cdi-api.version>4.0.0</jakarta.cdi-api.version>\n        <jakarta.interceptor-api.version>2.0.0</jakarta.interceptor-api.version>\n        <jakarta.annotation-api.version>2.0.0</jakarta.annotation-api.version>\n        <jakarta.el-api.version>5.0.0</jakarta.el-api.version>\n        <jakarta.persistence-api.version>3.1.0</jakarta.persistence-api.version>\n        <jakarta.transaction-api.version>2.0.0</jakarta.transaction-api.version>\n        <jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>\n    </properties>\n\n    <profiles>\n\n\n        <profile>\n            <id>coverage</id>\n            <!--\n             * Activate this profile to gather unit test coverage\n             * Start with:\n             * $> mvn clean install -Pcoverage\n             * The generated information will be in target/site/jacoco/index.html\n            -->\n\n            <dependencies>\n                <dependency>\n                    <groupId>org.jboss.arquillian.extension</groupId>\n                    <artifactId>arquillian-jacoco</artifactId>\n                    <version>1.0.0.Alpha7</version>\n                    <scope>test</scope>\n                </dependency>\n                <dependency>\n                    <groupId>org.jacoco</groupId>\n                    <artifactId>org.jacoco.core</artifactId>\n                    <version>${jacoco.version}</version>\n                    <scope>test</scope>\n                </dependency>\n            </dependencies>\n\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.jacoco</groupId>\n                        <artifactId>jacoco-maven-plugin</artifactId>\n                        <version>${jacoco.version}</version>\n                        <configuration>\n                            <propertyName>jacoco.agent</propertyName>\n                        </configuration>\n                        <executions>\n                            <execution>\n                                <goals>\n                                    <goal>prepare-agent</goal>\n                                </goals>\n                            </execution>\n                            <execution>\n                                <id>report</id>\n                                <phase>post-integration-test</phase>\n                                <goals>\n                                    <goal>report</goal>\n                                </goals>\n                            </execution>\n                        </executions>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n        <profile>\n            <id>jdk17+</id>\n            <activation>\n                <jdk>[17,)</jdk>\n            </activation>\n            <build>\n                <pluginManagement>\n                    <plugins>\n                        <plugin>\n                            <groupId>org.apache.maven.plugins</groupId>\n                            <artifactId>maven-surefire-plugin</artifactId>\n                            <configuration>\n                                <argLine>\n                                    --add-opens java.base/java.lang=ALL-UNNAMED\n                                    --add-opens java.base/java.util=ALL-UNNAMED\n                                    --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED\n                                </argLine>\n                            </configuration>\n                        </plugin>\n                    </plugins>\n                </pluginManagement>\n            </build>\n        </profile>\n    </profiles>\n\n\n    <modules>\n        <module>code</module>\n    </modules>\n\n    <developers>\n        <developer>\n            <id>gpetracek</id>\n            <name>Gerhard Petracek</name>\n            <email>gpetracek@apache.org</email>\n            <organization>IRIAN.at, Austria</organization>\n            <organizationUrl>http://www.irian.at/</organizationUrl>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>lightguardjp</id>\n            <name>Jason Porter</name>\n            <email>lightguardjp@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>-7</timezone>\n        </developer>\n        <developer>\n            <id>mbenson</id>\n            <name>Matt Benson</name>\n            <email>mbenson@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>-6</timezone>\n        </developer>\n        <developer>\n            <id>struberg</id>\n            <name>Mark Struberg</name>\n            <email>struberg@apache.org</email>\n            <roles>\n                <role>PMC</role>\n                <role>VP</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>arne</id>\n            <name>Arne Limburg</name>\n            <email>arne@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>rdebusscher</id>\n            <name>Rudy De Busscher</name>\n            <email>rdebusscher@apache.org</email>\n            <organization>C4J, Belgium</organization>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>chkal</id>\n            <name>Christian Kaltepoth</name>\n            <email>chkal@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>cmoulliard</id>\n            <name>Charles Moulliard</name>\n            <email>cmoulliard@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>thug</id>\n            <name>Thomas Hug</name>\n            <email>thug@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>johndament</id>\n            <name>John D. Ament</name>\n            <email>johndament@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>-5</timezone>\n        </developer>\n        <developer>\n            <id>tandraschko</id>\n            <name>Thomas Andraschko</name>\n            <email>tandraschko@apache.org</email>\n            <roles>\n                <role>PMC</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>rafabene</id>\n            <name>Rafael Benevides</name>\n            <email>rafabene@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>-3</timezone>\n        </developer>\n        <developer>\n            <id>rsmeral</id>\n            <name>Ron Smeral</name>\n            <email>rsmeral@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>danielsoro</id>\n            <name>Daniel Cunha</name>\n            <email>danielsoro@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>-3</timezone>\n        </developer>\n        <developer>\n            <id>hwellmann</id>\n            <name>Harald Wellmann</name>\n            <email>hwellmann@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>manovotn</id>\n            <name>Matej Novotny</name>\n            <email>manovotn@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n        <developer>\n            <id>cbeikov</id>\n            <name>Christian Beikov</name>\n            <email>cbeikov@apache.org</email>\n            <roles>\n                <role>Committer</role>\n            </roles>\n            <timezone>+1</timezone>\n        </developer>\n    </developers>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>junit</groupId>\n                <artifactId>junit</artifactId>\n                <version>${junit.version}</version>\n                <scope>test</scope>\n            </dependency>\n\n            <!-- this imports all version definitions for Arquillian -->\n            <dependency>\n                <groupId>org.jboss.arquillian</groupId>\n                <artifactId>arquillian-bom</artifactId>\n                <version>${arquillian.version}</version>\n                <scope>import</scope>\n                <type>pom</type>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.annotation</groupId>\n                <artifactId>jakarta.annotation-api</artifactId>\n                <version>${jakarta.annotation-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.inject</groupId>\n                <artifactId>jakarta.inject-api</artifactId>\n                <version>${jakarta.atinject-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.enterprise</groupId>\n                <artifactId>jakarta.enterprise.cdi-api</artifactId>\n                <version>${jakarta.cdi-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.interceptor</groupId>\n                <artifactId>jakarta.interceptor-api</artifactId>\n                <version>${jakarta.interceptor-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.el</groupId>\n                <artifactId>jakarta.el-api</artifactId>\n                <version>${jakarta.el-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.transaction</groupId>\n                <artifactId>jakarta.transaction-api</artifactId>\n                <version>${jakarta.transaction-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>jakarta.persistence</groupId>\n                <artifactId>jakarta.persistence-api</artifactId>\n                <version>${jakarta.persistence-api.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n\n            <dependency>\n                <groupId>org.apache.tomcat</groupId>\n                <artifactId>tomcat-servlet-api</artifactId>\n                <version>${tomcat.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <!--\n                We currently need this for the CDI test container to emulate the @SessionScoped.\n                TODO: Finally this should not be necessary anymore.\n            -->\n<!--\n            <dependency>\n                <groupId>org.apache.tomcat</groupId>\n                <artifactId>tomcat-servlet-api</artifactId>\n                <version>${tomcat.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n            <dependency>\n                <groupId>org.apache.tomcat</groupId>\n                <artifactId>tomcat-el-api</artifactId>\n                <version>${tomcat.version}</version>\n                <scope>provided</scope>\n            </dependency>\n\n-->\n\n            <dependency>\n                <groupId>org.hamcrest</groupId>\n                <artifactId>hamcrest-library</artifactId>\n                <version>${hamcrest.version}</version>\n                <scope>test</scope>\n            </dependency>\n\n            <!-- dependency for DELTASPIKE-1401 -->\n            <dependency>\n                <groupId>org.owasp.encoder</groupId>\n                <artifactId>encoder</artifactId>\n                <version>1.2.2</version>\n            </dependency>\n\n            <dependency>\n                <groupId>org.mockito</groupId>\n                <artifactId>mockito-all</artifactId>\n                <version>1.9.5</version>\n                <scope>test</scope>\n            </dependency>\n        </dependencies>\n\n    </dependencyManagement>\n\n    <!-- These dependencies are needed for each and every module in this project -->\n    <dependencies>\n        <!-- unit testing stuff -->\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.arquillian.junit</groupId>\n            <artifactId>arquillian-junit-container</artifactId>\n            <version>${arquillian.version}</version>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <pluginManagement>\n            <plugins>\n                <plugin>\n                    <artifactId>maven-jar-plugin</artifactId>\n                    <version>${maven.jar.plugin.version}</version>\n                    <configuration>\n                        <archive>\n                            <manifest>\n                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>\n                            </manifest>\n                        </archive>\n                    </configuration>\n                </plugin>\n                <plugin>\n                    <artifactId>maven-surefire-plugin</artifactId>\n                    <version>${maven.surefire.plugin.version}</version>\n                    <configuration>\n                        <trimStackTrace>false</trimStackTrace>\n                    </configuration>\n                    <dependencies>\n                        <!-- We need to add this manually to get the category support for JUnit -->\n                        <dependency>\n                            <groupId>org.apache.maven.surefire</groupId>\n                            <artifactId>surefire-junit47</artifactId>\n                            <version>${maven.surefire.plugin.version}</version>\n                        </dependency>\n                    </dependencies>\n                </plugin>\n                <plugin>\n                    <artifactId>maven-dependency-plugin</artifactId>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <version>${maven.dependency.plugin.version}</version>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.felix</groupId>\n                    <artifactId>maven-bundle-plugin</artifactId>\n                    <version>${maven.bundle.plugin.version}</version>\n                </plugin>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-assembly-plugin</artifactId>\n                    <version>${maven.assembly.plugin.version}</version>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n\n        <plugins>\n            <plugin>\n                <!--\n                    - Copy LICENSE.txt and NOTICE.txt so that they are included\n                    - in the -javadoc jar file for the component.\n                -->\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-antrun-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <id>javadoc.resources</id>\n                        <phase>generate-sources</phase>\n                        <goals>\n                            <goal>run</goal>\n                        </goals>\n                        <configuration>\n                            <target>\n                                <copy todir=\"${project.build.directory}/apidocs/META-INF\">\n                                    <fileset dir=\"${basedir}\">\n                                        <include name=\"LICENSE.txt\" />\n                                        <include name=\"NOTICE.txt\" />\n                                    </fileset>\n                                </copy>\n                            </target>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>javadoc.site.copy</id>\n                        <phase>site</phase>\n                        <goals>\n                            <goal>run</goal>\n                        </goals>\n                        <configuration>\n                            <target>\n                                <!-- Copy javadoc to another directory, to keep javadoc of previous versions on site -->\n                                <copy todir=\"${project.build.directory}/site/apidocs-${project.version}\" failonerror=\"false\">\n                                    <fileset dir=\"${project.build.directory}/site/apidocs\" />\n                                </copy>\n                            </target>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n            <!--\n                - Make a checkstyle violation a compile error. Note that if a compile error occurs,\n                - further information can be found in target/site/checkstyle.html (present even when\n                - just the compile goal and not the site goal has been run). Note also that child\n                - projects may redeclare this plugin and provide different configuration settings\n                - to use different checks (more or less strict than the default).\n            -->\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-checkstyle-plugin</artifactId>\n                <version>${maven.checkstyle.plugin.version}</version>\n                <configuration>\n                    <configLocation>deltaspike/default-checks.xml</configLocation>\n                    <headerLocation>deltaspike/asf-header.txt</headerLocation>\n                    <consoleOutput>true</consoleOutput>\n                </configuration>\n                <executions>\n                    <execution>\n                        <id>verify-style</id>\n                        <phase>verify</phase>\n                        <goals>\n                            <goal>check</goal>\n                        </goals>\n                    </execution>\n                </executions>\n                <dependencies>\n                    <dependency>\n                        <groupId>org.apache.deltaspike</groupId>\n                        <artifactId>checkstyle-rules</artifactId>\n                        <version>${project.version}</version>\n                    </dependency>\n                </dependencies>\n            </plugin>\n\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-compiler-plugin</artifactId>\n                <version>${maven.compiler.plugin.version}</version>\n                <configuration>\n                    <release>${java.version}</release>\n                </configuration>\n            </plugin>\n\n            <!-- Generate Manifest file required for OSGI bundles -->\n            <plugin>\n                <groupId>org.apache.felix</groupId>\n                <artifactId>maven-bundle-plugin</artifactId>\n                <version>${maven.bundle.plugin.version}</version>\n                <extensions>true</extensions>\n                <configuration>\n                    <instructions>\n                        <Bundle-Name>${project.artifactId}</Bundle-Name>\n                        <Bundle-SymbolicName>${deltaspike.osgi.symbolic.name}</Bundle-SymbolicName>\n                        <Bundle-Activator>${deltaspike.osgi.activator}</Bundle-Activator>\n                        <Export-Package>${deltaspike.osgi.export}</Export-Package>\n                        <Import-Package>${deltaspike.osgi.import}</Import-Package>\n                        <DynamicImport-Package>${deltaspike.osgi.dynamic}</DynamicImport-Package>\n                        <Private-Package>${deltaspike.osgi.private.pkg}</Private-Package>\n                        <Implementation-Title>Apache DeltaSpike</Implementation-Title>\n                        <Implementation-Version>${project.version}</Implementation-Version>\n                        <Pax-ManagedBeans>${cdi.osgi.beans-managed}</Pax-ManagedBeans>\n                        <Karaf-Info>DeltaSpike;${project.artifactId}=${project.version}</Karaf-Info>\n                        <_versionpolicy>${deltaspike.osgi.import.default.version}</_versionpolicy>\n                        <_failok>${deltaspike.osgi.failok}</_failok>\n                        <Require-Capability>${deltaspike.osgi.require.capability}</Require-Capability>\n                        <Provide-Capability>${deltaspike.osgi.provide.capability}</Provide-Capability>\n                    </instructions>\n                </configuration>\n                <executions>\n                    <execution>\n                        <id>versions</id>\n                        <phase>validate</phase>\n                        <goals>\n                            <goal>cleanVersions</goal>\n                        </goals>\n                        <configuration>\n                            <versions>\n                                <deltaspike.osgi.version.clean>${project.version}</deltaspike.osgi.version.clean>\n                            </versions>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n\n        </plugins>\n    </build>\n\n    <reporting>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-checkstyle-plugin</artifactId>\n                <version>${maven.checkstyle.plugin.version}</version>\n                <configuration>\n                    <configLocation>deltaspike/default-checks.xml</configLocation>\n                    <headerLocation>deltaspike/asf-header.txt</headerLocation>\n                </configuration>\n            </plugin>\n        </plugins>\n    </reporting>\n\n</project>\n"
  },
  {
    "path": "deltaspike/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>deltaspike</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <!--\n     * Please do not use this pom for other deltaspike modules.\n     * Instead use the one from parent/pom.xml!\n     *\n     * This very pom.xml contains only the basic build layout\n     * and no build-rules at all. See parent/pom.xml for all\n     * the dependencyManagement and plugin configuration stuff.\n    -->\n    <groupId>org.apache.deltaspike</groupId>\n    <artifactId>deltaspike-project</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Sources</name>\n    <description>Apache DeltaSpike CDI Extensions.</description>\n    <url>http://deltaspike.apache.org</url>\n\n    <properties>\n        <svn.scmPubUrl>https://svn.apache.org/repos/infra/sites/deltaspike/javadoc/${project.version}</svn.scmPubUrl>\n    </properties>\n\n    <modules>\n        <module>checkstyle-rules</module>\n        <module>parent</module>\n        <module>test-utils</module>\n        <module>core</module>\n        <module>cdictrl</module>\n        <module>modules</module>\n        <module>examples</module>\n        <module>dist</module>\n    </modules>\n\n    <build>\n        <pluginManagement>\n            <plugins>\n                <plugin>\n                    <groupId>org.apache.rat</groupId>\n                    <artifactId>apache-rat-plugin</artifactId>\n                    <version>0.13</version>\n                    <configuration>\n                        <excludes>\n                            <exclude>.idea/**/*</exclude>\n                            <exclude>readme/**/*</exclude>\n                            <exclude>**/*.log</exclude>\n                            <exclude>**/target/**</exclude>\n                            <exclude>test-ee7/target/**</exclude>\n                            <exclude>**/*.iml</exclude>\n                            <exclude>**/MANIFEST.MF</exclude>\n                        </excludes>\n                    </configuration>\n                </plugin>\n\n                <!-- Javadoc plugin -->\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-javadoc-plugin</artifactId>\n                    <version>3.6.3</version>\n                    <configuration>\n                        <charset>UTF-8</charset>\n                        <detectLinks>false</detectLinks>\n                        <source>11</source>\n                        <doclint>none</doclint>\n                        <excludePackageNames>org.apache.deltaspike.example.*:org.apache.deltaspike.playground*:org.apache.deltaspike.test.*:org.apache.deltaspike.cdise.tck*:org.apache.deltaspike.cdise.servlet*:*impl*</excludePackageNames>\n                        <groups>\n                            <group>\n                                <title>Core Module</title>\n                                <packages>org.apache.deltaspike.core.*</packages>\n                            </group>\n                            <group>\n                                <title>Bean Validation Module</title>\n                                <packages>org.apache.deltaspike.beanvalidation*</packages>\n                            </group>\n                            <group>\n                                <title>Container Control Module</title>\n                                <packages>org.apache.deltaspike.cdise.api*</packages>\n                            </group>\n                            <group>\n                                <title>Data Module</title>\n                                <packages>org.apache.deltaspike.data.*</packages>\n                            </group>\n                            <group>\n                                <title>JPA Module</title>\n                                <packages>org.apache.deltaspike.jpa.*</packages>\n                            </group>\n                            <group>\n                                <title>JSF Module</title>\n                                <packages>org.apache.deltaspike.jsf.*</packages>\n                            </group>\n                            <group>\n                                <title>Partial Bean Module</title>\n                                <packages>org.apache.deltaspike.partialbean.*</packages>\n                            </group>\n                            <group>\n                                <title>Scheduler Module</title>\n                                <packages>org.apache.deltaspike.scheduler.*</packages>\n                            </group>\n                            <group>\n                                <title>Security Module</title>\n                                <packages>org.apache.deltaspike.security.*</packages>\n                            </group>\n                            <group>\n                                <title>Servlet Module</title>\n                                <packages>org.apache.deltaspike.servlet.*</packages>\n                            </group>\n                            <group>\n                                <title>Test Control Module</title>\n                                <packages>org.apache.deltaspike.testcontrol.*</packages>\n                            </group>\n                            <group>\n                                <title>Proxy Module</title>\n                                <packages>org.apache.deltaspike.proxy.*</packages>\n                            </group>\n                        </groups>\n                    </configuration>\n                </plugin>\n                <!-- Publish Javadoc online -->\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-scm-publish-plugin</artifactId>\n                    <configuration>\n                        <content>${project.reporting.outputDirectory}/apidocs</content>\n                        <pubScmUrl>scm:svn:${svn.scmPubUrl}</pubScmUrl>\n                        <tryUpdate>true</tryUpdate>\n                        <checkoutDirectory>${svn.scmPubCheckoutDirectory}</checkoutDirectory>\n                        <serverId>deltaspike-site</serverId>\n                    </configuration>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n\n        <plugins>\n            <plugin>\n                <groupId>org.apache.rat</groupId>\n                <artifactId>apache-rat-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <phase>validate</phase>\n                        <goals>\n                            <goal>check</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n\n</project>\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-0.2-incubating.txt",
    "content": "Apache DeltaSpike-0.2-incubating Release Notes\n\nSub-task\n\n    [DELTASPIKE-15] - review and discuss @DefaultBean\n    [DELTASPIKE-64] - review and discuss @Secured\n    [DELTASPIKE-65] - review and discuss @SecurityBindingType\n    [DELTASPIKE-83] - unit and integration tests for global alternatives\n    [DELTASPIKE-93] - update java-se example\n    [DELTASPIKE-99] - refactor the owb-se example to a generic se-example\n    [DELTASPIKE-106] - re-visit separation of container control and context management\n    [DELTASPIKE-116] - unit and integration tests for @ConfigProperty\n    [DELTASPIKE-131] - Discuss the concept of exception handlers\n    [DELTASPIKE-133] - Discuss using exception handling should be easy\n    [DELTASPIKE-138] - unit and integration tests for @SecurityBindingType\n    [DELTASPIKE-149] - unit and integration tests for @MessageContextConfig - static usage\n    [DELTASPIKE-154] - unit and integration tests for Message and MessageContext - dynamic usage\n    [DELTASPIKE-159] - unit and integration tests for @ExceptionHandler\n\nBug\n\n    [DELTASPIKE-95] - ConfigResolver#getAllPropertyValues implementation and javadoc out of sync\n    [DELTASPIKE-124] - tests in ContainerCtrlTckTest don't stop contexts at the end\n    [DELTASPIKE-135] - [CdiControl] make Weld and OWB dependencies <scope>provided\n    [DELTASPIKE-136] - [CdiControl] cdictrl-owb should only use the Session mocks if the servlet-api is available\n\nImprovement\n\n    [DELTASPIKE-56] - Add BeanManagerProvider.getRequiredBeanManager() method\n    [DELTASPIKE-67] - auto-veto for (custom) project-stage beans\n    [DELTASPIKE-72] - BeanManagerProvider#getBeanManager should fail fast if there is no bean-manager\n    [DELTASPIKE-90] - default ConfigSource should have different ordinals\n    [DELTASPIKE-97] - fallback for the lookup via ServiceLoader\n    [DELTASPIKE-98] - fallback for the lookup of resource bundles\n    [DELTASPIKE-100] - improve the bootstrapping module for java-se for simple use-cases\n    [DELTASPIKE-112] - improved root-bean-manager support\n    [DELTASPIKE-120] - BeanProvider: add convenience methods without the 'optional' flag\n    [DELTASPIKE-123] - convenience methods for CdiContainer\n    [DELTASPIKE-126] - Include SecurityParameterBinding support for SecurityBindingType feature\n    [DELTASPIKE-130] - Remove custom ProjectStageProducer logic\n    [DELTASPIKE-151] - Provide lookup method with Map result\n    [DELTASPIKE-152] - unified package names\n\nNew Feature\n\n    [DELTASPIKE-61] - global alternatives\n    [DELTASPIKE-69] - @SecurityBindingType\n    [DELTASPIKE-70] - @Secured\n    [DELTASPIKE-92] - ContainerControl API + impls\n    [DELTASPIKE-114] - @ConfigProperty based on ConfigResolver\n    [DELTASPIKE-121] - add a method to inject CDI beans in a particular instance\n    [DELTASPIKE-127] - credential based login/logout\n    [DELTASPIKE-137] - [CdiControl] implement ContainerControl for embedded OpenEJB + OWB\n    [DELTASPIKE-146] - Type Safe Message - Basic\n    [DELTASPIKE-148] - optional @MessageContextConfig - static usage\n    [DELTASPIKE-153] - Message and MessageContext - dynamic usage\n    [DELTASPIKE-158] - @ExceptionHandler\n\nTask\n\n    [DELTASPIKE-57] - Add Apache TomEE managed Arquillian adapter to itests\n    [DELTASPIKE-71] - create deltaspike security module\n    [DELTASPIKE-85] - refactoring of util classes\n    [DELTASPIKE-86] - change the test-config to allow to restrict tests to a specific environment\n    [DELTASPIKE-91] - re-visit test setup\n    [DELTASPIKE-101] - add incubating disclaimer\n    [DELTASPIKE-103] - Integration testing on WebLogic Server 12c\n    [DELTASPIKE-107] - add BackwardCompatibility profile\n    [DELTASPIKE-108] - add profile for snapshots\n    [DELTASPIKE-109] - weekly ci builds for different versions of owb and weld\n    [DELTASPIKE-117] - create profile jbossas-build-managed-7\n    [DELTASPIKE-125] - refactor \"deploy\"-methods of arquillian tests\n    [DELTASPIKE-129] - re-visit visibility of AnnotationBuilder, ImmutableInjectionPoint, InjectableMethod and ParameterValueRedefiner\n    [DELTASPIKE-141] - move internal test artifacts to group-id orgapache.deltaspike.test\n    [DELTASPIKE-142] - remove @author in javadoc\n    [DELTASPIKE-144] - create profile jbossas-remote-7\n    [DELTASPIKE-163] - preparations for v0.2\n\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-0.3-incubating.txt",
    "content": "Apache DeltaSpike-0.3-incubating Release Notes\n\nSub-task\n\n    [DELTASPIKE-38] - unit and integration tests for DeltaSpikeConfig\n    [DELTASPIKE-54] - review and discuss DefaultAnnotation\n    [DELTASPIKE-55] - review and discuss AnnotationInstanceProvider\n    [DELTASPIKE-62] - Discuss security module\n    [DELTASPIKE-74] - unit and integration tests for @Secured\n    [DELTASPIKE-75] - documentation for @Secured\n    [DELTASPIKE-77] - review and discuss Identity API\n    [DELTASPIKE-78] - review and discuss Authentication API\n    [DELTASPIKE-79] - review and discuss Authorization API\n    [DELTASPIKE-81] - review and discuss Identity Management\n    [DELTASPIKE-82] - review and discuss external authentication\n    [DELTASPIKE-84] - documentation for global alternatives\n    [DELTASPIKE-115] - documentation for @ConfigProperty\n    [DELTASPIKE-139] - documentation for @SecurityBindingType\n    [DELTASPIKE-143] - documentation for SecurityParameterBinding\n    [DELTASPIKE-147] - documentation for @MessageTemplate and @MessageBundle\n    [DELTASPIKE-150] - documentation for @MessageContextConfig - static usage\n    [DELTASPIKE-155] - documentation for Message and MessageContext - dynamic usage\n    [DELTASPIKE-160] - documentation for @ExceptionHandler\n    [DELTASPIKE-170] - documentation for AnnotationInstanceProvider\n    [DELTASPIKE-171] - unit and integration tests for AnnotationInstanceProvider\n    [DELTASPIKE-176] - unit and integration tests for @Transactional\n    [DELTASPIKE-177] - documentation for @Transactional\n    [DELTASPIKE-179] - unit and integration tests for @TransactionScoped\n    [DELTASPIKE-183] - unit and integration tests for TransactionHelper\n    [DELTASPIKE-184] - documentation for TransactionHelper\n    [DELTASPIKE-226] - unit and integration tests for minimal type-safe messages\n\nBug\n\n    [DELTASPIKE-145] - autom. check of license header in test files\n    [DELTASPIKE-166] - integration test module can't run tests with resources\n    [DELTASPIKE-167] - remove ReflectionUtil security methods\n    [DELTASPIKE-168] - fix build config\n    [DELTASPIKE-173] - @ConfigProperty for string properties\n    [DELTASPIKE-185] - Our @Transactional interceptor also tries to handle @PersistenceContexts\n    [DELTASPIKE-186] - doc is not up to date regarding configsource\n    [DELTASPIKE-189] - cdictrl/impl-openejb breaks the sonar build\n    [DELTASPIKE-191] - get rid of BeanManagerProvider#setTestMode()\n    [DELTASPIKE-196] - review ConfigProperty and Converter logic\n    [DELTASPIKE-199] - MessageBundle must only be used on interfaces\n    [DELTASPIKE-200] - handle configuration issues in MessageBundles as DefinitionErrors\n    [DELTASPIKE-205] - LocaleResolver#getLocale() doesn't get invoked\n    [DELTASPIKE-206] - NPE in OpenWebBeansContainerControl#getBeanManager\n    [DELTASPIKE-209] - ShrinkWrap.create(WebArchive.class,..)..addAsManifestResource(.., \"beans.xml\") not spec conform\n    [DELTASPIKE-211] - ExcludeExtension uses wrong observed event type\n    [DELTASPIKE-212] - replace ProcessAnnotatedType<Object> with ProcessAnnotatedType without type restriction\n    [DELTASPIKE-213] - move atinject-api, jcdi-api and interceptors-api dependencies to the container configuration\n    [DELTASPIKE-218] - ExceptionHandler observer chain is broken with same ordinal\n    [DELTASPIKE-231] - add multiple Resource Sources in the MessageContext\n    [DELTASPIKE-232] - Messages should be Serializable\n    [DELTASPIKE-233] - ClassUtils does unnecessary doPrivileged\n    [DELTASPIKE-235] - Always package categories to our unit test @Deployments\n    [DELTASPIKE-237] - implement shutdown hook for ConfigResolver\n    [DELTASPIKE-239] - Test failure for ConfigResolver on jdk7\n    [DELTASPIKE-240] - Security test failedLogin fails if executed after failedForcedReLogin\n    [DELTASPIKE-248] - missing check of EntityTransaction#getRollbackOnly in ResourceLocalPersistenceStrategy\n\nImprovement\n\n    [DELTASPIKE-96] - Give names to tests and shrinkwrap archives\n    [DELTASPIKE-161] - veto internal beans annotated with @Vetoed\n    [DELTASPIKE-172] - Improve BeanProvider\n    [DELTASPIKE-194] - enable examples build by default\n    [DELTASPIKE-197] - pickup ConfigSources via ServiceLoader as well\n    [DELTASPIKE-204] - AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's\n    [DELTASPIKE-216] - add the ability to specify other property config source from apache-deltaspike.properties file\n    [DELTASPIKE-221] - Rename README.txt into README or readme.md to allow markodwn syntax to be rendered on GitHub\n    [DELTASPIKE-225] - simplify fluent Message API\n    [DELTASPIKE-251] - SetAccessiblePrivilegedAction isn't needed without a SecurityManager\n    [DELTASPIKE-254] - the de-/activation logic for extensions should be unified\n    [DELTASPIKE-258] - improve the compatibility with new versions of weld\n\nNew Feature\n\n    [DELTASPIKE-111] - Add and review Seam Catch as a new DeltaSpike module\n    [DELTASPIKE-169] - AnnotationInstanceProvider\n    [DELTASPIKE-175] - @Transactional for EntityTransaction\n    [DELTASPIKE-178] - @TransactionScoped\n    [DELTASPIKE-182] - import TransactionalHelper from CODI\n    [DELTASPIKE-188] - defaultValue for @ConfigProperty\n    [DELTASPIKE-190] - Create ConfigurableDataSource\n    [DELTASPIKE-192] - BeanManagerProvider should warn User if called before the container got started\n    [DELTASPIKE-195] - create default-value handling for ConfigResolver\n    [DELTASPIKE-201] - move NarrowingBeanBuilder to API utils and rename it\n    [DELTASPIKE-215] - Add a new annotation to override the location of the apache-deltaspike.properties file\n    [DELTASPIKE-219] - @Transactional for JTA UserTransaction\n    [DELTASPIKE-222] - Add possibility to set base path\n    [DELTASPIKE-223] - Add convention for @MessageResource annotated types.\n    [DELTASPIKE-230] - Fallback stragtegy for resource bundles and locales\n    [DELTASPIKE-250] - persistence-strategy which is aware of the environment\n\nTask\n\n    [DELTASPIKE-13] - Choose documentation format and tools\n    [DELTASPIKE-33] - deltaspike website\n    [DELTASPIKE-76] - Discuss and review security features\n    [DELTASPIKE-87] - re-visit packaging issue\n    [DELTASPIKE-102] - review sonar findings\n    [DELTASPIKE-110] - Discuss adding Seam Catch to DeltaSpike\n    [DELTASPIKE-119] - review and discuss i18n module\n    [DELTASPIKE-140] - integration test module for the security module\n    [DELTASPIKE-174] - create jpa module\n    [DELTASPIKE-180] - [build] check for available plugin and version updates\n    [DELTASPIKE-181] - add Test Coverage reporting to our build\n    [DELTASPIKE-220] - update our test and build infrastructure for 0.3-incubating\n    [DELTASPIKE-224] - remove integration-test module and move container profiles to parent-code\n    [DELTASPIKE-236] - integration-test config for all modules\n    [DELTASPIKE-243] - change misleading name of PropertyConfigSource\n    [DELTASPIKE-244] - align naming of base classes\n    [DELTASPIKE-245] - Enable ProjectStage UnitTest for UnitTests\n    [DELTASPIKE-246] - Port Solder BeanBuilder to DeltaSpike\n    [DELTASPIKE-249] - cleanup of the security module\n    [DELTASPIKE-253] - rename PersistenceStrategy to TransactionStrategy\n    [DELTASPIKE-257] - align api/spi and impl package for parts related to transactions\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-0.4-incubating.txt",
    "content": "Apache DeltaSpike-0.4 Release Notes\n\n\nSub-task\n\n    [DELTASPIKE-10] - review and discuss \"metadata implementations and utils\"\n    [DELTASPIKE-80] - review and discuss built in Authorization providers\n    [DELTASPIKE-104] - unit and integration tests for CdiContainer\n    [DELTASPIKE-105] - remove workarounds for weld\n    [DELTASPIKE-113] - Review and Discuss ServiceHandlers\n    [DELTASPIKE-132] - Discuss the concept of the exception chain / stack\n    [DELTASPIKE-328] - Create ClientWindow API\n    [DELTASPIKE-329] - Create a WindowContextManager\n    [DELTASPIKE-330] - Create a new WindowScope to represent beans that are bound to a browser window\n\nBug\n\n    [DELTASPIKE-202] - DefaultMessageInterpolator/LocaleResolver doesn't get picked up properly\n    [DELTASPIKE-207] - memory leak in OpenWebBeansContextControl\n    [DELTASPIKE-208] - activateGlobalAlternatives is broken\n    [DELTASPIKE-260] - Weld serialization issue\n    [DELTASPIKE-262] - remove useless OWB workaround\n    [DELTASPIKE-264] - Exception handler swallows UnsatisfiedResolutionException\n    [DELTASPIKE-268] - our transitive deltaspike dependencies are all set to 'provided\n    [DELTASPIKE-275] - org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension#verifyInjectionPoints calls BeanProvider while cdi is not completely started\n    [DELTASPIKE-280] - ShrinkWrapArchiveUtil registers a picked up resource under the wrong absolute file path\n    [DELTASPIKE-284] - Deltaspike CDIControl won't work with Weld EE\n    [DELTASPIKE-286] - Comparators shall always also implement Serializable\n    [DELTASPIKE-290] - JSF message test fails due to localization issue\n    [DELTASPIKE-291] - @SecurityBindings don't respect parameter types of @SecureParameterBinding parameters when determining the authorization method\n    [DELTASPIKE-294] - Weld: Ambiguous dependency with global alternatives when multiple @Alternative classes\n    [DELTASPIKE-295] - JsfMessageProducer createJsfMessage return type should be parametrized\n    [DELTASPIKE-296] - Retrieving owb-CdiControl with BeanProvider causes Warning\n    [DELTASPIKE-297] - Exception handling and multiple qualifiers\n    [DELTASPIKE-299] - InvocationTargetException not unwrapped\n    [DELTASPIKE-300] - Basic MBean API/Extension to link CDI to JMX\n    [DELTASPIKE-303] - Missing cdi-api dependency in jbossas-remote-7 profile\n    [DELTASPIKE-309] - Locale-related test failure\n    [DELTASPIKE-312] - GlobalAlternatives must not get handled for OpenWebBeans\n    [DELTASPIKE-313] - allow cdictrl-openejb to use a different owb version in the build\n    [DELTASPIKE-317] - NPE if CdiContainer#getContextControl gets called without #boot\n    [DELTASPIKE-318] - OpenejbCdiControl tries to scan starting classes\n    [DELTASPIKE-319] - Fail deployment of app with JPA module when EM not found in same class.\n    [DELTASPIKE-320] - moving the entity-manager injection can break the default handling\n    [DELTASPIKE-321] - DefaultMessage.argument(Serializable...) should guard against empty arrays\n    [DELTASPIKE-322] - auto unregister MBeans if already registered\n    [DELTASPIKE-323] - auto unregister MBeans if already registered\n    [DELTASPIKE-327] - InvocationHandlerExtension Bean<?>s are not passivation capable\n    [DELTASPIKE-339] - JndiUtils is broken\n    [DELTASPIKE-343] - NPE in PartialBeanAsAbstractClassTest with Weld 2.0.0\n    [DELTASPIKE-348] - WindowScope stuff breaks ICEfaces\n    [DELTASPIKE-354] - NPE in MessageBundleInvocationHandler on null Argument\n    [DELTASPIKE-356] - MessageContextProducer causes a ton of log output on each request\n    [DELTASPIKE-359] - Websphere 8.0.x javaassist proxy does not reflect instance value\n    [DELTASPIKE-362] - BeanManagerProvider floods log file with warnings on AS7\n    [DELTASPIKE-363] - BeanManagerProvider NPE when shutting down after a failure\n    [DELTASPIKE-367] - upgrade owb-arquillian-container to 1.2.0\n\nImprovement\n\n    [DELTASPIKE-89] - Improve JavaDoc\n    [DELTASPIKE-165] - Exception handlers: support handling unexpected exceptions\n    [DELTASPIKE-234] - Go back through documentation for Exception Handling add in about equality and ordinal\n    [DELTASPIKE-255] - base class for extensions\n    [DELTASPIKE-273] - Provide a way to obtain all property names or map of properties\n    [DELTASPIKE-292] - @SecurityBindings don't respect parameter types of @SecureParameterBinding parameters when determining the authorization method\n    [DELTASPIKE-293] - Improve the ViewScopedContext by observing ServletContext and HttpSession lifecycle events.\n    [DELTASPIKE-298] - Post-Method-Authorizer\n    [DELTASPIKE-301] - Improve site layout to manage nested dirs\n    [DELTASPIKE-302] - Avoid same layout to maintain in different files/templates\n    [DELTASPIKE-310] - Support for TransactionAttributeType REQUIRE_NEW\n    [DELTASPIKE-314] - TransactionBeanStorage shouldn't be request scoped\n    [DELTASPIKE-316] - Upgrade to latest pax-cdi requirements for cdi extensions\n    [DELTASPIKE-326] - Introduce isScannable to ConfigSource\n    [DELTASPIKE-340] - Support PreViewConfigNavigateEvent for \"unknown\" views as nav-source\n    [DELTASPIKE-344] - BeanProvider should get a getBeans() with the BeanManager as parameter\n    [DELTASPIKE-355] - Create Alternative to DefaultMessageInterpolator using java.text.MessageFormat\n    [DELTASPIKE-365] - extend ContainerControl boot() to pass in config properties\n    [DELTASPIKE-369] - Disable WindowScope by default\n\nNew Feature\n\n    [DELTASPIKE-122] - producer for logger\n    [DELTASPIKE-187] - @PersistenceContext with @Transactional outside of application servers\n    [DELTASPIKE-210] - Build OSGi bundles\n    [DELTASPIKE-229] - Add JSFLocaleResolver as an DeaultLocaleResolver\n    [DELTASPIKE-266] - Import @ViewScoped support from CODI\n    [DELTASPIKE-267] - Create JSF module maven structure\n    [DELTASPIKE-274] - Create a common base for writing Contexts\n    [DELTASPIKE-277] - Typesafe Messgaes for JSF: add JsfMessage<?> feature\n    [DELTASPIKE-278] - add 'category' to Message API\n    [DELTASPIKE-279] - import JSF-Scope_to_CDI-Scope mapping from CODI\n    [DELTASPIKE-281] - add JsfLocaleResolver for our typesafe messages\n    [DELTASPIKE-283] - event-broadcasting related to a faces-request\n    [DELTASPIKE-288] - type-safe view-configs\n    [DELTASPIKE-289] - implement WindowContext\n    [DELTASPIKE-307] - integration of @Secured with type-safe view-configs\n    [DELTASPIKE-315] - Provide a producer for EntityManagerFactories\n    [DELTASPIKE-336] - support @Stereotype together with @ViewMetaData\n    [DELTASPIKE-345] - integration of view-controller callbacks with type-safe view-configs\n    [DELTASPIKE-346] - JsfModuleConfig as type-safe config for the jsf-module\n    [DELTASPIKE-347] - keep faces-messages per default in case of a redirect\n\nTask\n\n    [DELTASPIKE-2] - deltaspike java-se feature ranking\n    [DELTASPIKE-41] - add examples for v0.1\n    [DELTASPIKE-59] - review and discuss logging\n    [DELTASPIKE-68] - discuss BeanFilter for BeanProvider\n    [DELTASPIKE-88] - discuss Editable* spi approach\n    [DELTASPIKE-162] - add examples for v0.2\n    [DELTASPIKE-217] - test twitter bootstrap for DS site\n    [DELTASPIKE-242] - add examples for v0.3\n    [DELTASPIKE-276] - upgrade dependencies and plugins before the next release\n    [DELTASPIKE-325] - upgrade to owb-arquillian-standalone and owb 1.1.8\n    [DELTASPIKE-331] - create partial-bean module\n    [DELTASPIKE-333] - replace javassist with commons-proxy\n    [DELTASPIKE-337] - unify package for annotations\n    [DELTASPIKE-338] - remove hard dependency to javassist\n    [DELTASPIKE-351] - re-visit usage of DeltaSpikeConfig\n    [DELTASPIKE-352] - update dependencies for weld2\n    [DELTASPIKE-353] - restrict global alternatives to weld 1.x\n\nTest\n\n    [DELTASPIKE-247] - Create Identity Model\n    [DELTASPIKE-285] - MinimalMessagesTest fails on WLS12c\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-0.5.txt",
    "content": "Apache DeltaSpike-0.5 Release Notes\n\n\nThe following modules and big features got added in the DeltaSpike-0.5 release:\n\n* DeltaSpike-Data\n\nThe DeltaSpike Data module enhances JPA experience with declarative\nqueries, reducing boilerplate to a minimum. DeltaSpike Data repositories\ncan derive queries by simple method names, or by method annotations\ndefining JPQL, named queries or even plain SQL - beside result pagination\nand sorting. The module also features auditing of entities and a simplified\nalternative to the Criteria API.\n\n\n* DeltaSpike-Servlet\n\nThe DeltaSpike Servlet module provides integration with the Java Servlet\nAPI. It adds support for injection of common servlet objects\nand propagates servlet events to the CDI event bus.\n\n\n* DeltaSpike-BeanValidation\n\nThe main feature of the Bean Validation module is to provide\nCDI integration in to ConstraintValidators. This allows you to\ninject CDI objects, EJBs etc in to your validators.\n\n\n* The following issues got resolved in this release:\n\n\nSub-task\n\n    [DELTASPIKE-16] - review and discuss builders (metadata implementations)\n    [DELTASPIKE-387] - Create new bean-validation module\n    [DELTASPIKE-388] - Add support for a ConstraintValidatorFactory that creates CDI enabled constraint validators\n\nBug\n\n    [DELTASPIKE-380] - NPE in PartialBeanLifecycle if javassist not on classpath\n    [DELTASPIKE-381] - missing optional bean-lookup\n    [DELTASPIKE-384] - ViewConfigUtils.toNodeList() fails in EAR\n    [DELTASPIKE-385] - Spurious BeanManagerProvider warnings when used in EAR\n    [DELTASPIKE-394] - pom.xml files of the data-module aren't aligned with other modules\n    [DELTASPIKE-397] - MessageBundleInvocationHandler should ignore methods like hashCode() etc from Object.class\n    [DELTASPIKE-403] - MessageBundles are not PassivationCapable\n    [DELTASPIKE-405] - producer for JsfMessage<T> does not match CDI-1.1 rules\n    [DELTASPIKE-407] - Tests for Servlet module incorrectly packaged\n\nImprovement\n\n    [DELTASPIKE-332] - Discuss introducing BeanValidation support\n    [DELTASPIKE-360] - alternative LocaleResolver which is aware of supported locales\n    [DELTASPIKE-366] - basic test of properties usage in cdictrl openejb container\n    [DELTASPIKE-383] - use getProjectStageAwarePropertyValue in @ConfigProperty and other configuration places\n    [DELTASPIKE-390] - optional custom ConfigPreProcessor for @ViewMetaData\n    [DELTASPIKE-409] - Servlet module events should be deactivatable\n    [DELTASPIKE-410] - improve compatibility with mojarra\n\nNew Feature\n\n    [DELTASPIKE-375] - Create servlet module maven structure\n    [DELTASPIKE-376] - Propagation of basic servlet events to the CDI event bus\n    [DELTASPIKE-377] - Supporting injection of basic servlet objects\n    [DELTASPIKE-378] - ProjectStage-aware and Property-aware configuration\n    [DELTASPIKE-382] - mask out passwords and other credentials in our Configuration logs\n    [DELTASPIKE-398] - BeanProvider handling for @Dependent scoped beans\n\nTask\n\n    [DELTASPIKE-60] - Review and discuss a generic DAO API\n    [DELTASPIKE-401] - change GlobalAlternativeTest to work on Weld-2, Weld-1 and OWB\n    [DELTASPIKE-402] - Provide a way to skip tests depending on the CDI Container being used.\n    [DELTASPIKE-408] - WildFly test profile\n\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-0.6.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 0.6\n\nSub-task\n\n    [DELTASPIKE-252] - documentation for @Transactional with JTA\n\nBug\n\n    [DELTASPIKE-391] - Memory Leak in Data Module\n    [DELTASPIKE-414] - HttpServletRequest (and others) injection not working in servlet filters from web.xml\n    [DELTASPIKE-415] - Nested @Folder throws IllegalStateException\n    [DELTASPIKE-416] - @Folder's name check/resolution is broken\n    [DELTASPIKE-417] - EntityManagerResolver ignored\n    [DELTASPIKE-418] - EntityManagerResolver ignored\n    [DELTASPIKE-424] - EntityManagerResolver with normal scope is not supported\n    [DELTASPIKE-427] - WeldContainerControl throws a NullPointer before a null check.\n    [DELTASPIKE-434] - bean-lookup during ProcessAnnotatedType in RepositoryComponent\n    [DELTASPIKE-442] - PersistenceConfigurationProvider does not pick up any configuration yet\n    [DELTASPIKE-446] - Current windowhandler.js is incompatible with PrimeFaces\n    [DELTASPIKE-458] - UserTransaction is not always available in JNDI\n    [DELTASPIKE-463] - @ViewConfigRoot breaks view-configs added earlier\n    [DELTASPIKE-471] - support external handling of navigation-cases\n    [DELTASPIKE-484] - wrong handling of new contextual-storages in WindowBeanHolder#getContextualStorage\n    [DELTASPIKE-485] - WindowContext isn't injectable in passivation capable beans\n    [DELTASPIKE-486] - #destroy and #destroyAllActive of AbstractContext destroy entries without dropping them\n    [DELTASPIKE-489] - AbstractContext#getContextualStorage doesn't forward the current contextual\n    [DELTASPIKE-490] - WindowContextImpl#closeWindow doesn't destroy beans\n    [DELTASPIKE-493] - inconsistent handling in WindowContextImpl#closeWindow\n    [DELTASPIKE-501] - windowhandler.js also handles NONE and CUSTOM\n    [DELTASPIKE-507] - UserTransaction not available in WAS 8.0 and 8.5 during EJB CMT call\n    [DELTASPIKE-512] - Navigation happens twice if DeltaSpikeNavigationHandler is de-activated\n    [DELTASPIKE-513] - Transactional interceptor throws NPE for missing EntityManager\n    [DELTASPIKE-516] - ClientWindowHelper.handleInitialRedirect mutilates URL, pathInfo is omitted\n    [DELTASPIKE-518] - DS Data should support Wrapped JPA APIs\n    [DELTASPIKE-524] - preserve view-parameters\n    [DELTASPIKE-528] - stopContexts() and container shutdown() do not dispose of application scoped beans\n    [DELTASPIKE-529] - DeltaSpikeExceptionHandler construction issue in non EE\n    [DELTASPIKE-530] - deactivatable extensions\n    [DELTASPIKE-532] - DeltaSpikeFacesContextFactory construction issue in non EE\n    [DELTASPIKE-535] - DeltaSpikeViewHandler construction issue in non EE\n    [DELTASPIKE-541] - Remove errant source directory\n\nImprovement\n\n    [DELTASPIKE-341] - Provide Integration between Faces Exceptions and Exception Handling\n    [DELTASPIKE-373] - Provide an out of the box alternative for ClientWindowConfig\n    [DELTASPIKE-423] - limit inherited meta-data\n    [DELTASPIKE-425] - DependentProvider#destroy() must not destroy NormalScoped instances\n    [DELTASPIKE-429] - Old property that could be removed in parent\\pom.xml\n    [DELTASPIKE-431] - 'ordinal' for @JsfPhaseListener\n    [DELTASPIKE-432] - ClientWindow adapter for jsf 2.2\n    [DELTASPIKE-439] - ViewConfigs not residing in packages should be treated as a definition error\n    [DELTASPIKE-459] - add optional config \"testcontrol.stop_container\"\n    [DELTASPIKE-460] - @SkipMetaDataMerge for view-configs\n    [DELTASPIKE-461] - AccessDecisionVoterContext should contain view-meta-data in case of @Secured in combination with view-configs\n    [DELTASPIKE-464] - unify naming (Broadcaster vs Emitter)\n    [DELTASPIKE-465] - provide DefaultViewConfigInheritanceStrategy#addViewMetaData as protected method\n    [DELTASPIKE-467] - Add default module.xml for jboss modules.\n    [DELTASPIKE-478] - Create build profile in jenkins that creates binary distribution.\n    [DELTASPIKE-480] - view-config validation\n    [DELTASPIKE-495] - expose WindowContext as named bean\n    [DELTASPIKE-499] - Minify javascripts\n    [DELTASPIKE-502] - Finish LAZY ClientWindowRenderMode\n    [DELTASPIKE-504] - easier configuration of ClientWindowRenderMode\n    [DELTASPIKE-505] - change default ClientWindowRenderMode to LAZY\n    [DELTASPIKE-517] - improved weld-support\n    [DELTASPIKE-527] - @Named support for type-safe messages\n    [DELTASPIKE-531] - rename ExternalResource to InjectableResource\n    [DELTASPIKE-533] - Introduce a global deltaspike qualifier\n    [DELTASPIKE-534] - Replace @Web with @DeltaSpike\n    [DELTASPIKE-537] - test-utils jar should be added to deployed wars only if the test is a server test\n\nNew Feature\n\n    [DELTASPIKE-256] - allow custom timeout for the UserTransaction\n    [DELTASPIKE-263] - Generate binaries of DeltaSpike project\n    [DELTASPIKE-342] - config-annotations for test-runners to control CdiContainer and ContextControl\n    [DELTASPIKE-399] - Incorporate Solder's ResourceLoader features into DeltaSpike\n    [DELTASPIKE-426] - cdi support for jsf converters and validators\n    [DELTASPIKE-437] - window-timeout\n    [DELTASPIKE-438] - window quota handling\n    [DELTASPIKE-444] - provide an utility class for data mapper to avoid to reimplement loops each time\n    [DELTASPIKE-454] - Provide a ClientWindowRenderMode similiar to CODI\n    [DELTASPIKE-466] - ExternalContainer spi\n    [DELTASPIKE-468] - optional integration with myfaces-test\n    [DELTASPIKE-474] - support of Deactivatable for the ds-spi\n    [DELTASPIKE-475] - auto. registration of jobs with cron-expressions\n    [DELTASPIKE-487] - port @ViewAccessScoped from codi\n    [DELTASPIKE-488] - port grouped conversation scope from codi\n    [DELTASPIKE-491] - port @ConversationSubGroup from codi\n    [DELTASPIKE-492] - Create ExternalResourceProvider for the Servlet Module\n    [DELTASPIKE-500] - Implement ds:disableClientWindow\n    [DELTASPIKE-515] - optional adapter for MockedJsfTestContainer\n\nTask\n\n    [DELTASPIKE-118] - custom port for jbossas-build-managed-7\n    [DELTASPIKE-389] - Create documentation for the servlet module\n    [DELTASPIKE-428] - update build for weld 2.1.x\n    [DELTASPIKE-430] - re-visit DependentProvider\n    [DELTASPIKE-435] - upgrade arquillian adapter for glassfish3\n    [DELTASPIKE-447] - upgrade tests to tomee 1.6.0\n    [DELTASPIKE-455] - unify literal-packages\n    [DELTASPIKE-456] - wildfly-build-managed profile\n    [DELTASPIKE-477] - New Scheduler module is not included in binary distribution.\n    [DELTASPIKE-481] - Use unique archive names in Servlet module integration tests\n    [DELTASPIKE-483] - WildFly build-managed test profile\n    [DELTASPIKE-496] - Merge arquillian.xml files into a single one\n    [DELTASPIKE-497] - Create build-managed test profiles for Glassfish\n    [DELTASPIKE-503] - Add JSF playground module\n    [DELTASPIKE-523] - align event-packages\n    [DELTASPIKE-525] - move @Initialized and @Destroyed\n    [DELTASPIKE-526] - upgrade dependencies\n    [DELTASPIKE-536] - align creation of test-archives\n    [DELTASPIKE-539] - release notes for v0.6\n    [DELTASPIKE-540] - update notice file\n\nTest\n\n    [DELTASPIKE-476] - scheduler tests\n    [DELTASPIKE-479] - add tests with simple ear-packaging"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-0.7.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 0.7\n\nSub-task\n\n    [DELTASPIKE-156] - documentation for ContainerControl API\n\nBug\n\n    [DELTASPIKE-542] - Problem with JdbcJobstore\n    [DELTASPIKE-545] - DeltaSpikeExceptionHandler getRootCause assumes caught FacesException is wrapping another Exception\n    [DELTASPIKE-546] - NPE in observer method on Glassfish 4.x\n    [DELTASPIKE-548] - WELD-001408: Unsatisfied dependencies for type Scheduler<Job>\n    [DELTASPIKE-559] - ExceptionHandler lifecycle\n    [DELTASPIKE-566] - JSF always requires an active WindowContext\n    [DELTASPIKE-568] - Client Window cookie name is different on server and client side\n    [DELTASPIKE-573] - f:viewAction is executed twice with LAZY window handling mode\n    [DELTASPIKE-578] - org.apache.deltaspike.data.impl.meta.RepositoryComponent is not thread safe\n    [DELTASPIKE-581] - CountQueryPostProcessor assumes a where clause\n    [DELTASPIKE-583] - duplicated web-fragment.xml in test-archives\n    [DELTASPIKE-584] - ds:disableClientWindow prevents child rendering with CLIENTWINDOW mode\n    [DELTASPIKE-585] - HttpSession is not serializable\n\nImprovement\n\n    [DELTASPIKE-441] - provide a default implementation for the interface 'SecurityViolation'\n    [DELTASPIKE-445] - read ProjectStage also from a few other places\n    [DELTASPIKE-547] - merge ProxyUtils\n    [DELTASPIKE-550] - improve proxy detection\n    [DELTASPIKE-551] - allow full deactivation of DeltaSpikeNavigationHandler\n    [DELTASPIKE-554] - ContainerManagedTransactionStrategy\n    [DELTASPIKE-563] - Deactivatable support for PhaseListener\n    [DELTASPIKE-567] - Consistent post/get parameter naming\n    [DELTASPIKE-569] - Improve DeltaSpikeResourceHandler handling\n    [DELTASPIKE-572] - Remove Documentation TODOs\n    [DELTASPIKE-574] - Versioning for DeltaSpike JSF resources\n    [DELTASPIKE-576] - improved integration with view-controller\n    [DELTASPIKE-579] - extract annotation lookup\n    [DELTASPIKE-586] - optional forward compatibility for javax.interceptor.InvocationContext\n\nNew Feature\n\n    [DELTASPIKE-449] - ExceptionHandler not invoked for AccessDeniedException\n    [DELTASPIKE-560] - interceptor for @NavigationParameter\n    [DELTASPIKE-564] - optional double submit prevention\n\nTask\n\n    [DELTASPIKE-553] - improve the config for maven-compiler-plugin\n    [DELTASPIKE-556] - Impl-Weld tests: Unpacking causes ambiguous dependencies\n    [DELTASPIKE-587] - release notes for v0.7\n\nWish\n\n    [DELTASPIKE-555] - Do not use package-private methods in CDI beans"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.0.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.0.0\n\nSub-task\n\n    [DELTASPIKE-227] - documentation for minimal type-safe messages\n\nBug\n\n    [DELTASPIKE-370] - ContainerCtrlTckTest - fix testShutdownWithInactiveContexts()\n    [DELTASPIKE-372] - WeldContainerControl should stop contexts during shutdown\n    [DELTASPIKE-543] - org.apache.deltaspike.distribution is disconnected\n    [DELTASPIKE-590] - ExceptionHandlerBroadcaster should not rethrow exceptions from BridgeExceptionHandlerWrapper\n    [DELTASPIKE-595] - broken assembly config\n    [DELTASPIKE-597] - Use correct names of brands and products in documentation\n    [DELTASPIKE-609] - @Transactional for methods in super-class(es)\n    [DELTASPIKE-618] - NullPointerException when trying to schedule job manually\n    [DELTASPIKE-624] - inconsistent package naming\n    [DELTASPIKE-629] - Initial redirect fails behind proxy/fw/apache redirects\n    [DELTASPIKE-639] - Fix Criteria API count methods signatures\n\nImprovement\n\n    [DELTASPIKE-396] - ShrinkWrapArchiveUtil creates jar files with random names\n    [DELTASPIKE-596] - use optional flag for ExceptionToCatchEvent\n    [DELTASPIKE-598] - TestAware as optional contract for implementations of ExternalContainer\n    [DELTASPIKE-601] - legacy support for ViewConfigPathValidator\n    [DELTASPIKE-602] - forward manual request-handling to myfaces-test adapters\n    [DELTASPIKE-606] - Simplified DTO mapping for Entity updates\n    [DELTASPIKE-607] - Add EntityManagerDelegate<E> interface to API\n    [DELTASPIKE-611] - @Exclude on abstract classes\n    [DELTASPIKE-612] - optional ConfigurableNavigationHandlerWrapper for jsf v2.2+\n    [DELTASPIKE-614] - @Named support for ExecutableCallbackDescriptor\n    [DELTASPIKE-617] - Utility Method for TypedQuery in AbstractEntityRepository\n    [DELTASPIKE-621] - DeltaSpikeResourceHandler should implement Deactivatable\n    [DELTASPIKE-626] - ensure valid application wrapper chain\n    [DELTASPIKE-630] - JsfSupportedLocaleAwareLocaleResolver should be the default LocaleResolver for the jsf module\n    [DELTASPIKE-631] - improve supported-locale check\n    [DELTASPIKE-636] - @Secures should trigger the ds-exception-handler\n\nNew Feature\n\n    [DELTASPIKE-514] - optional integration with myfaces-core 2.2\n    [DELTASPIKE-593] - support for mocked cdi-beans\n    [DELTASPIKE-608] - @Transactional#readOnly\n    [DELTASPIKE-628] - support for the configured message-bundle in faces-config.xml\n    [DELTASPIKE-632] - CdiAwareJobFactory\n\nTask\n\n    [DELTASPIKE-306] - Examples for the features of the JSF module\n    [DELTASPIKE-589] - Support WLS Profile in Data Module\n    [DELTASPIKE-592] - merge back release branch 'deltaspike-0.7'\n    [DELTASPIKE-610] - re-visit DataSourceConfig\n    [DELTASPIKE-615] - create list of undocumented api classes\n    [DELTASPIKE-616] - update build config for v1\n    [DELTASPIKE-619] - update version numbers of dependencies\n    [DELTASPIKE-622] - improve profile \"wildfly-build-managed\"\n    [DELTASPIKE-644] - release notes for v1.0.0\n\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.0.1.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.0.1\n\nBug\n\n    [DELTASPIKE-470] - Releases must be distributed via the ASF mirror system\n    [DELTASPIKE-648] - @ConfigProperty in Wildfly 8.1 not working correctly\n    [DELTASPIKE-650] - Custom JSF Converters/Validators error\n    [DELTASPIKE-656] - Concurrency Problem when using QuartzScheduler\n    [DELTASPIKE-661] - No custom quartz-config file found after upgrade to 1.0.0\n    [DELTASPIKE-664] - SecurityViolation are evaluated twice for redirect pages with configured errorView\n\nImprovement\n\n    [DELTASPIKE-599] - CDI 1.1 friendly ViewConfig discovery\n    [DELTASPIKE-651] - Support for disabling scope activation globally\n    [DELTASPIKE-654] - veto converters and validators without injection-points or scope\n    [DELTASPIKE-658] - improved @Stereotype support for @ViewMetaData\n\nTask\n\n    [DELTASPIKE-520] - test proxy handling\n    [DELTASPIKE-638] - re-visit inconsistent handling of @BeforeHandles\n    [DELTASPIKE-646] - Please delete old releases from mirroring system\n    [DELTASPIKE-655] - create ee6 only version of the jsf module\n    [DELTASPIKE-657] - create simple scheduler example\n    [DELTASPIKE-663] - force AccessDeniedException per default\n    [DELTASPIKE-667] - update jsf demo\n    [DELTASPIKE-668] - release notes for v1.0.1\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.0.2.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.0.2\n\nBug\n\n    [DELTASPIKE-637] - duplicated handling of AccessDeniedException\n    [DELTASPIKE-672] - Wrong Bean Validation artifactId on documentation\n    [DELTASPIKE-679] - NPE in BeanManagerProvider if parentClassLoader is null\n    [DELTASPIKE-681] - Handling AccessDeniedException will run the secured method\n    [DELTASPIKE-684] - No OSGi headers in deltaspike-partial-bean-module-api\n    [DELTASPIKE-685] - Guard against null FacesContext in Exception Handler Bridge\n\nImprovement\n\n    [DELTASPIKE-506] - [perf] use a shared StringBuilder\n    [DELTASPIKE-509] - [perf] cache map in DefaultClientWindow#getQueryURLParameters\n    [DELTASPIKE-653] - Provide a platform inspecific servlet listener\n    [DELTASPIKE-665] - Add utility method to always get new context control.\n    [DELTASPIKE-666] - Improve BeanManager consistency\n    [DELTASPIKE-669] - Try to shutdown contexts when shutting down container\n    [DELTASPIKE-676] - ServletContext is available for injection before EventBridgeContextListener\n\nTask\n\n    [DELTASPIKE-641] - Document prevent double submit feature\n    [DELTASPIKE-689] - release notes for v1.0.1\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.0.3.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.0.3\n\nBug\n\n    [DELTASPIKE-696] - Remove unneeded dependencies on CDICtrl Servlet\n    [DELTASPIKE-706] - Multiple CDI API versions on classpath in JSF module tests (Weld)\n    [DELTASPIKE-710] - Error using clientWindow and (p|f):ajax\n    [DELTASPIKE-717] - Exception handlers not invoked when @Secured ViewConfig is violated in an app with JSF module without a DefaultErrorView page\n    [DELTASPIKE-719] - Only one voter invoked if multiple voters are applied through a stereotype\n    [DELTASPIKE-723] - Exception bypassing on JSF conversion errors\n    [DELTASPIKE-726] - Lazy window handling doesn't recognize new windows anymore\n    [DELTASPIKE-729] - f:viewAction is executed twice with LAZY window handling mode\n\nImprovement\n\n    [DELTASPIKE-692] - workaround for tests which don't use optional classes\n    [DELTASPIKE-699] - Signature relaxing of attribute method() in CriteriaSupport\n    [DELTASPIKE-708] - Veto the AbstractEntityRepository class\n    [DELTASPIKE-712] - BeanManagerProvider : Wrap usage in parent class loaders\n\nNew Feature\n\n    [DELTASPIKE-702] - Add support to GreaterThan and LessThan in criteria to dates\n\nTask\n\n    [DELTASPIKE-640] - Document Scopes in Core module\n    [DELTASPIKE-677] - document ds-security in combination with picketlink\n    [DELTASPIKE-697] - Set the baseDir to reside in the target directory for tomcat tests.\n    [DELTASPIKE-698] - re-visit glassfish4 profile\n    [DELTASPIKE-711] - Create placeholder documentation directory\n    [DELTASPIKE-716] - Migrate documentation format to asciidoc at git repo\n    [DELTASPIKE-730] - release notes for v1.0.3"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.1.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.1.0\n\nBug\n\n    [DELTASPIKE-732] - Servlet API module needs beans.xml\n    [DELTASPIKE-733] - Documentation: CSS missing for https\n    [DELTASPIKE-736] - MockAwareInjectionTargetWrapper breaks interceptors in unit tests\n    [DELTASPIKE-738] - ViewConfigTest relies on ordering of elements in a HashSet\n    [DELTASPIKE-739] - BeanBuilder#readFromType should respect @Typed\n    [DELTASPIKE-742] - validateBindings fails with owb for secured-stereotypes with values\n    [DELTASPIKE-744] - check is-prefix of converter-/validator-methods\n    [DELTASPIKE-748] - Fix DS Security AbstractAccessDecisionVoter documentation\n    [DELTASPIKE-752] - ensure a secure maximum length of the window-id\n    [DELTASPIKE-753] - Initial redirect does not encode URL\n    [DELTASPIKE-754] - Empty dswid-paramter causes infinite redirects\n    [DELTASPIKE-757] - Create tests for WindowContextQuotaHandler\n    [DELTASPIKE-764] - missing cleanup in EmbeddedServletContainer\n\nImprovement\n\n    [DELTASPIKE-544] - api for a fine-grained control of @ViewAccessScoped beans\n    [DELTASPIKE-735] - allow multiple stereotypes annotated with @Secured\n    [DELTASPIKE-755] - cache proxy to ViewConfigResolver\n    [DELTASPIKE-763] - check usage of disabled feature\n\nNew Feature\n\n    [DELTASPIKE-751] - WindowContextQuotaHandler\n\nTask\n\n    [DELTASPIKE-725] - tests for converter/validator injection\n    [DELTASPIKE-741] - set default version of tomee to 1.7.0\n    [DELTASPIKE-758] - Document WindowContextQuotaHandler\n    [DELTASPIKE-761] - mocked producers can't be portable in any case\n    [DELTASPIKE-762] - disable mock-support per default\n    [DELTASPIKE-765] - release notes for v1.1.0\n\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.2.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.2.0\n\nBug\n\n    [DELTASPIKE-745] - cdictr-weld ContextControl.startContext doesn't properly start RequestScoped context\n    [DELTASPIKE-749] - Doc: Security: Making intitially requested and secured page available for redirect after login\n    [DELTASPIKE-750] - No error message if the filename provided PropertyFileConfig implementation isn't found.\n    [DELTASPIKE-771] - BeanManagerProvider#getBeanManagerInfo(ClassLoader) wipes out info for parent CL\n    [DELTASPIKE-781] - AnnotatedTypeImpl doesn't work for Annotation AnnotatedType\n    [DELTASPIKE-782] - BeanManager lookup fails when BeanManager created in parent classloader and in SE mode\n\nImprovement\n\n    [DELTASPIKE-770] - Overload BeanProvider#getContextualReference with (BeanManager, String, boolean. Class) variant\n    [DELTASPIKE-773] - improved testability of @WindowScoped beans\n    [DELTASPIKE-780] - support more advanced cases by extending existing transaction-strategies\n    [DELTASPIKE-785] - Make CdiTestRunner pick up container configuration from properties file\n    [DELTASPIKE-789] - ClientWindowConfig should extend Serializable\n    [DELTASPIKE-790] - cache result for JsfModuleConfig#isDelegatedWindowHandlingEnabled\n\nNew Feature\n\n    [DELTASPIKE-769] - add @Priority dyn. to deltaspike interceptors to avoid the manual config\n    [DELTASPIKE-772] - use CDI#current if supported\n    [DELTASPIKE-774] - map javax.faces.bean.ViewScoped to javax.faces.view.ViewScoped\n    [DELTASPIKE-776] - check correct module usage\n\nTask\n\n    [DELTASPIKE-649] - re-visit wls profile\n    [DELTASPIKE-767] - Review javadoc in core/api\n    [DELTASPIKE-777] - Create and publish Javadocs section\n    [DELTASPIKE-778] - add duke's choice award badge to the site\n    [DELTASPIKE-786] - migrate documentation about release preparation to asciidoc\n    [DELTASPIKE-791] - release notes for v1.2.0\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.2.1.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.2.1\n\nSub-task\n\n    [DELTASPIKE-796] - test view-actions in combination with @ViewAccessScoped\n\nBug\n\n    [DELTASPIKE-400] - BeanBuilder should set the bean of the InjectionPoints\n    [DELTASPIKE-792] - Fix javadoc -Xdoclint:none for JDK < 8\n    [DELTASPIKE-795] - ViewAccessScope gets destroyed in combination with f:viewAction\n    [DELTASPIKE-799] - Do not depend on Weld uberjar\n    [DELTASPIKE-800] - Update documentation to 1.2.0\n    [DELTASPIKE-801] - Security: SecurityParameterValueRedefiner doesnt recognize @Nonbinding\n\nImprovement\n\n    [DELTASPIKE-588] - Repositories from Data module should be deactivatable\n    [DELTASPIKE-660] - OSGi support for DeltaSpike Data and its dependencies\n    [DELTASPIKE-690] - Documentation donation from RedHat\n    [DELTASPIKE-722] - Migrate non-documentation pages from markdown to asciidoc\n    [DELTASPIKE-775] - provide a type-safe approach for low-level configs\n    [DELTASPIKE-798] - Support for uber-jar creation in SE support\n\nTask\n\n    [DELTASPIKE-635] - Document last TODOs in the JSF module documentation\n    [DELTASPIKE-794] - update release steps\n    [DELTASPIKE-797] - deploy javadoc for v1.2.0 to the cms\n    [DELTASPIKE-802] - update OWB and Weld to use the latest CDI-1.0 compatible versions by default\n    [DELTASPIKE-803] - exclude ee7 tests for ee6 servers\n    [DELTASPIKE-804] - prepare v1.2.1"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.3.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.3.0\n\nNew Feature\n\n    [DELTASPIKE-419] - Interceptors on partial beans\n    [DELTASPIKE-420] - Transactional repositories\n    [DELTASPIKE-837] - PropertyFileConfig pickup via java.util.ServiceLoader\n    [DELTASPIKE-841] - make getConfigSources public\n    [DELTASPIKE-842] - pick up ConfigFilters via ServiceLoader\n\nBug\n\n    [DELTASPIKE-647] - AppScoped abstract repositories doesn't work\n    [DELTASPIKE-714] - QueryResult.count not work if jpql have order by\n    [DELTASPIKE-746] - Doc: JSF/ExceptionControl integration redirect example\n    [DELTASPIKE-808] - Make website to read pom.xml properties\n    [DELTASPIKE-812] - remove AttributeAware\n    [DELTASPIKE-814] - Create a root pom.xml to share common properties\n    [DELTASPIKE-818] - CDI Events with reception condition in WindowScoped beans\n    [DELTASPIKE-825] - Scheduler docs mention wrong method scheduleJob\n    [DELTASPIKE-828] - Infinite recursive loop navigating through annoations\n    [DELTASPIKE-831] - NPE in DefaultMockFilter when running JUnit and the application contains a class in the default package\n    [DELTASPIKE-834] - MessageBundle Extension not working in EARs on some containers\n    [DELTASPIKE-838] - SchedulerExtension: Multiple Job-Classes found with name\n\nImprovement\n\n    [DELTASPIKE-805] - Provide utils method to check if an context is active or not\n    [DELTASPIKE-829] - add hints for using jersey-test with test-control\n    [DELTASPIKE-835] - Improve build config and add tests\n    [DELTASPIKE-836] - Support case insensitive LIKE queries with method naming convention\n    [DELTASPIKE-840] - ConfigResolver#getConfigFilters() shall return unmutable List\n\nTask\n\n    [DELTASPIKE-806] - update site to 1.2.1\n    [DELTASPIKE-807] - update external resources\n    [DELTASPIKE-810] - improve site headers\n    [DELTASPIKE-811] - document custom project-stages\n    [DELTASPIKE-815] - Publish 1.2.1 Javadoc\n    [DELTASPIKE-821] - check compatibility with gradle\n    [DELTASPIKE-823] - Reimplement Partial-Bean module\n    [DELTASPIKE-845] - prepare v1.3.0"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.4.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.4.0\n\nBug\n\n    [DELTASPIKE-822] - Repository method lookup in super interfaces\n    [DELTASPIKE-830] - Now active ViewAccessScoped context during restore view phase\n    [DELTASPIKE-832] - Javascript assert windowId not resilient enough\n    [DELTASPIKE-833] - BeanManagerProvider Log Flood\n    [DELTASPIKE-847] - java.util.Properties Provider does not close InputStream after usage\n    [DELTASPIKE-849] - InjectableResourceProducer does not close InputStreams\n    [DELTASPIKE-854] - Jacoco profile doesn't work anymore\n    [DELTASPIKE-859] - Injection of @Named @MessageBundle works only with @Named injection point\n    [DELTASPIKE-860] - documentation says \"@LoggedIn User user\", but that's impossible\n    [DELTASPIKE-863] - NPE when invoking proxy for custom jsf converter\n    [DELTASPIKE-867] - Clarify that Test-Control module has manual dependencies on CDI implementations\n    [DELTASPIKE-869] - Minor typos on test-control asciidoc\n    [DELTASPIKE-870] - Partial Bean with signed jar trouble.\n    [DELTASPIKE-876] - Website navigation bar active tab highlighting broken\n    [DELTASPIKE-884] - PropertyFileConfig shouldn't implement DeltaSpikeConfig\n    [DELTASPIKE-889] - ValidatorWrapper causes filtering of multiple custom validators in ValidatorTagHandler\n    [DELTASPIKE-893] - Remove erroneous WarpTest annotation and Warp dependency from JSF impl tests\n    [DELTASPIKE-899] - Build fail for OWB15\n\nImprovement\n\n    [DELTASPIKE-809] - Clean up cdi ctrl and cdi imp pages\n    [DELTASPIKE-846] - Docs: Clarify that scheduler module has manual dependencies\n    [DELTASPIKE-852] - fix naming of type-safe configs\n    [DELTASPIKE-855] - Review deltaspike-release-plugin and distribution profile to not consider deltaspike-root\n    [DELTASPIKE-857] - [perf] skip method interception if no interceptors defined\n    [DELTASPIKE-873] - show error-message on the same page\n    [DELTASPIKE-875] - HTTPS support for site and documentation\n    [DELTASPIKE-878] - AnnotationUtils should support literal instances\n    [DELTASPIKE-879] - use @Priority for global-alternatives\n    [DELTASPIKE-880] - Restrict initial redirect to GET requests\n    [DELTASPIKE-881] - align invocation order of @PreRenderView with jsf\n    [DELTASPIKE-882] - Create a new module for proxy\n    [DELTASPIKE-885] - Static DeltaSpike configuration should be easy to find in code base\n    [DELTASPIKE-886] - Add ignoreCase() to the criteria API\n    [DELTASPIKE-891] - check for InvocationTargetException in ExecutableCallbackDescriptor\n    [DELTASPIKE-896] - improve the warning in ViewConfigPathValidator\n\nNew Feature\n\n    [DELTASPIKE-420] - Transactional repositories\n    [DELTASPIKE-874] - observe @javax.faces.bean.RequestScoped via @jakarta.enterprise.context.Initialized and @jakarta.enterprise.context.Destroyed\n    [DELTASPIKE-877] - allow to inherit dynamically changed metadata\n    [DELTASPIKE-888] - Add support for delete a job from the Scheduler\n    [DELTASPIKE-892] - type-safe static config\n\nTask\n\n    [DELTASPIKE-850] - Add Weld 3 profile\n    [DELTASPIKE-862] - document JsfMessage\n    [DELTASPIKE-903] - prepare v1.4.0"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.4.1.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.4.1\n\nBug\n\n    [DELTASPIKE-594] - Memory leak in RepositoryComponents singleton\n    [DELTASPIKE-901] - org.apache.deltaspike.data.impl.builder.postprocessor.CountQueryPostProcessor doesn't respect order by\n    [DELTASPIKE-905] - Missing OSGi headers in Proxy modules\n    [DELTASPIKE-908] - org.apache.deltaspike.test.scheduler.custom.CustomSchedulerWarFileTest fails with Weld\n    [DELTASPIKE-915] - Transactional#readOnly needs to be @Nonbinding\n    [DELTASPIKE-917] - EnvironmentAwareTransactionStrategy fails in unmanaged threads\n\nImprovement\n\n    [DELTASPIKE-603] - removeBy* - similiar to findBy*\n    [DELTASPIKE-911] - Criteria API - Add support for accept multiple columns in orderBy\n    [DELTASPIKE-913] - QuartzScheduler uses BeanProvider.getContextualReference() for dependent scoped bean\n    [DELTASPIKE-919] - higher priority for dynamic navigation-parameters\n    [DELTASPIKE-924] - Adjust The AbstractEntityRepository Class section.\n\nNew Feature\n\n    [DELTASPIKE-700] - Add #tableName() to AbstractEntityRepository\n    [DELTASPIKE-701] - Add method in EntityRepository to merge a detached entity and remove it\n    [DELTASPIKE-894] - Trim for CriteriaSupport API\n    [DELTASPIKE-923] - Add #entityName() to AbstractEntityRepository\n\nTask\n\n    [DELTASPIKE-816] - document usage of multiple entity-managers\n    [DELTASPIKE-909] - Site/Docs/Javadoc Release procedures for DS 1.4\n    [DELTASPIKE-916] - Weld 2.3 and 3.x support\n    [DELTASPIKE-925] - prepare v1.4.1\n\nTest\n\n    [DELTASPIKE-902] - Test for EntityRepository#removeAndFlush(entity)"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.4.2.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.4.2\n\nBug\n\n    [DELTASPIKE-830] - windowhandling doesn't work correctly when onload defined on h:body\n    [DELTASPIKE-887] - ds:windowId should initialize the windowhandler script\n    [DELTASPIKE-929] - Weld test profile is broken\n    [DELTASPIKE-930] - Fix data module tests on GF\n    [DELTASPIKE-931] - Integration tests fail when dependencies are class folders, not JARs\n    [DELTASPIKE-939] - dswid=tempWindowId for every duplicated tab in Chrome/Firefox\n    [DELTASPIKE-941] - JPA link broken in Data Module documentation\n    [DELTASPIKE-947] - StackOverFlow with DELEGATED window mode and undefined javax.faces.CLIENT_WINDOW_MODE\n    [DELTASPIKE-954] - CLIENTWINDOW windowhandler.html contains unreplaced variable\n    [DELTASPIKE-958] - remove outdated information\n    [DELTASPIKE-959] - DS cuts the windowId generated from JSF 2.2\n    [DELTASPIKE-960] - WindowIdHtmlRenderer needs to use maxWindowIdCount for window-id cookies\n\nImprovement\n\n    [DELTASPIKE-673] - CdiQueryInvocationContext#isNew does not work well with OpenJpa and detached entities\n    [DELTASPIKE-932] - Refactor ClientWindow server side\n    [DELTASPIKE-933] - Upgrade to Arquillian 1.1.8.Final\n    [DELTASPIKE-934] - @Query metadata should be considered for any method expression\n    [DELTASPIKE-935] - ds:disableClientWindow should also disable JSF 2.2 rendering mode\n    [DELTASPIKE-945] - Verify WildFly 9 profile\n    [DELTASPIKE-946] - Prevent jfwid rendering\n    [DELTASPIKE-948] - CdiQueryInvocationContext#isNew isn't portable across jpa providers\n    [DELTASPIKE-949] - RequestResponseHolderListener should be deactivatable\n    [DELTASPIKE-950] - RequestResponseHolderListener fails if requestInitialized() is called more than once\n    [DELTASPIKE-951] - validate the content of TestControl#startScopes\n    [DELTASPIKE-953] - Refactor ClientWindow client side\n\nNew Feature\n\n    [DELTASPIKE-904] - Stereotype support for interceptor binding lookup on partial beans\n    [DELTASPIKE-910] - Add EntityRepository.getPrimaryKey(E entity)\n    [DELTASPIKE-922] - OSGi support for Security Module\n\nTask\n\n    [DELTASPIKE-961] - prepare v1.4.2"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.5.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.5.0\n\nBug\n\n    [DELTASPIKE-963] - Header injection due to unescaped key in JsfUtils\n    [DELTASPIKE-965] - EntityRepository.save() is broken for entities with String ID\n    [DELTASPIKE-971] - CLIENTWINDOW mode broken in IE10\n\nImprovement\n\n    [DELTASPIKE-613] - Avoid windowhandler.html in GET requests from links\n    [DELTASPIKE-817] - API and Core contain types recognized as managed beans but declaring an illegal bean type\n    [DELTASPIKE-853] - Use @Stereotype for interface/enum/implicit bean discovery\n    [DELTASPIKE-897] - check configuration of a ClassDeactivator\n    [DELTASPIKE-928] - Allow to disable storeWindowTree() on ClientWindow mode\n    [DELTASPIKE-942] - DeltaSpike fails to start with corrupted persistence.xml file.\n    [DELTASPIKE-962] - Refactor windowhandler.html\n    [DELTASPIKE-966] - Document ClientWindow configuration\n    [DELTASPIKE-968] - ClientWindowMode shows white loading page for button navigation\n    [DELTASPIKE-969] - Minor doc fixes around data module.\n    [DELTASPIKE-972] - Center windowhandler.html messages\n    [DELTASPIKE-973] - Fixed method name in Configuration doc\n    [DELTASPIKE-975] - dependent-scoped EntityManagerResolver get destroyed too early\n\nTask\n\n    [DELTASPIKE-964] - Publish Javadoc 1.4.2\n    [DELTASPIKE-980] - prepare v1.5.0"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.5.1.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.5.1\n\nBug\n\n    [DELTASPIKE-978] - ClassCastException with Native Queries\n    [DELTASPIKE-984] - DynamicMBeanWrapper throws misleading MBeanException saying that the required action does not exist when MBean method (deliberately) throws an exception\n    [DELTASPIKE-985] - It's not possible to run tests against latest WildFly\n    [DELTASPIKE-990] - BeanBuilder#readFromType drops java.lang.Object as type\n    [DELTASPIKE-993] - Disabled initialRedirect is generating dswid=null\n    [DELTASPIKE-994] - MessageBundleExtension: NPE on Shutdown\n    [DELTASPIKE-997] - org.apache.deltaspike.data.impl.meta.unit.PersistenceUnitsTest fails on weblogic\n    [DELTASPIKE-999] - several tests failing on weblogic due to missing org.quartz.utils package\n    [DELTASPIKE-1002] - NPE when job startScopes is set to empty\n\nImprovement\n\n    [DELTASPIKE-986] - support for atomikos\n    [DELTASPIKE-987] - check for @Version\n    [DELTASPIKE-991] - javax.interceptor.Interceptor.Priority.PLATFORM_BEFORE is used per default\n    [DELTASPIKE-992] - optional support for bv 1.1\n    [DELTASPIKE-1001] - Skip caching ClassDeactivation for some project stages\n    [DELTASPIKE-1004] - unified base-implementation for InvocationContext\n    [DELTASPIKE-1008] - Introduce @MBean.type() to customize type in JMX bean objectName\n\nNew Feature\n\n    [DELTASPIKE-955] - Built in class deactivator\n    [DELTASPIKE-1003] - support @Produces in partial-beans\n    [DELTASPIKE-1005] - @Transactional and @TransactionScoped support for @Repository\n\nTask\n\n    [DELTASPIKE-952] - Document Proxy Module\n    [DELTASPIKE-956] - Clearly document transaction integration patterns for repository classes\n    [DELTASPIKE-979] - Document new ClientWindowConfig modes\n    [DELTASPIKE-981] - update site and javadoc to 1.5.0\n    [DELTASPIKE-983] - Investigate issue with DeltaSpike Validation Module\n    [DELTASPIKE-995] - Define a weblogic managed profile for arquillian tests\n    [DELTASPIKE-998] - many deltaspike/modules/data/impl tests fail on weblogic.\n    [DELTASPIKE-1000] - prepare v1.5.1"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.5.2.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.5.2\n\nBug\n\n    [DELTASPIKE-839] - Data module test deployments pack individual classes instead of JARs\n    [DELTASPIKE-1009] - unknown repository class\n    [DELTASPIKE-1014] - SecuredAnnotationAuthorizer overwrites method-level annotation metadata with class-level annotation metadata\n    [DELTASPIKE-1016] - JSF documentation broken\n    [DELTASPIKE-1024] - WindowHandler: Loading... not displayed in initial request in new tab\n    [DELTASPIKE-1026] - WindowHandler: Loading... not displayed in IE8\n    [DELTASPIKE-1027] - WindowHandler: \"screenshot\" still clickable in IE8\n    [DELTASPIKE-1028] - WindowHandler: JS error on IE8\n    [DELTASPIKE-1034] - DefaultEntityManagerHolder is not Serializeable\n\nImprovement\n\n    [DELTASPIKE-989] - Document ClientWindow modes more detailed\n    [DELTASPIKE-1015] - Support hierarchical BeanManager and Extensions\n    [DELTASPIKE-1017] - spi for config-validation\n    [DELTASPIKE-1019] - Enterprise container friendlier deltaspike-cdictrl-weld\n    [DELTASPIKE-1021] - Enhance documentation for JSF module\n    [DELTASPIKE-1025] - WindowHandler: Remember every body attr for the windowhandler.html\n    [DELTASPIKE-1029] - WindowHandler: Avoid windowhandler streaming in some redirect cases\n    [DELTASPIKE-1031] - Update profiles for Wildfly\n\nNew Feature\n\n    [DELTASPIKE-1023] - WindowHandling: refactor screenshot handling/remember scroll position\n    [DELTASPIKE-1035] - Make DS PersistenceUnit public and also parse properties\n\nTask\n\n    [DELTASPIKE-982] - improve internal description of our release-steps\n    [DELTASPIKE-1011] - re-visit excluded tests for the wls profiles\n    [DELTASPIKE-1012] - update site and javadoc to 1.5.1\n    [DELTASPIKE-1013] - remove outdated content\n    [DELTASPIKE-1020] - improve core documentation\n    [DELTASPIKE-1038] - prepare v1.5.2"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.5.3.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.5.3\n\nBug\n\n    [DELTASPIKE-1039] - LinkageError on container reboot\n    [DELTASPIKE-1043] - Loop redirect in error-page (404) with CLIENTWINDOW\n    [DELTASPIKE-1044] - ClientWindow - skip links with \"empty\" href\n    [DELTASPIKE-1046] - wildfly-remote profile is broken\n    [DELTASPIKE-1050] - EntityManagerLookup isn't thread-safe\n    [DELTASPIKE-1057] - Fix type parameters of OrderBy query processor\n    [DELTASPIKE-1061] - custom annotation member values\n    [DELTASPIKE-1063] - ClientWindow - StoreWindowTreeEnabledOnButtonClick prevents defined onclick\n    [DELTASPIKE-1071] - URLs like ?&dswid=XYZ lead to window cloning\n\nImprovement\n\n    [DELTASPIKE-1040] - ClassDeactivationUtils spams the log in ProjectStages Development and UnitTest\n    [DELTASPIKE-1048] - Fix compiler warnings in Data module\n    [DELTASPIKE-1049] - Avoid bean serializations / use ApplicationScoped instead Dependent for performance reasons\n    [DELTASPIKE-1055] - JobRunnableAdapter should be pluggable\n    [DELTASPIKE-1058] - add info in case of a global-alternative\n    [DELTASPIKE-1059] - integrate @Scheduled Runnable with exception-control\n    [DELTASPIKE-1062] - @Transactional and @TransactionScoped support for @Repository including qualifiers\n    [DELTASPIKE-1065] - improve build-config per profile\n    [DELTASPIKE-1072] - improve wls12 test-profiles\n\nNew Feature\n\n    [DELTASPIKE-1045] - Convenience repository classes exposing all EntityManager methods\n    [DELTASPIKE-1054] - optional mode to switch from org.quartz.Job to java.lang.Runnable\n\nTask\n\n    [DELTASPIKE-1041] - update site and javadoc to 1.5.2\n    [DELTASPIKE-1056] - document optional mode for java.lang.Runnable with @Scheduled\n    [DELTASPIKE-1067] - Data module should use utils from core\n    [DELTASPIKE-1073] - prepare v1.5.3"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.5.4.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.5.4\n\nBug\n\n    [DELTASPIKE-1074] - Severe problem in setUrlParam() (windowhandler.js)\n    [DELTASPIKE-1078] - Request binding throws exception when using forwards\n\nImprovement\n\n    [DELTASPIKE-1076] - improve release-documentation\n    [DELTASPIKE-1077] - improve documentation about ClassDeactivator and Deactivatable\n\nTask\n\n    [DELTASPIKE-1075] - update site and javadoc to 1.5.3\n    [DELTASPIKE-1079] - update external resources\n    [DELTASPIKE-1080] - prepare v1.5.4"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.6.0.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.6.0\n\nSub-task\n\n    [DELTASPIKE-1100] - Support remove expressions\n\nBug\n\n    [DELTASPIKE-1087] - core-jmx: missing blank in log statement\n    [DELTASPIKE-1097] - Fix Data Module tests for TomEE7\n    [DELTASPIKE-1105] - Cannot sort on a find all query\n    [DELTASPIKE-1107] - Wrong usage of Dependency Scope=Import in deltaspike-scheduler-module-impl\n    [DELTASPIKE-1108] - Tests in 'deltaspike-data-module-test-ee7' fail with Weld and should be ignored\n\nImprovement\n\n    [DELTASPIKE-1066] - [perf] enhance caching in RepositoryEntity\n    [DELTASPIKE-1090] - ProjectStage config key with just uppercase letters and '_'\n    [DELTASPIKE-1092] - improve documentation\n    [DELTASPIKE-1095] - Move persistence/orm.xml mapping + parsing from DATA impl to JPA api/spi\n\nNew Feature\n\n    [DELTASPIKE-1081] - Offer the possibility to provide the cron expression via configuration\n    [DELTASPIKE-1093] - add @Throttled\n    [DELTASPIKE-1094] - add @Futureable\n    [DELTASPIKE-1096] - project-stage bridge for jsf\n    [DELTASPIKE-1099] - @Locked: method access controlled by a ReadWriteLock\n\nTask\n\n    [DELTASPIKE-1068] - Merge data ClassUtils to core ClassUtils\n    [DELTASPIKE-1069] - evaluate interceptors for producer-methods\n    [DELTASPIKE-1082] - document configurable cron-expressions\n    [DELTASPIKE-1083] - update site and javadoc to 1.5.4\n    [DELTASPIKE-1106] - prepare v1.6.0"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.6.1.txt",
    "content": "Release Notes - Apache DeltaSpike - Version 1.6.1\n\nImprovement\n\n    [DELTASPIKE-1113] - WindowIdHtmlRenderer should skip DELEGATED\n    [DELTASPIKE-1116] - allow conditional injection-point customization in test-classes\n    [DELTASPIKE-1118] - ThrottledInterceptor needs to use an InterceptorStrategy\n    [DELTASPIKE-1119] - FutureableInterceptor needs to use an InterceptorStrategy\n    [DELTASPIKE-1120] - LockedInterceptor needs to use an InterceptorStrategy\n    [DELTASPIKE-1124] - optimize internal handling of cron-config updates\n    [DELTASPIKE-1125] - make ParentExtension mechanism configurable\n    [DELTASPIKE-1130] - improve cdi-ctrl-tck\n    [DELTASPIKE-1131] - improve MockHttpSession\n\nNew Feature\n\n    [DELTASPIKE-1117] - add cache(long ms) to ConfigResolver.TypedResolver\n    [DELTASPIKE-1126] - variable support in ConfigResolver\n\nTask\n\n    [DELTASPIKE-1006] - document @Transactional and @TransactionScoped support for @Repository\n    [DELTASPIKE-1032] - document creating quartz scheduling jobs at runtime\n    [DELTASPIKE-1112] - Document - getting started w/ DeltaSpike using Gradle\n    [DELTASPIKE-1114] - update site and javadoc to 1.6.0\n    [DELTASPIKE-1128] - add deltaspike.future.timeout to CoreBaseConfig\n    [DELTASPIKE-1132] - prepare v1.6.1"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.7.0.txt",
    "content": "Release Notes - DeltaSpike - Version 1.7.0\n\nSub-task\n    [DELTASPIKE-1102] - Support TOP and FIRST\n\nBug\n    [DELTASPIKE-1089] - No possible to select non Entity object via Native query\n    [DELTASPIKE-1138] - FutureableTest not compatible with weld v1.x\n    [DELTASPIKE-1139] - TypedResolver might prematurely return null under high load\n    [DELTASPIKE-1141] - @Futureable @Locked and @EnableInterceptor cannot work with CDI 1.0/Weld 1.x\n    [DELTASPIKE-1142] - Documentation wrong: an interface does not implement another interface\n    [DELTASPIKE-1144] - Existing window name may lead to infinite redirects\n    [DELTASPIKE-1147] - TypedResolver behaves different than ConfigResolver\n    [DELTASPIKE-1151] - CdiTestSuiteRunner.LogRunListener logs multiple times\n    [DELTASPIKE-1156] - Scheduler tests are failing in TomEE\n    [DELTASPIKE-1158] - It is not possible to override generic methods defined within delegates\n\nImprovement\n\n    [DELTASPIKE-1088] - Provide a BOM for deltaspike with no transitive dependencies\n    [DELTASPIKE-1091] - Weld core BOM update in next 2.3/3.x release\n    [DELTASPIKE-1135] - Cannot use typesafe messages on Application scope initialization observer\n    [DELTASPIKE-1148] - Reduce redirects in CLIENTWINDOW mode when opening a link in a new tab\n    [DELTASPIKE-1149] - CLIENTWINDOW tokenizedRedirect should ignore ctrl-key\n    [DELTASPIKE-1150] - Ignore \"external\" links in CLIENTWINDOW-mode\n    [DELTASPIKE-1153] - Expand query support to not require a where clause\n    [DELTASPIKE-1154] - [perf] use EntityVerifier in a static way\n    [DELTASPIKE-1155] - tableName fallback to Metamodel only when not defined on @Table\n    [DELTASPIKE-1159] - BOM Needs a dependency management section\n    [DELTASPIKE-1161] - [perf] avoid Instance#Select\n    [DELTASPIKE-1162] - [perf] avoid duplicate RepositoryComponent lookup\n    [DELTASPIKE-1163] - [perf] avoid duplicate RepositoryComponent lookup\n    [DELTASPIKE-1164] - [perf] QueryBuilder can be ApplicationScoped\n    [DELTASPIKE-1168] - [perf] optimize DelegateQueryBuilder#selectDelegate\n    [DELTASPIKE-1169] - Separate concerns of EntityRepository\n    [DELTASPIKE-1170] - Proxy should be invocationHandler class independent\n    [DELTASPIKE-1171] - [perf] cache interceptors per proxy method\n\nNew Feature\n\n    [DELTASPIKE-1036] - Repositories should support java.util.Optional as return type\n    [DELTASPIKE-1152] - Add support for firstXX in query method expressions\n    [DELTASPIKE-1157] - Repository.findBy methods do not allow an override to add query hints.\n    [DELTASPIKE-1160] - Not possible to select non Entity or other Entity object via Native query\n    [DELTASPIKE-1165] - Repositories support returning Stream<E> in addition to List<E>\n\nTask\n\n    [DELTASPIKE-1047] - Setup builds for TomEE 7\n    [DELTASPIKE-1136] - update site and javadoc to 1.6.1\n    [DELTASPIKE-1140] - improve build for ee7-tests\n    [DELTASPIKE-1145] - improve tests with @TransactionScoped\n    [DELTASPIKE-1146] - improve test-code of TransactionalBean#executeInTransaction\n    [DELTASPIKE-1166] - Prep the 1.7 release"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.7.1.txt",
    "content": "Release Notes - DeltaSpike - Version 1.7.1\n\nBug\n    [DELTASPIKE-1167] - deltaspike configuration: Variable Replacement in Configured Values is NOT (!) stage aware\n    [DELTASPIKE-1173] - DefaultEntityManagerHolder is not registered in uber jars when discovery is annotated\n    [DELTASPIKE-1175] - Weld(1|2|3) profiles do not activate Weld profile in cdictrl\n    [DELTASPIKE-1179] - [Deltaspike Data] ContextNotActiveException: WELD-001303: No active contexts for scope type jakarta.enterprise.context.ApplicationScoped\n    [DELTASPIKE-1183] - NPE in proxy handler with concurrent requests\n\nImprovement\n    [DELTASPIKE-1180] - Remove unused imports"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.7.2.txt",
    "content": "Release Notes - DeltaSpike - Version 1.7.2\n\nBug\n    [DELTASPIKE-1191] - Update Test-Control gradle docs\n    [DELTASPIKE-1194] - Distribution not including binary artifacts\n    [DELTASPIKE-1196] - Syntax error in DOAP file\n    [DELTASPIKE-1199] - Problems with ContextControl and Weld ContainerInitialized, ContainerShutdown event.\n    [DELTASPIKE-1204] - Wildfly managed profiles blow up\n    [DELTASPIKE-1207] - Incorrect exception handling in DynamicMBeanWrapper.invoke()\n    [DELTASPIKE-1208] - deltaspike configuration: Variable Replacement in Configured Values is NOT fully stage aware\n    [DELTASPIKE-1209] - Textual fixes for documentation of Data Module\n    [DELTASPIKE-1210] - DelegateQueryHandler has missing Javadoc\n    [DELTASPIKE-1211] - SingleResultType.OPTIONAL refers to nonexistent constant SINGLE\n    [DELTASPIKE-1213] - LockedTest fails on OWB 1.1.x\n\nImprovement\n    [DELTASPIKE-1201] - add logout link to security example\n    [DELTASPIKE-1203] - create jpa examples\n    [DELTASPIKE-1205] - create deltaspike data module examples\n\nNew Feature\n    [DELTASPIKE-1176] - Support void methods in Futureable\n\nTask\n    [DELTASPIKE-1181] - Implement tests for Payara\n    [DELTASPIKE-1186] - 1.7.1 Release execution and website clean up\n    [DELTASPIKE-1187] - Document entity graph support\n    [DELTASPIKE-1188] - Improve contributor guide\n    [DELTASPIKE-1189] - Migrate index.html into git\n    [DELTASPIKE-1192] - Fix increase in warning messages with DeltaSpike Data and Weld\n\nWish\n    [DELTASPIKE-1185] - Allow customization (name, description) of JMX managed methods' parameters"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.8.2.txt",
    "content": "Release Notes - DeltaSpike - Version 1.8.2\n\nBug\n\n    [DELTASPIKE-1276] - Multiple license headers\n    [DELTASPIKE-1299] - Order by items are applied in alphabetic order\n    [DELTASPIKE-1310] - Please use https (SSL) for links to KEYS, hashes, sigs\n    [DELTASPIKE-1313] - DeltaSpikeProxyInterceptorLookup fails on WAS\n    [DELTASPIKE-1316] - add dynamic annotations feature, configurable via config\n    [DELTASPIKE-1317] - AnnotatedCallableImpl blows up with ArrayOutofBounds when parsing enums\n    [DELTASPIKE-1344] - deltaspike-cdictrl-owb has a transient runtime dependency on Shrinkwrap and Arquillian\n\nNew Feature\n\n    [DELTASPIKE-1319] - labeled alternatives\n    [DELTASPIKE-1320] - global alternative spi to support custom (type-safe) mechanisms\n    [DELTASPIKE-1337] - optional ClassFilter spi\n    [DELTASPIKE-1338] - support class-filter per test\n\nImprovement\n\n    [DELTASPIKE-1309] - Upgrade ASM\n    [DELTASPIKE-1311] - Allow Excluded Repositories\n    [DELTASPIKE-1329] - ProjectStageProducer should log changed values\n    [DELTASPIKE-1331] - minor type improvement of the ViewConfigNode spi\n    [DELTASPIKE-1332] - support further cases for custom view-meta-data\n    [DELTASPIKE-1334] - javadoc for ConfigPreProcessor#beforeAddToConfig\n    [DELTASPIKE-1339] - Add support for dynamic interceptor binding, added via Extension\n\nTask\n\n    [DELTASPIKE-1257] - Research why BOM isn't working right in a release\n    [DELTASPIKE-1312] - Upgrade to quartz-2.3.0\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.9.5.txt",
    "content": "Release Notes - DeltaSpike - Version 1.9.5\n\nBug\n\n    [DELTASPIKE-1314] - ContainerCtrlTckTest fails with tomee7-build-managed\n    [DELTASPIKE-1413] - dsrwid cookie should not be set to sameSite=\"None\"\n    [DELTASPIKE-1416] - deltaspike-core-impl.jar does not contain the Main class to execute in your Manifest.MF to Crypto\n    [DELTASPIKE-1423] - JSF-2.3 managed() in FacesValidator and FacesConverter break CDI integration\n\nImprovement\n\n    [DELTASPIKE-1420] - Update ASM to 9.1\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-1.9.6.txt",
    "content": "Release Notes - DeltaSpike - Version 1.9.6\n\nBug\n    [DELTASPIKE-1133] - Don't override the log level\n    [DELTASPIKE-1427] - JUL Logging with {} as param leeds to NumberFormatException\n    [DELTASPIKE-1433] - EntityManagerFactoryProducer should also provide a @Disposes method\n    [DELTASPIKE-1453] - injecting config of Class got broken\n\nNew Feature\n    [DELTASPIKE-1431] - add easy way to disable InvocationResultLogger\n    [DELTASPIKE-1444] - Create POJO and Record based Config\n    [DELTASPIKE-1445] - Dynamic Config injection via a Supplier<T>\n\nImprovement\n    [DELTASPIKE-1426] - DeltaSpikeProxyFactory is slow on start\n    [DELTASPIKE-1432] - Proxy class definition does not work\n    [DELTASPIKE-1454] - Upgrade ASM to 9.3\n\nTask\n    [DELTASPIKE-1452] - upgrade to apache-parent 25\n"
  },
  {
    "path": "deltaspike/readme/ReleaseNotes-2.0.0.txt",
    "content": "Release Notes - DeltaSpike - Version 2.0.0\n\nThis is the first release targeting jakarta.* package names.\nThe target specification is JakartaEE-9\n\n\nSub-task\n\n    [DELTASPIKE-1438] - Remove EAR support\n    [DELTASPIKE-1439] - Remove Global Alternatives\n    [DELTASPIKE-1440] - Remove Metadata Builders\n    [DELTASPIKE-1460] - Move outdated APIs\n    [DELTASPIKE-1466] - move beans.xml to CDI-3.0 style\n\nBug\n\n    [DELTASPIKE-1435] - dsrwid cookie should not be set to sameSite=\"None\" - again\n    [DELTASPIKE-1458] - DefaultConfigSourceProvider cannot be instantiated\n    [DELTASPIKE-1467] - Saving existing entity throws an exception\n    [DELTASPIKE-1469] - WindowIdHtmlRenderer loads wrong Javascript file\n\nNew Feature\n\n    [DELTASPIKE-1468] - AuditProvider (PrincipalProvider/TimestampsProvider) not working\n\nImprovement\n\n    [DELTASPIKE-1238] - Create a better default TransactionStrategy\n    [DELTASPIKE-1260] - Remove Servlet Module\n    [DELTASPIKE-1261] - Remove BeanVal Module\n    [DELTASPIKE-1262] - Remove CdiContainer control\n    [DELTASPIKE-1263] - Remove BeanBuilder\n    [DELTASPIKE-1265] - Align JSF module to features provided by JSF 2.3\n    [DELTASPIKE-1266] - Remove != JavaEE8 workarounds\n    [DELTASPIKE-1434] - Namespace change javax to jakarta\n    [DELTASPIKE-1455] - Allow to pass properties to Weld\n    [DELTASPIKE-1456] - Introduce default methods for some functions in ConfigSource\n    [DELTASPIKE-1461] - Cleanup Window/ViewAcessScoped\n    [DELTASPIKE-1463] - Reimplement DS ClientWindow as native Faces ClientWindow\n    [DELTASPIKE-1464] - Use jfwid over dswid\n    [DELTASPIKE-1465] - print ConfigSource of the values for deltaspike.config.log\n\nTest\n\n    [DELTASPIKE-1206] - support for CDI 2.0 <trim/> feature\n\nWish\n\n    [DELTASPIKE-1235] - DS 2: check if we can remove our ContextControl\n    [DELTASPIKE-1376] - Warning on CDI 2.0\n\nTask\n\n    [DELTASPIKE-1437] - DeltaSpike-2.0 umbrella ticket\n    [DELTASPIKE-1471] - Remove @EnableInterceptors in favor of CDI InterceptionFactory\n\n"
  },
  {
    "path": "deltaspike/test-utils/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>parent</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../parent/pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike.test</groupId>\n    <artifactId>test-utils</artifactId>\n\n    <name>Apache DeltaSpike Test-Utils</name>\n    <description>\n        This package contains our Test Categories and other useful stuff for\n        running our tests.\n    </description>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.jboss.shrinkwrap</groupId>\n            <artifactId>shrinkwrap-api</artifactId>\n            <version>${shrinkwrap.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.arquillian.container</groupId>\n            <artifactId>arquillian-container-test-spi</artifactId>\n            <version>${arquillian.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.maven</groupId>\n            <artifactId>maven-artifact</artifactId>\n            <version>${maven.artifact.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>compile</scope>\n            <optional>true</optional>\n        </dependency>\n\n\n    </dependencies>\n\n    <properties>\n        <shrinkwrap.version>1.2.6</shrinkwrap.version>\n    </properties>\n</project>\n\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/arquillian/DeltaSpikeServerUtilAppender.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.arquillian;\n\nimport org.apache.deltaspike.test.category.DeltaSpikeTest;\nimport org.apache.deltaspike.test.utils.Serializer;\nimport org.jboss.arquillian.container.test.spi.client.deployment.CachedAuxilliaryArchiveAppender;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\nimport static org.apache.deltaspike.test.utils.BeansXmlUtil.BEANS_XML_ALL;\n\npublic class DeltaSpikeServerUtilAppender extends CachedAuxilliaryArchiveAppender\n{\n    @Override\n    protected Archive<?> buildArchive()\n    {\n        return ShrinkWrap.create(JavaArchive.class, \"test-utils.jar\")\n                .addPackage(Serializer.class.getPackage())\n                .addPackage(DeltaSpikeTest.class.getPackage())\n                .addAsManifestResource(BEANS_XML_ALL, \"beans.xml\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/arquillian/DeltaSpikeTestUtilExtension.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.arquillian;\n\nimport org.jboss.arquillian.container.test.spi.client.deployment.AuxiliaryArchiveAppender;\nimport org.jboss.arquillian.core.spi.LoadableExtension;\n\npublic class DeltaSpikeTestUtilExtension implements LoadableExtension\n{\n    @Override\n    public void register(final ExtensionBuilder extensionBuilder)\n    {\n        extensionBuilder.service(AuxiliaryArchiveAppender.class, DeltaSpikeServerUtilAppender.class);\n        extensionBuilder.service(AuxiliaryArchiveAppender.class, TestUtilDependenciesAppender.class);\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/arquillian/TestUtilDependenciesAppender.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.arquillian;\n\nimport org.jboss.arquillian.container.test.spi.client.deployment.CachedAuxilliaryArchiveAppender;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\npublic class TestUtilDependenciesAppender extends CachedAuxilliaryArchiveAppender\n{\n    @Override\n    protected Archive<?> buildArchive()\n    {\n        return ShrinkWrap.create(JavaArchive.class, \"maven-artifact.jar\")\n                .addPackage(\"org.apache.maven.artifact.versioning\");\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/DeltaSpikeTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.category;\n\n/**\n * This class contains a few constants and utility methods.\n */\npublic class DeltaSpikeTest\n{\n    public static final String DELTASPIKE_PROPERTIES = \"META-INF/apache-deltaspike.properties\";\n\n\n    private DeltaSpikeTest()\n    {\n        // just to prevent initialisation!\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/EnterpriseArchiveProfileCategory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.category;\n\n/**\n * Category marker interface. Tests which are packaged as ear-file.\n */\npublic interface EnterpriseArchiveProfileCategory\n{\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/FullProfileCategory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.category;\n\n/**\n * Category marker interface. Tests which are Full profile minimum.\n */\npublic interface FullProfileCategory\n{\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/SeCategory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.category;\n\n/**\n * Category marker interface for tests which only run outside of a java-ee server\n * e.g. due to a restriction of our test-setup with packaging resources with the same name from different sources\n * like multiple parallel versions of apache-deltaspike.properties which is caused by the autom. unpack to the\n * integration-test module.\n */\npublic interface SeCategory\n{\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/WebEEProfileCategory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.category;\n\n/**\n * Category marker interface. Tests which are Web profile minimum.\n */\npublic interface WebEEProfileCategory\n{\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/WebProfileCategory.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.apache.deltaspike.test.category;\n\n/**\n * Category marker interface. Tests which are Web profile minimum.\n */\npublic interface WebProfileCategory\n{\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/control/LockedContainerVersions.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.control;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Target(value = { ElementType.METHOD })\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface LockedContainerVersions\n{\n\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/control/LockedImplementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.control;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport org.apache.deltaspike.test.utils.Implementation;\n\n/**\n * This annotation is used to define the {@link #implementations()} which the test is allowed to run.\n * \n * If {@link #implementations()} is not defined, It will be used all available implementations\n * defined on {@link Implementation}.\n * \n * A specific implementation can have {@link #versions()} range locked through the use of {@link LockedVersionRange}\n * @author rafaelbenevides\n * @author struberg\n *\n */\n@Target(value = { ElementType.METHOD })\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface LockedImplementation\n{\n\n    /**\n     * If defined, the test will only run if one of those implementations get detected\n     */\n    Implementation[] implementations() default {};\n\n    /**\n     * Can be used to further restrict the implementation for {@link #implementations()}.\n     */\n    LockedVersionRange[] versions() default { };\n\n    /**\n     * If defined, the test will <b>NOT</b> run if one of those implementations get detected\n     */\n    Implementation[] excludedImplementations() default {};\n\n    /**\n     * Can be used to further restrict the implementation for {@link #excludedImplementations()} ()}.\n     */\n    LockedVersionRange[] excludedVersions() default {};\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/control/LockedVersionRange.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.control;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport org.apache.deltaspike.test.utils.Implementation;\n\n/**\n * It allows to specify the version range that the test is allowed to run for an specified {@link #implementation()}.\n * \n * The {@link #versionRange()} attribute uses the Maven version range pattern\n * @author rafaelbenevides\n *\n */\n@Target(value = { ElementType.METHOD })\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface LockedVersionRange\n{\n\n    Implementation implementation();\n\n    String versionRange();\n\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/control/VersionControlRule.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.control;\n\nimport java.util.Arrays;\n\nimport org.apache.deltaspike.test.utils.CdiContainerUnderTest;\nimport org.apache.deltaspike.test.utils.Implementation;\nimport org.junit.rules.TestRule;\nimport org.junit.runner.Description;\nimport org.junit.runners.model.Statement;\n\n\n/** \n * \n * This {@link TestRule} allows a test to check those methods annotated with {@link LockedImplementation}.\n * \n * You can define some {@link LockedImplementation}. Example:\n * \n * <pre>\n *     @LockedCDIImplementation(cdiImplementations = {\n *           CdiImplementation.OWB11,\n *           CdiImplementation.OWB12\n *   })\n * </pre>\n *  \n * \n * You can also define specific versions of a specific implementation. Example:\n * \n * <pre>\n *     @LockedCDIImplementation(versions = {\n *           @LockedVersionRange(implementation = CdiImplementation.WELD11, versionRange = \"[1.1.13,1.2)\"),\n *           @LockedVersionRange(implementation = CdiImplementation.WELD20, versionRange = \"[2.0.1.Final,2.1)\")\n *           })\n * </pre>\n * \n * @author rafaelbenevides\n * @author struberg\n */\npublic class VersionControlRule implements TestRule\n{\n    private static final Implementation[] EMPTY_IMPL = new Implementation[0];\n\n    @Override\n    public Statement apply(final Statement base, final Description description)\n    {\n        return new Statement()\n        {\n\n            @Override\n            public void evaluate() throws Throwable\n            {\n                LockedImplementation lockedCDIImplAnnotation = description\n                        .getAnnotation(LockedImplementation.class);\n                // no @LockedCDIImplementation present or if running specified Container\n                if (lockedCDIImplAnnotation == null)\n                {\n                    base.evaluate();\n                }\n                else\n                {\n                    checkAnnotation(lockedCDIImplAnnotation, base);\n                }\n            }\n\n            private void checkAnnotation(LockedImplementation lockedImplAnnotation, Statement base)\n                throws Throwable\n            {\n                Implementation[] implementations = getImplementations(lockedImplAnnotation.implementations(), lockedImplAnnotation.versions());\n\n                // Run the test if there is no explicit list of implementations to only run on.\n                boolean shouldRun = implementations.length == 0;\n\n                for (Implementation impl : implementations)\n                {\n                    String versionRange = getLockedVersionRange(lockedImplAnnotation.versions(), impl);\n                    if (CdiContainerUnderTest.isImplementationVersion(impl, versionRange))\n                    {\n                        shouldRun = true;\n                    }\n                }\n\n                // now check the exclude list: implementations to NOT run on!\n                final Implementation[] excludedImplementations = getImplementations(lockedImplAnnotation.excludedImplementations(),\n                                                                                    lockedImplAnnotation.excludedVersions());\n                for (Implementation impl : excludedImplementations)\n                {\n                    String versionRange = getLockedVersionRange(lockedImplAnnotation.excludedVersions(), impl);\n                    if (CdiContainerUnderTest.isImplementationVersion(impl, versionRange))\n                    {\n                        shouldRun = false;\n                    }\n                }\n\n                if (shouldRun)\n                {\n                    base.evaluate();\n                }\n            }\n\n            /**\n             * Get the locked version Range\n             * \n             * @return the locked version range\n             */\n            private String getLockedVersionRange(LockedVersionRange[] versions,\n                                                 Implementation cdiImpl)\n            {\n                for (LockedVersionRange versionRange : versions)\n                {\n                    if (versionRange.implementation().equals(cdiImpl))\n                    {\n                        return versionRange.versionRange();\n                    }\n                }\n                return null;\n            }\n        };\n    }\n\n    private Implementation[] getImplementations(Implementation[] implementations, LockedVersionRange[] lockedVersionRanges)\n    {\n        if (implementations != null && implementations.length > 0)\n        {\n            return implementations;\n        }\n\n        if (lockedVersionRanges != null && lockedVersionRanges.length > 0)\n        {\n            return Arrays.stream(lockedVersionRanges)\n                .map(lr -> lr.implementation())\n                .distinct()\n                .toArray(Implementation[]::new);\n        }\n\n        return EMPTY_IMPL;\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/BeansXmlUtil.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.utils;\n\nimport org.jboss.shrinkwrap.api.asset.Asset;\nimport org.jboss.shrinkwrap.api.asset.StringAsset;\n\npublic class BeansXmlUtil\n{\n    /**\n     * A Beans.xml instance enabling Discovery-Mode ALL for unit tests\n     */\n    public static final Asset BEANS_XML_ALL = new StringAsset(\"<beans bean-discovery-mode=\\\"all\\\"/>\");\n\n    private BeansXmlUtil()\n    {\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/CdiContainerUnderTest.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.utils;\n\nimport java.net.URL;\nimport java.util.jar.Attributes;\nimport java.util.jar.Manifest;\n\nimport org.apache.maven.artifact.versioning.DefaultArtifactVersion;\nimport org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;\nimport org.apache.maven.artifact.versioning.VersionRange;\n\n/**\n * A small helper class which checks if the container which is currently being tested matches the given version RegExp\n */\npublic class CdiContainerUnderTest\n{\n    private CdiContainerUnderTest()\n    {\n        // utility class ct\n    }\n\n    /**\n     * Checks whether the current container matches the given version regexps.\n     * \n     * @param containerRegExps\n     *            container versions to test against. e.g. 'owb-1\\\\.0\\\\..*' or 'weld-2\\\\.0\\\\.0\\\\..*'\n     */\n    public static boolean is(String... containerRegExps)\n    {\n        String containerVersion = System.getProperty(\"cdicontainer.version\");\n\n        if (containerVersion == null)\n        {\n            return false;\n        }\n\n        for (String containerRe : containerRegExps)\n        {\n            if (containerVersion.matches(containerRe))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    /**\n     * Verify if the runtime is using the following Implementation\n     * \n     * @param implementation\n     * @param versionRange\n     *            optional - If not defined it will used the range defined on {@link Implementation}\n     * @return\n     * @throws InvalidVersionSpecificationException\n     */\n    public static boolean isImplementationVersion(Implementation implementation, String versionRange)\n        throws InvalidVersionSpecificationException\n    {\n\n        Class implementationClass = tryToLoadClassForName(implementation.getImplementationClassName());\n\n        if (implementationClass == null)\n        {\n            return false;\n        }\n\n        VersionRange range = VersionRange.createFromVersionSpec(versionRange == null ? implementation\n                .getVersionRange() : versionRange);\n        String containerVersion = getJarSpecification(implementationClass);\n        return containerVersion != null && range.containsVersion(new DefaultArtifactVersion(containerVersion));\n    }\n\n    private static Class tryToLoadClassForName(String name)\n    {\n        try\n        {\n            return loadClassForName(name);\n        }\n        catch (ClassNotFoundException e)\n        {\n            // do nothing - it's just a try\n            return null;\n        }\n    }\n\n    private static Class loadClassForName(String name) throws ClassNotFoundException\n    {\n        try\n        {\n            // Try WebApp ClassLoader first\n            return Class.forName(name, false, // do not initialize for faster startup\n                    getClassLoader(null));\n        }\n        catch (ClassNotFoundException ignore)\n        {\n            // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)\n            return Class.forName(name, false, // do not initialize for faster startup\n                    CdiContainerUnderTest.class.getClassLoader());\n        }\n    }\n\n    private static ClassLoader getClassLoader(Object o)\n    {\n        return getClassLoaderInternal(o);\n    }\n\n    private static ClassLoader getClassLoaderInternal(Object o)\n    {\n        ClassLoader loader = Thread.currentThread().getContextClassLoader();\n\n        if (loader == null && o != null)\n        {\n            loader = o.getClass().getClassLoader();\n        }\n\n        if (loader == null)\n        {\n            loader = CdiContainerUnderTest.class.getClassLoader();\n        }\n\n        return loader;\n    }\n\n    private static String getJarVersion(Class targetClass)\n    {\n        String manifestFileLocation = getManifestFileLocationOfClass(targetClass);\n\n        try\n        {\n            return new Manifest(new URL(manifestFileLocation).openStream())\n                    .getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n    private static String getJarSpecification(Class targetClass)\n    {\n        String manifestFileLocation = getManifestFileLocationOfClass(targetClass);\n\n        try\n        {\n            return new Manifest(new URL(manifestFileLocation).openStream())\n                    .getMainAttributes().getValue(Attributes.Name.SPECIFICATION_VERSION);\n        }\n        catch (Exception e)\n        {\n            return null;\n        }\n    }\n\n    private static String getManifestFileLocationOfClass(Class targetClass)\n    {\n        String manifestFileLocation;\n\n        try\n        {\n            manifestFileLocation = getManifestLocation(targetClass);\n        }\n        catch (Exception e)\n        {\n            // in this case we have a proxy\n            manifestFileLocation = getManifestLocation(targetClass.getSuperclass());\n        }\n        return manifestFileLocation;\n    }\n\n    private static String getManifestLocation(Class targetClass)\n    {\n        String classFilePath = targetClass.getCanonicalName().replace('.', '/') + \".class\";\n        String manifestFilePath = \"/META-INF/MANIFEST.MF\";\n\n        String classLocation = targetClass.getResource(targetClass.getSimpleName() + \".class\").toString();\n        return classLocation.substring(0, classLocation.indexOf(classFilePath) - 1) + manifestFilePath;\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/Implementation.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.utils;\n\npublic enum Implementation\n{\n    OWB11 (\"org.apache.webbeans.container.BeanManagerImpl\", \"[1.1,1.2)\"),\n    OWB12 (\"org.apache.webbeans.container.BeanManagerImpl\", \"[1.2,1.3)\"),\n\n    WELD11(\"org.jboss.weld.manager.BeanManagerImpl\", \"[1.1,1.2)\"),\n    WELD12(\"org.jboss.weld.manager.BeanManagerImpl\", \"[1.2,1.3)\"),\n    WELD20(\"org.jboss.weld.manager.BeanManagerImpl\", \"[2.0,2.1)\"),\n\n    MYFACES40(\"jakarta.faces.annotation.FacesConfig\", \"[4.0,4.1)\");\n\n    // not really a CDI implementation but the mechanism works as well.\n\n    private final String implementationClassName;\n    private final String versionRange;\n\n    Implementation(String implementationClassName, String versionRange)\n    {\n        this.implementationClassName = implementationClassName;\n        this.versionRange = versionRange;\n    }\n\n    public String getImplementationClassName()\n    {\n        return implementationClassName;\n    }\n\n    public String getVersionRange()\n    {\n        return versionRange;\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/Serializer.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.utils;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.ObjectInputStream;\nimport java.io.ObjectOutputStream;\n\n/**\n * A few helper methods for testing serialisation.\n * They help serializing to a byte[] and back to the object\n */\npublic class Serializer<T>\n{\n\n    /**\n     * Serializes the given instance to a byte[] and immediately\n     * de-serialize it back.\n     * @param original instance\n     * @return the deserialized new instance\n     */\n    public T roundTrip(T original)\n    {\n        return deserialize(serialize(original));\n    }\n\n    /**\n     * Serializes the given instance to a byte[].\n     */\n    public byte[] serialize(T o)\n    {\n        try\n        {\n            ByteArrayOutputStream baos = new ByteArrayOutputStream();\n            ObjectOutputStream oos = null;\n            oos = new ObjectOutputStream(baos);\n            oos.writeObject(o);\n            return baos.toByteArray();\n        }\n        catch (IOException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    /**\n     * De-serializes the given byte[] to an instance of T.\n     */\n    public T deserialize(byte[] serial)\n    {\n        try\n        {\n            ByteArrayInputStream bais = new ByteArrayInputStream(serial);\n            ObjectInputStream ois = new ObjectInputStream(bais);\n            return (T) ois.readObject();\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.deltaspike.test.utils;\n\n\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URL;\nimport java.util.*;\nimport java.util.logging.Logger;\n\n\n/**\n * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.\n * This should finally get moved to ShrinkWrap core!\n *\n * TODO This class should get moved to ShrinkWrap itself!\n */\npublic class ShrinkWrapArchiveUtil\n{\n    private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());\n\n    private ShrinkWrapArchiveUtil()\n    {\n        // private ct for utility class\n    }\n\n    /**\n     * Resolve all markerFiles from the current ClassPath and package the root nodes\n     * into a JavaArchive.\n     *\n     * @param classLoader            to use\n     * @param markerFile             finding this marker file will trigger creating the JavaArchive.\n     * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists\n     * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.\n     *                               This has a higher precedence than includeIfPackageExists.\n     */\n    public static JavaArchive[] getArchives(ClassLoader classLoader,\n                                            String markerFile,\n                                            String[] includeIfPackageExists,\n                                            String[] excludeIfPackageExists,\n                                            String archiveName)\n    {\n        if (classLoader == null)\n        {\n            classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();\n        }\n\n        try\n        {\n            Enumeration<URL> foundFiles = classLoader.getResources(markerFile);\n\n            List<JavaArchive> archives = new ArrayList<JavaArchive>();\n            int numArchives = 0;\n\n            while (foundFiles.hasMoreElements())\n            {\n                URL foundFile = foundFiles.nextElement();\n                LOG.fine(\"Evaluating Java ClassPath URL \" + foundFile.toExternalForm());\n                String suffix = (numArchives == 0) ? \"\" : Integer.toString(numArchives);\n\n                JavaArchive archive\n                    = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists, \n                        archiveName + suffix);\n                if (archive != null)\n                {\n                    LOG.info(\"Test \" + getTestName()\n                            + \" Adding Java ClassPath URL as JavaArchive \" + foundFile.toExternalForm());\n                    archives.add(archive);\n                    numArchives++;\n                }\n            }\n\n            return archives.toArray(new JavaArchive[archives.size()]);\n        }\n        catch (IOException ioe)\n        {\n            throw new RuntimeException(ioe);\n        }\n\n    }\n\n    private static JavaArchive createArchive(URL foundFile, String markerFile,\n                                             String[] includeIfPackageExists,\n                                             String[] excludeIfPackageExists,\n                                             String archiveName)\n        throws IOException\n    {\n        String urlString = foundFile.toString();\n        int idx = urlString.lastIndexOf(markerFile);\n        urlString = urlString.substring(0, idx);\n\n        String jarUrlPath = isJarUrl(urlString);\n        if (jarUrlPath != null)\n        {\n            JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(URI.create(jarUrlPath)));\n\n            if (excludeIfPackageExists != null)\n            {\n                for (String excludePackage : excludeIfPackageExists)\n                {\n                    if (foundJar.contains(excludePackage.replaceAll(\"\\\\.\", \"\\\\/\")))\n                    {\n                        return null;\n                    }\n                }\n            }\n            if (includeIfPackageExists != null)\n            {\n                for (String includePackage : includeIfPackageExists)\n                {\n                    if (foundJar.contains(includePackage.replaceAll(\"\\\\.\", \"\\\\/\")))\n                    {\n                        return foundJar;\n                    }\n                }\n            }\n            return null; // couldn't find any jar\n        }\n        else\n        {\n            File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );\n            if (!f.exists())\n            {\n                // try a fallback if the URL contains %20 -> spaces\n                if (urlString.contains(\"%20\"))\n                {\n                    urlString = urlString.replaceAll(\"%20\", \" \");\n                    f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );\n                }\n\n            }\n\n            return addFileArchive(f, includeIfPackageExists, excludeIfPackageExists, archiveName);\n        }\n    }\n\n    private static JavaArchive addFileArchive(File archiveBasePath,\n                                              String[] includeIfPackageExists,\n                                              String[] excludeIfPackageExists,\n                                              String archiveName)\n        throws IOException\n    {\n        if (!archiveBasePath.exists())\n        {\n            return null;\n        }\n\n        if (archiveName == null)\n        {\n            archiveName = UUID.randomUUID().toString();\n        }\n\n        JavaArchive ret = null;\n        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, archiveName + \".jar\");\n\n        if (includeIfPackageExists == null)\n        {\n            // no include rule, thus add it immediately\n            ret = javaArchive;\n        }\n\n        int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;\n\n        for (File archiveEntry : collectArchiveEntries(archiveBasePath) )\n        {\n            String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);\n\n            // exclude rule\n            if (excludeIfPackageExists(entryName, excludeIfPackageExists))\n            {\n                continue;\n            }\n\n            // include rule\n            if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists))\n            {\n                ret = javaArchive;\n            }\n\n            if (entryName.endsWith(\".class\"))\n            {\n                String className\n                    = pathToClassName(entryName.substring(0, entryName.length() - (\".class\".length())));\n\n                try\n                {\n                    javaArchive.addClass(className);\n                }\n                catch (Throwable t)\n                {\n                    LOG.info(\"Ignoring class \" + className + \" due to \" + t.getMessage());\n                }\n            }\n            else\n            {\n                javaArchive.addAsResource(archiveEntry, entryName.replace('\\\\', '/'));\n            }\n        }\n\n        return ret;\n    }\n\n    private static List<File> collectArchiveEntries(File archiveBasePath)\n    {\n        if (archiveBasePath.isDirectory())\n        {\n            List<File> archiveEntries = new ArrayList<File>();\n            File[] files = archiveBasePath.listFiles();\n\n            for (File file : files)\n            {\n                if (file.isDirectory())\n                {\n                    archiveEntries.addAll(collectArchiveEntries(file));\n                }\n                else\n                {\n                    archiveEntries.add(file);\n                }\n            }\n\n            return archiveEntries;\n        }\n\n        return Collections.emptyList();\n    }\n\n\n    private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages)\n    {\n        if (excludeOnPackages != null)\n        {\n            String packageName = pathToClassName(jarEntryName);\n\n            for (String excludeOnPackage : excludeOnPackages)\n            {\n                if (packageName.startsWith(excludeOnPackage))\n                {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages)\n    {\n        if (includeOnPackages == null )\n        {\n            return true;\n        }\n\n        String packageName = pathToClassName(jarEntryName);\n\n        for (String includeOnPackage : includeOnPackages)\n        {\n            if (packageName.startsWith(includeOnPackage))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    /**\n     * check if the given url path is a Jar\n     * @param urlPath to check\n     */\n    private static String isJarUrl(String urlPath)\n    {\n        // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)\n        final int jarColon = urlPath.indexOf(':');\n        if (urlPath.endsWith(\"!/\") && jarColon > 0)\n        {\n            urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);\n            return urlPath;\n        }\n\n        return null;\n    }\n\n    private static String ensureCorrectUrlFormat(String url)\n    {\n        //fix for wls\n        if (!url.startsWith(\"file:/\"))\n        {\n            url = \"file:/\" + url;\n        }\n        return url;\n    }\n\n    private static String pathToClassName(String pathName)\n    {\n        return pathName.replace('/', '.').replace('\\\\', '.');   // replace unix and windows separators\n    }\n\n\n    public static String getTestName()\n    {\n        StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();\n        String testName = \"unknown\";\n        for (StackTraceElement ste : stackTraceElements)\n        {\n            if (ste.getClassName().contains(\"Test\"))\n            {\n                testName = ste.getClassName();\n                break;\n            }\n        }\n\n        return testName;\n    }\n}\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension",
    "content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n\norg.apache.deltaspike.test.arquillian.DeltaSpikeTestUtilExtension\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/resources/arquillian-jboss.xml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<arquillian xmlns=\"http://jboss.org/schema/arquillian\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd\">\n\n    <!--Uncomment to have test archives exported to the file system for inspection -->\n    <!--\n    <engine>\n        <property name=\"deploymentExportPath\">target/</property>\n    </engine>\n    -->\n\n    <!-- We need to specify this because the default protocol for AS7 and Wildfly doesn't work very well -->\n    <defaultProtocol type=\"Servlet 6.0\" />\n\n    <container qualifier=\"wildfly-managed\">\n        <configuration>\n            <!-- for debugging add: -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y  -->\n            <property name=\"javaVmArguments\">-client -Xms64m -Xmx1024m -Dcdicontainer.version=${cdicontainer.version} ${jacoco.agent}</property>\n            <property name=\"outputToConsole\">false</property>\n            <property name=\"allowConnectingToRunningServer\">true</property>\n            <property name=\"cdicontainer.version\">${cdicontainer.version}</property>\n        </configuration>\n    </container>\n\n    <container qualifier=\"wildfly-build-managed\">\n        <configuration>\n            <property name=\"jbossHome\">${arquillian.jboss_home}</property>\n            <property name=\"javaVmArguments\">-client -Xms64m -Xmx1024m -Djboss.socket.binding.port-offset=50000 -Dcdicontainer.version=${cdicontainer.version} -Ddeltaspike.bean-manager.delegate_lookup=false</property>\n<!-- debug options\n            <property name=\"javaVmArguments\">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m -Djboss.socket.binding.port-offset=50000 -Dcdicontainer.version=${cdicontainer.version} -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</property>\n-->\n            <property name=\"outputToConsole\">false</property>\n            <property name=\"managementPort\">59990</property>\n        </configuration>\n    </container>\n\n    <container qualifier=\"wildfly-remote\">\n        \n    </container>\n\n</arquillian>\n"
  },
  {
    "path": "deltaspike/test-utils/src/main/resources/arquillian.xml",
    "content": "<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<arquillian xmlns=\"http://jboss.org/schema/arquillian\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:schemaLocation=\"http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd\">\n\n    <!--Uncomment to have test archives exported to the file system for inspection -->\n    <!--\n    <engine>\n        <property name=\"deploymentExportPath\">target/</property>\n    </engine>\n    -->\n\n    <!-- don't remove the qualifier - it's needed for the arquillian.launch property -->\n    <container qualifier=\"glassfish-remote\">\n    </container>\n\n    <container qualifier=\"wls-remote-12c\">\n        <configuration>\n            <property name=\"adminUrl\">t3://localhost:7001</property>\n            <property name=\"adminUserName\">weblogic1</property>\n            <property name=\"adminPassword\">weblogic1</property>\n            <property name=\"target\">AdminServer</property>\n            <property name=\"wlsHome\">${WLS_HOME}</property>\n        </configuration>\n    </container>\n\n    <container qualifier=\"wls-managed-12c\">\n        <configuration>\n            <property name=\"middlewareHome\">${MW_HOME}</property>\n            <property name=\"wlHome\">${MW_HOME}/wlserver</property>\n            <property name=\"domainDirectory\">${DS_DOMAIN_DIR}</property>\n            <property name=\"target\">${DS_DOMAIN_TARGET}</property>\n            <property name=\"adminUrl\">${DS_ADMIN_URL}</property>\n            <property name=\"adminUserName\">${DS_ADMIN_USER}</property>\n            <property name=\"adminPassword\">${DS_ADMIN_PSWD}</property>\n            <!-- for debugging uncomment: -->\n            <!--<property name=\"jvmOptions\">-XX:MaxPermSize=256m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</property>-->\n            <property name=\"timeout\">600</property>\n        </configuration>\n    </container>\n\n    <container qualifier=\"tomee-build-managed\">\n        <configuration>\n            <!-- tomee gets copied to this directory during the build -->\n            <property name=\"dir\">target/tomee</property>\n\n            <!-- value '-1' to allow arquillian-tomee-remote to use dynamic settings -->\n            <property name=\"httpPort\">-1</property>\n            <property name=\"ajpPort\">-1</property>\n            <property name=\"stopPort\">-1</property>\n            <property name=\"appWorkingDir\">target/arquillian-test-working-dir</property>\n            <property name=\"catalina_opts\">-Dcdicontainer.version=${cdicontainer.version}</property>\n            <property name=\"simpleLog\">true</property>\n            \n            <!-- In-Memory database for the data module -->\n            <property name=\"properties\">\n                testDatabase = new://Resource?type=DataSource\n                testDatabase.JdbcDriver = org.hsqldb.jdbcDriver\n                testDatabase.JdbcUrl = jdbc:hsqldb:mem:testdb\n                testDatabase.JtaManaged = true\n            </property>\n\n        </configuration>\n    </container>\n\n    <container qualifier=\"glassfish-build-managed\">\n        <configuration>\n            <property name=\"glassFishHome\">${arquillian.glassfish_home}</property>\n            <property name=\"adminPort\">24848</property>\n        </configuration>\n    </container>\n\n    <container qualifier=\"payara-build-managed\">\n        <configuration>\n            <property name=\"payaraHome\">${arquillian.payara_home}</property>\n            <property name=\"adminPort\">24848</property>\n        </configuration>\n    </container>\n\n</arquillian>\n"
  },
  {
    "path": "doap_DeltaSpike.rdf",
    "content": "<?xml version=\"1.0\"?>\n<?xml-stylesheet type=\"text/xsl\"?>\n<rdf:RDF xml:lang=\"en\"\n         xmlns=\"http://usefulinc.com/ns/doap#\" \n         xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n         xmlns:asfext=\"http://projects.apache.org/ns/asfext#\"\n         xmlns:foaf=\"http://xmlns.com/foaf/0.1/\">\n<!--\n    Licensed to the Apache Software Foundation (ASF) under one or more\n    contributor license agreements.  See the NOTICE file distributed with\n    this work for additional information regarding copyright ownership.\n    The ASF licenses this file to You under the Apache License, Version 2.0\n    (the \"License\"); you may not use this file except in compliance with\n    the License.  You may obtain a copy of the License at\n   \n         http://www.apache.org/licenses/LICENSE-2.0\n   \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n-->\n  <Project rdf:about=\"http://deltaspike.apache.org\">\n    <created>2014-04-11</created>\n    <license rdf:resource=\"http://usefulinc.com/doap/licenses/asl20\" />\n    <name>Apache DeltaSpike</name>\n    <homepage rdf:resource=\"http://deltaspike.apache.org\" />\n    <asfext:pmc rdf:resource=\"http://deltaspike.apache.org\" />\n    <shortdesc>DeltaSpike is a collection of portable Extensions for CDI Containers</shortdesc>\n    <description>Apache DeltaSpike is  a suite of portable CDI (Contexts &amp; Dependency\nInjection) extensions intended to make application development easier when\nworking with CDI and Java EE.  Some of its key features include:\n\n- A core runtime that supports component configuration, type safe messaging\nand internationalization, and exception handling.\n- A suite of utilities to make programmatic bean lookup easier.\n- A plugin for Java SE to bootstrap both JBoss Weld and Apache OpenWebBeans\noutside of a container.\n- JSF integration, including backporting of JSF 2.2 features for Java EE 6.\n- JPA integration and transaction support.\n- A Data module, to create an easy to use repository pattern on top of JPA.\n- Quartz integration\n\nTesting support is also provided, to allow you to do low level unit testing\nof your CDI enabled projects.</description>\n    <bug-database rdf:resource=\"https://issues.apache.org/jira/browse/DELTASPIKE\" />\n    <mailing-list rdf:resource=\"http://deltaspike.apache.org/community.html#Mailinglists\" />\n    <programming-language>Java</programming-language>\n    <category rdf:resource=\"http://projects.apache.org/category/javaee\" />\n    <repository>\n      <SVNRepository>\n        <location rdf:resource=\"https://git-wip-us.apache.org/repos/asf/deltaspike.git\"/>\n        <browse rdf:resource=\"https://git-wip-us.apache.org/repos/asf?p=deltaspike.git\"/>\n      </SVNRepository>\n    </repository>\n    <maintainer>\n      <foaf:Person>\n        <foaf:name>Mark Struberg</foaf:name>\n          <foaf:mbox rdf:resource=\"mailto:struberg@apache.org\"/>\n      </foaf:Person>\n    </maintainer>\n  </Project>\n</rdf:RDF>\n"
  },
  {
    "path": "documentation/README.md",
    "content": "title: Apache DeltaSpike\n\nNotice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n\nDeltaSpike documentation\n-------------------------\n\nDeltaSpike documentation uses [Asciidoc](http://www.methods.co.nz/asciidoc/). You're welcome to contribute.\n\nLicense\n-------\nApache DeltaSpike is licensed under ALv2.\nSee the LICENSE file for the full license text.\n\nPublish procedure\n-----------------\n\nTo publish the documentation at [DeltaSpike Site](http://deltaspike.apache.org/) you have do the following steps:\n\nPut the following information in your ~/.m2/settings.xml file\n\n    <server>\n      <id>deltaspike-site</id>\n      <username><YOUR_USERNAME></username>\n      <password><YOUR_PASSWORD></password>\n    </server>\n\nTo publish to [staging area](http://deltaspike.apache.org/staging/documentation), run:\n\n    mvn clean site-deploy -Pstaging\n\nTo publish to [production area](http://deltaspike.apache.org/documentation), run:\n\n    mvn clean site-deploy\n"
  },
  {
    "path": "documentation/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>deltaspike</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike</groupId>\n    <artifactId>deltaspike-documentation</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Documentation</name>\n    <description>Documentation of DeltaSpike project.</description>\n    <url>http://deltaspike.apache.org/documentation</url>\n\n    <properties>\n        <svn.scmPubUrl>https://svn.apache.org/repos/infra/sites/deltaspike/documentation/</svn.scmPubUrl>\n    </properties>\n\n    <build>\n        <plugins>\n            <!-- Configure ASCIIDOC plugin -->\n            <plugin>\n                <groupId>org.asciidoctor</groupId>\n                <artifactId>asciidoctor-maven-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <id>output-html</id>\n                        <phase>site</phase>\n                        <goals>\n                            <goal>process-asciidoc</goal>\n                        </goals>\n                    </execution>\n                </executions>\n                <configuration>\n                    <attributes>\n                        <!-- Site Base Dir relative path -->\n                        <sitebasedir>..</sitebasedir>\n                        <docpage>documentation</docpage>\n                    </attributes>\n                </configuration>\n            </plugin>\n\n            <!-- Publis documentation online -->\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-scm-publish-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <id>scm-publish</id>\n                        <phase>site-deploy</phase>\n                        <!-- deploy documentation with maven-scm-publish-plugin -->\n                        <goals>\n                            <goal>publish-scm</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "documentation/src/main/asciidoc/build.adoc",
    "content": "= Build and Test DeltaSpike from Source\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nThe DeltaSpike source (modules and examples) is provided for inspection, contribution and testing purposes. The source must be built with Maven, which has been used to automate the compilation, testing and packaging processes. Arquillian tests are included with the source and a CDI implementation or container can be specified with which to carry out the tests.\n\nIn all cases, to obtain the DeltaSpike source, link:https://deltaspike.apache.org/download.html[download] `deltaspike-project-{latestStable}-source-release.zip` and extract the contents.\n\t\nNOTE: You can also obtain the DeltaSpike source from the project Git repository. The repository is subject to change and it can be used for contributing but should not be used in production environments. For more information, see <<source#,Contribute to the DeltaSpike Source>>. \n\n== Build without CDI Implementation Tests\nDeltaSpike can be built without executing tests against a CDI implementation, with the following commands:\n\n[source,shell,subs=\"+attributes\"]\n----\n$ cd /path/to/deltaspike-project-{latestStable}/\n$ mvn clean install\n----\n\n== Build and Test with a CDI Implementation\nTests can be executed with both the JBoss Weld and Apache OpenWebBeans CDI implementations. \n\n[cols=\"1,2a\", options=\"header\"]\n.Build Tests\n|===\n|Container |Command to Execute Arquillian Tests\n\n|JBoss Weld 1.x (CDI 1.0)\n|\n[source,shell]\n----\n$ mvn clean install -PWeld1 -Dweld.version=1.1.33.Final\n----\n\n|JBoss Weld 2.x (CDI 1.2)\n|\n[source,shell]\n----\n$ mvn clean install -PWeld2 -Dweld.version=2.3.4.Final\n----\n\n|JBoss Weld 3.x (CDI 2.0)\n|\n[source,shell]\n----\n$ mvn clean install -PWeld3 -Dweld.version=3.0.0.Alpha16\n----\n\n|Apache OpenWebBeans\n|\n[source,shell]\n----\n$ mvn clean install -POWB\n----\n|===\n\n== Build and Test with a CDI Container\nTests can be executed with JBoss Weld and Apache OpenWebBeans through Java EE 6+ application servers and containers. Configurations are currently provided as details in the table here. \n\n[cols=\"2,3a\", options=\"header\"]\n.Integration Tests\n|===\n|Container |Command to Execute Arquillian Tests\n\n|Apache TomEE\n|\n[source,shell]\n----\n$ mvn clean install -Ptomee-build-managed\n----\n\n|JBoss AS7 (without AS7 installation)\n|\n[source,shell]\n----\n$ mvn clean install -Pjbossas-build-managed-7\n----\n\n|JBoss AS7 (AS7 installation required)\n|Set `JBoss_HOME`\n\n[source,shell]\n----\n$ mvn clean install -Pjbossas-managed-7 \n----\n\n|JBoss WildFly 8 (without WildFly 8 installation)\n|\n[source,shell]\n----\nmvn clean install -Pwildfly-build-managed\n----\n\n|JBoss WildFly 8 (WildFly 8 installation required)\n|Set `WILDFLY_HOME`\n\n[source,shell]\n----\n$ mvn clean install -Pwildfly-managed\n----\n\n|Oracle GlassFish 3 (without GlassFish 3 installation)\n|\n[source,shell]\n----\nmvn clean install -Pglassfish-build-managed-3\n----\n\n|Oracle GlassFish 3.1 (GlassFish 3.1 installation required)\n|Install GlassFish (default setup without admin-password) and start\nGlassFish with `asadmin start-domain` and `asadmin start-database`.\n\n[source,shell]\n----\n$ mvn clean install -Pglassfish-remote-3.1\n----\n\n|Oracle GlassFish 4 (without Oracle GlassFish 4 installation)\n|\n[source,shell]\n----\nmvn clean install -Pglassfish-build-managed-4\n----\n\n|Oracle WebLogic 12c\n|Install WebLogic 12c. Start Configuration Wizard to create a new basic\nWebLogic Domain. Default options and domain name = base_domain,\nadministrator user name = weblogic1, administrator password = weblogic1.\nSet `WLS_HOME` so that `%WLS_HOME%.jar` exists. Start the domain.\n\n[source,shell]\n----\n$ mvn clean install -Pwls-remote-12c\n----\n|===\n\n== Build and Debug with a Java EE6+ application servers\nTests can be debugged through Java EE 6+ application servers. Configurations are currently provided as details in the table here.\n\n[cols=\"2,3a\", options=\"header\"]\n.Integration Tests with debug\n|===\n|Container |Command to Execute Arquillian Tests with remote debugging\n\n|Apache TomEE\n|Use remote debuggig at port 5005\n\n[source,shell]\n----\nmvn test -Ptomee-build-managed -Dtest=UnitTestName -Dopenejb.server.debug=true\n----\n\n|===\n\n== Next\n* For analysis of the DeltaSpike source, see https://analysis.apache.org/dashboard/index/org.apache.deltaspike:deltaspike-project\n* For information about DeltaSpike automated Jenkins builds, see https://builds.apache.org/view/A-D/view/DeltaSpike/\n\n"
  },
  {
    "path": "documentation/src/main/asciidoc/cdiimp.adoc",
    "content": "= Enable CDI For Your Java Environment\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nDeltaSpike requires a CDI implementation to be available in the Java environment where your projects are deployed. The implementation provides the CDI essentials, managing dependency injection and contextual lifecycles. link:http://weld.cdi-spec.org/[JBoss Weld] and link:http://openwebbeans.apache.org/[Apache OpenWebBeans (OWB)] are two widely used CDI implementations. Dependent on the Java environment you choose, some setup may be necessary as detailed here.\n\n== Java EE6+ Containers\nCDI is part of Java EE6 and later so CDI implementations are included as standard in Java EE6+ compliant environments. There is no additional CDI configuration needed besides including the CDI-obligatory `beans.xml` file in your project.\n\nJBoss Weld is integrated in Java EE application servers including WildFly, JBoss Enterprise Application Platform, GlassFish, IBM WebSphere Application Server (8.5.5 and up) and Oracle WebLogic.\n\nApache OpenWebBeans (OWB) is integrated in Java EE containers including Apache TomEE, Apache Geronimo, IBM WebSphere Application Server, and SiwPas.\n\n== Java EE5 and Servlet Containers\nCDI implementations are not distributed with Java EE5 application servers or Servlet-only environments such as Apache TomCat and Eclipse Jetty. You can use CDI in these environments by embedding a standalone CDI implementation. Both JBoss Weld and Apache OpenWebBeans can be used for this task; for more information, see the corresponding CDI implementation documentation.\n\n[[javase6]]\n== Java SE6+\nCDI is not part of Java SE but it can still be used. JBoss Weld and Apache OpenWebBeans implementations can be used to act as dependency injection bean managers but the respective containers must be booted manually.\n\nDeltaSpike provides a dedicated Container Control module to enable applications deployed in Java SE environments to boot a CDI container. The Container Control module consists of the API component and components specific to the JBoss Weld, Apache OpenWebBeans and Apache OpenEJB CDI containers. The DeltaSpike module provides a layer of abstraction from the specific CDI containers, enabling you to write container-independent code in your project.\n\nInstructions are provided here for adding the required resources to Maven based, Gradle based and build independent projects and subsequently booting the CDI container from your project source code.\n\n=== Declare CDI Dependencies \n\n==== Dependencies for Maven and Gradle based Projects\nFor Maven-based projects, the Container Control module is available in Maven Central together with the other DeltaSpike modules. You must configure your project to use the DeltaSpike Container Control API and one of the CDI container-specific modules.\n\n. Import the project as defined in link:/documentation/configure.html[Configure DeltaSpike in Your Projects]\n. Import the CDI Control API to your project.\na. If you're using Maven, add the following to `pom.xml`\n+\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-api</artifactId>\n    <scope>compile</scope>\n</dependency>\n----\n+\nb. If you're using Gradle, add the following to `build.gradle`\n+\n[source]\n----\ndependencies {\n    compile 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api'\n}\n----\n+\n. Add CDI container dependencies for one of the container options listed here\n- For JBoss Weld\n.. Add the JBoss Weld version to the list of properties, replacing the version as desired\n+\n[source,xml]\n----\n<properties>\n    <weld.version>2.3.3.Final</weld.version>\n</properties>\n----\n+\n.. Add the JBoss Weld dependency to the list of dependencies\n+\n[source,xml]\n----\n<dependency>\n    <groupId>org.jboss.weld.se</groupId>\n    <artifactId>weld-se</artifactId>\n    <version>${weld.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n+\n.. Add the DeltaSpike Weld-specific Container Control module to the list of dependencies\n+\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-weld</artifactId>\n    <scope>runtime</scope>\n</dependency>\n----\n+\n- JBoss Weld with Gradle\n.. If you're using Gradle, add the following to `build.gradle`\n+\n[source]\n----\ndef weldVersion = '2.3.3.Final'\ndependencies {\n    runtime 'org.jboss.weld.se:weld-se:'+weldVersion\n    runtime 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-weld'\n}\n----\n+\n- For Apache OpenWebBeans\n.. Add the Apache OpenWebBeans version to the list of properties, replacing the version as desired\n+\n[source,xml]\n----\n<properties>\n    <owb.version>1.6.3</owb.version>\n</properties>\n----\n+\n.. Add the Apache OpenWebBeans dependencies to the list of dependencies\n+\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.openwebbeans</groupId>\n    <artifactId>openwebbeans-impl</artifactId>\n    <version>${owb.version}</version>\n    <scope>runtime</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.openwebbeans</groupId>\n    <artifactId>openwebbeans-spi</artifactId>\n    <version>${owb.version}</version>\n    <scope>compile</scope>\n</dependency>\n----\n+\n.. Add the DeltaSpike Apache OpenWebBeans-specific Container Control module to the list of dependencies\n+\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-owb</artifactId>\n    <scope>runtime</scope>\n</dependency>\n----\n+\n- Apache OpenWebBeans with Gradle\n.. If you're using Gradle, add the following to `build.gradle`\n+\n[source]\n----\ndef owbVersion = '1.6.3'\ndependencies {\n    runtime 'org.apache.openwebbeans:openwebbeans-impl:'+owbVersion\n    compile 'org.apache.openwebbeans:openwebbeans-spi:'+owbVersion\n    runtime 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-owb'\n}\n----\n+\n- Save the `pom.xml` file changes\n+\n----\nmvn clean install\n----\n+\n- Save the `build.gradle` file changes\n+\n----\ngradle build\n----\n\n==== Dependencies for build independent projects\nFor build independent projects, the Container Control module is distributed together with the other DeltaSpike modules in `distribution-full-<version>.zip`. You must add two of the files from the `cdictrl` directory to your project, namely `deltaspike-cdictrl-api.jar` and the .jar file that corresponds to the CDI container you have chosen. Add these files to the project `WEB-INF/lib` or `EAR/lib` directory for .war and .ear projects respectively.\n\n== Next\n* For more information about the Container Control module, see <<container-control#,Container Control Module>>.\n* To understand how the various DeltaSpike modules can enhance and extend your applications, see <<modules#,Overview of DeltaSpike Modules>> and the individual module pages.\n* To see ready-to-deploy example DeltaSpike applications, see link:http://deltaspike.apache.org/examples.html[See DeltaSpike in Action]."
  },
  {
    "path": "documentation/src/main/asciidoc/configuration.adoc",
    "content": "= DeltaSpike Configuration Mechanism\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Introduction\n\nThe goal of the DeltaSpike configuration mechanism is to make it\nobsolete to touch released binaries for changing the configuration of\nyour project. All values which are needed in your code (but should not\nbe hardcoded as static final constants) can be maintained via\nDeltaSpike's own configuration mechanism in a very flexible and powerful\nway.\n\n=== Benefits for Production\n\nOnce a binary like a WAR file or an EAR got created and tested, it must\n_not_ get changed anymore. The exact same binary which got created by\nthe release manager will get moved to the Test system, then further\npropagated to the Staging environment and finally (if all people are\nhappy with it) will get moved to the Production system. And all this\nwithout any changes on the binary itself!\n\nThe Apache DeltaSpike configuration system makes this possible by\nproviding a default configuration inside the binary and allowing to\namend this configuration (e.g. database credentials, some URLs from\nremote REST or SOAP endpoints, etc) from outside like environment\nsettings, JNDI or the current <<projectstage.adoc#,ProjectStage>>.\n\n\n=== Drop-In Configuration\n\nThis mechanism also allows for dynamic configuration in case of a JAR\ndrop-in. By adding some JAR to the classpath, all its contained\nconfiguration will get picked up and considered in the property value\nevaluation. You could also use this mechanism to switch implementations\nof some SPI (Service Provider Interface) in your own code.\n\n=== CDI-Extension Configuration\n\nIn some cases low-level configs are needed, for example during the bootstrapping\nprocess of the CDI container.\n\nThe good news: our DeltaSpike configuration mechanism does not rely on\nany other EE mechanism to be booted. Which means it can perfectly get\nused to even configure those parts itself. Since the mechanism does not\nrely on CDI it can for example be used to configure CDI-Extensions.\n\nCurrently this is, for example, used to configure the value of the current <<projectstage.adoc#,ProjectStage>>, configured values which can be\nused in the expressions for `@Exclude`, 'Deactivatable', etc. DeltaSpike\nneeds such a low-level approach for several features internally, but\nusers can utilize it for their own needs as well. This is done by using\nthe `ConfigResolver` which resolves and caches ConfigSources per\napplication.\n\n\n== Accessing configured values using ConfigResolver\n\nThe `ConfigResolver` is the central point to access configuration in DeltaSpike. There are several different APIs\n and ways to access the individual configured values, each suitable for a different purpose:\n\n * `ConfigResolver` methods for easy programmatic access to values\n * `TypedResolver` API for typed configuration values and precise control over resolution\n * `@ConfigProperty` for injection of configured values into beans\n * interface based configuration\n\nAll four mechanisms are described in the following sections.\n\n=== ConfigResolver methods\n\nConfigResolver offers several methods for easy access to String values of configured properties.\n\n==== getPropertyValue()\n\nThe method `ConfigResolver#getPropertyValue(String key)` returns the value configured for a given key\nas `String`, or `null` if no value has been found.\n\n`ConfigResolver#getAllPropertyValues(String key)` has a similar contract\nbut it returns a list which might be empty if there are no configured\nvalues for the given key.\n\nThis is a code excerpt about how to do a simple lookup in the deltaspike\nconfiguration:\n\n[source,java]\n-------------------------------------------------------------------------------\nString dbUserName = ConfigResolver.getPropertyValue(\"databaseconfig.username\");\n-------------------------------------------------------------------------------\n\n==== getProjectStageAwarePropertyValue()\n\nThe method\n`ConfigResolver#getProjectStageAwarePropertyValue(String key)` utilizes\nthe <<projectstage.adoc#,DeltaSpike ProjectStage>> mechanism to allow\nconfigured values to depend on the current `ProjectStage` of the running system.\n\nThis is done by first looking up the ProjectStage (this internally\nhappens with the DeltaSpike ConfigResolver as well) and then go down the\nfollowing lookup chain until we found a configured value.\n\n* key + '.' + projectStage , e.g. \"databaseconfig.username.Production\"\n* key alone , e.g. \"databaseconfig.username\"\n\n==== getPropertyAwarePropertyValue()\n\nThe method\n`ConfigResolver#getPropertyAwarePropertyValue(String key, String property)`\nfirst looks up the configured value of the given property and uses this\nvalue to determine the final lookup path. All those lookups take the\n<<projectstage.adoc#,DeltaSpike ProjectStage>> mechanism into account.\n\n[source,java]\n--------------------------------------------------------------------------------------------------------\nString dbUserName = ConfigResolver.getPropertyAwarePropertyValue(\"databaseconfig.username\", \"dbvendor\");\n--------------------------------------------------------------------------------------------------------\n\n===== Property value resolution sequence\n\nThe following lookup sequence will be performed until a value is found:\nFirst, the value of the _parameter_ property is resolved:\n\n* propertyValue = property + '.' + projectStage, e.g. \"dbvendor.Production\"\n* if nothing found: propertyValue = property, e.g. \"dbvendor\"\n\nLet's assume we found the value 'mysql' for our dbvendor. In this case\nthe following lookup chain is used until a value got found:\n\n* key + '.' + propertyValue + '.' + projectstage, e.g. \"databaseconfig.username.mysql.Production\"\n* key + '.' + propertyValue, e.g. \"databaseconfig.username.mysql\"\n* key + '.' + projectStage, e.g. \"databaseconfig.username.Production\"\n* key, e.g. \"databaseconfig.username\"\n\n==== Handling of Default Values\n\nThere is a 2nd variant of all those methods where it is possible to\nprovide a default value which gets returned instead of `null` or if the\nfinal result is an empty String.\n\n.Performance Hint\nTIP: The only `ConfigResolver` operation which is cached is the determination\nof the `ConfigSources`. The various getPropertyValue operations are not\ncached in the ConfigResolver but might be cached in the ConfigSources.\nThis makes the overall calculation a bit slower, but allows for values\nto change dynamically if someone likes to for example implement a\n`JmxConfigSource` (not yet part of DeltaSpike, but easily implementable).\nYou can also use the <<configuration.adoc#DynamicReloading,TypedResolver>> with the `cacheFor(TimeUnit, long)` setting to cache the resolved values on the caller side.\n\n=== Variable Replacement in Configured Values\n\nSince version 1.6.1, DeltaSpike also supports using 'variables' inside configured values.\nYou can e.g. define a single configuration key for your server and use it in other configuration values\n-----------------------------------------------------------------\ndocument.server.url=http://localhost:8081\nmyapp.document.lists=${document.server.url}/docapp/list\nmyapp.document.admin=${document.server.url}/docadmin/app\n-----------------------------------------------------------------\n\nA variable name starts with `${` and ends with `}`.\n\nVariable support is enabled by default.\nIf you like to use the `ConfigResolver` without variable support you need to use the methods with the `evaluateVariables` parameter set to `false`.\n\n\n=== TypedResolver API\n\nVery often the configured values represent more than just strings -- number types and booleans are commonly used as\nconfiguration types. ConfigResolver provides a builder-style API to access configuration values as specific types.\n\nThe API is accessed by a call to `ConfigResolver.resolve(propertyKey)`.\n\nThe simplest usage of the API is resolution of a String property, equivalent to a call to\n`ConfigResolver.getPropertyValue(propertyKey)`.\n\n.Simple example of TypedResolver\n[source,java]\n-----------------------------------------------------------------\nString userName = ConfigResolver.resolve(\"user.name\").getValue();\n-----------------------------------------------------------------\n\nThe call to `ConfigResolver.resolve(..)` returns a builder which has methods to refine the resolution, including the\nfollowing:\n\n* `as(Class<N> clazz)` -- defines the return type of the property\n* `parameterizedBy(String propertyName)` -- sets a parameter for the resolution, similarly as in\n<<_getpropertyawarepropertyvalue, ConfigResolver.getPropertyAwarePropertyValue>>\n* `withCurrentProjectStage(boolean with)` -- indicates whether the current ProjectStage should be taken into account\nfor the resolution\n* `strictly(boolean strictly)` -- indicates, whether the <<_property_value_resolution_sequence, property value\nresolution sequence>> should be taken into account. When set to true, the sequence is not followed.\n* `withDefault(T value)` -- sets the default value, used in case the resolution returns `null`\n* `getValue()` -- terminates the builder and returns the resolved value with the appropriate type\n\n.A more complete example of TypedResolver\n[source,java]\n-----------------------------------------------------------------\nInteger dbPort = ConfigResolver\n    .resolve(\"db.port\")\n    .as(Integer.class)\n    .withProjectStage(true)\n    .parameterizedBy(\"db.vendor\")\n    .withDefault(3306)\n    .getValue();\n-----------------------------------------------------------------\n\n==== Supported types\n\nThe types supported out of the box include: String, Integer, Long, Float, Double, Boolean, Class.\nCustom types can be supported by providing an implementation of the `ConfigResolver.Converter` interface.\n\n[source,java]\n---------------------------------------------------------------------------------------------------------\nDate deadline = ConfigResolver.resolve(\"deadline\").as(Date.class, new CustomDateConverter()).getValue());\n---------------------------------------------------------------------------------------------------------\n\n[source,java]\n------------------------------------------------------------------------------------------\npublic class CustomDateConverter implements ConfigResolver.Converter<Date> {\n\n    @Override\n    public Date convert(String value)\n    {\n        String[] parts = value.split(\"-\");\n        return new GregorianCalendar(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]),\n                Integer.valueOf(parts[2])).getTime();\n    }\n}\n------------------------------------------------------------------------------------------\n\n==== Dynamic Reloading\n\nThe TypedResolver can also be used to efficiently cache configured values.\nThat way you can pick up configuration which might get changed during runtime on the fly.\nE.g. if you have a ConfigSource which picks up the values from a database table.\nInstead of resolving the configured value at the beginning you simply invoke `.getValue()` on your TypedResolver each time you need the value.\n\n.Working with dynamically changing values\n[source,java]\n-----------------------------------------------------------------\nprivate ConfigResolver.TypedResolver<String> urlConfig\n    = ConfigResolver.resolve(\"myapp.some.remote.rest.url\")\n                    .logChanges(true)\n                    .cacheFor(TimeUnit.MINUTES, 5);\n\n...\n\nconnecTo( urlConfig.getValue() );\n-----------------------------------------------------------------\nThe sample above will log any value changes in the configuration (`logChanges(true)`) and internally cache the configured value for 5 minutes (`cacheFor(TimeUnit.MINUTES, 5)`).\nOnly after that time the configured value will get evaluate again.\n\nTIP: Note that the 'cache' is only held within the very TypedResolver instance.\nIf you use different `TypedResolver` instances (e.g. in different classes) then you might get different cache timeouts.\n\n==== List Values handling\n\nAs of DeltaSpike-1.8.0, the `Typed Resolver` is also able to handle list values.\nResolve a list of e.g. retry interval values via:\n\n[source,java]\n----\nList<Integer> retryIntervals\n    = ConfigResolver.resolve(\"myapp.retry.intervalls\")\n        .as(Integer.class)\n        .asList()\n        .getValue();\n----\n\nThe values get configured as comma (`','`) separated value String.\nA Comma inside a value can be escaped with a backslash (`\\,`), backslashes should be escaped with double-backslash (`\\\\`).\nTrailing and leading whitespaces get trimmed for each value.\n\n\n=== Injection of configured values into beans using @ConfigProperty\n\nDeltaSpike provides a way to inject configured values into your code via the qualifier `@ConfigProperty`.\nThe supported types are the same as the <<_supported_types,supported types of the TypedResolver>>.\n\n[source,java]\n------------------------------------------------------\n@ApplicationScoped\npublic class SomeRandomService\n{\n    @Inject\n    @ConfigProperty(name = \"endpoint.poll.interval\")\n    private Integer pollInterval;\n\n    @Inject\n    @ConfigProperty(name = \"endpoint.poll.servername\")\n    private String pollUrl;\n\n    ...\n }\n------------------------------------------------------\n\n==== Custom ConfigProperty types\n\nCustom types can be injected using `@ConfigProperty` by providing a custom producer.\nDeltaSpike provides a base implementation for custom producers in the class `BaseConfigPropertyProducer`\nwhich offers the following methods:\n* `getStringPropertyValue` -- looks for the property name in `@ConfigProperty` annotation on the injection point.\nIf not found, it looks for it in other annotations on the injection point.\n* `getPropertyValue` -- a shortcut to <<_configresolver, ConfigResolver#getProjectStageAwarePropertyValue>>\n* `getAnnotation` -- extracts any annotation type from the injection point, useful when a custom annotation\nis used instead of `@ConfigProperty`\n\nThe following example uses `getStringPropertyValue` and a custom `@Location` annotation annotated `@ConfigProperty`.\nIn such case, the `@Location` annotation is bound to a single fixed property name and acts as a type-safe replacement\nfor `@ConfigProperty(name = \"locationId\")`.\n\n[source,java]\n--------------------------------------------------------------------\n@ApplicationScoped\npublic class CustomConfigPropertyProducer extends BaseConfigPropertyProducer {\n\n    @Produces\n    @Dependent\n    @Location\n    public LocationId produceLocationId(InjectionPoint injectionPoint)\n    {\n        String configuredValue = getStringPropertyValue(injectionPoint);\n\n        return LocationId.valueOf(configuredValue.trim().toUpperCase());\n    }\n}\n--------------------------------------------------------------------\n\n[source,java]\n-----------------------------------------------------------------\n@Target({ FIELD, METHOD })\n@Retention(RUNTIME)\n@ConfigProperty(name = \"locationId\", defaultValue = \"LOCATION_X\")\n@Qualifier\npublic @interface Location {}\n-----------------------------------------------------------------\n\nThe `@ConfigProperty` annotation doesn't need to be used at all. Instead, a custom annotation can be provided and\nobtained in the producer using `getAnnotation` and `getPropertyValue`:\n\n[source,java]\n------------------------------------------------------------------------------------------------------\n@ApplicationScoped\npublic class NumberConfigPropertyProducer extends BaseConfigPropertyProducer\n{\n    @Produces\n    @Dependent\n    @NumberConfig(name = \"unused\")\n    public Float produceNumberProperty(InjectionPoint injectionPoint) throws ParseException\n    {\n        // resolve the annotation\n        NumberConfig metaData = getAnnotation(injectionPoint, NumberConfig.class);\n\n        // get the configured value from the underlying configuration system\n        String configuredValue = getPropertyValue(metaData.name(), metaData.defaultValue());\n\n        // format according to the given pattern\n        DecimalFormat df = new DecimalFormat(metaData.pattern(), new DecimalFormatSymbols(Locale.US));\n        return df.parse(configuredValue).floatValue();\n    }\n}\n------------------------------------------------------------------------------------------------------\n\n[source,java]\n-------------------------------------------------------------------\n@Qualifier\npublic @interface NumberConfig\n{\n    @Nonbinding\n    String name();\n\n    @Nonbinding\n    String defaultValue() default ConfigProperty.NULL;\n\n    @Nonbinding\n    String pattern() default \"#0.00\";\n}\n-------------------------------------------------------------------\n\n== Interface based configuration\n\nThe interfaces decorated with `@Configuration` are converted during CDI startup\nto Beans matching the interface type. Concretely this interface:\n\n[source]\n----\n@Configuration\npublic interface MyConfig {\n}\n----\n\nWill use accessible using:\n\n[source]\n----\n@Inject\nprivate MyConfig config;\n----\n\nTo define a configuration entry in this mode you define an interface method\nand decorate it with `@ConfigProperty` exactly as a normal injection:\n\n[source]\n----\n@Configuration\npublic interface MyConfig {\n    @ConfigProperty(name = \"my.config\")\n    String url();\n}\n----\n\nTIP: this mode also supports primitives like `int`, `boolean`, ... as returned types.\n\nThe methods are no parameter and not returning void methods.\n\nIf all your keys use the same prefix you can configure it on `@Configuration`:\n\n[source]\n----\n@Configuration(prefix = \"client.\")\npublic interface MyConfig {\n    @ConfigProperty(name = \"url\")\n    String url();\n\n    @ConfigProperty(name = \"timeout\", defaultValue = \"30000\")\n    long timeout();\n}\n----\n\nFinally, you can also access the caching feature of the `TypedResolver` through `@Configuration`:\n\n[source]\n----\n@Configuration(cacheFor = 30, cacheUnit = TimeUnit.SECONDS)\npublic interface MyConfig {\n    @ConfigProperty(name = \"url\")\n    String url();\n\n    @ConfigProperty(name = \"timeout\", defaultValue = \"30000\")\n    long timeout();\n}\n----\n\n== Providing configuration using ConfigSources\n\nA `ConfigSource` is exactly what its name says: a source for configured\nvalues. The `ConfigResolver` uses all configured implementations of\n`ConfigSource` to lookup the property in question.\n\nEach 'ConfigSource' has a specified 'ordinal' which can be configured\nusing the key `deltaspike_ordinal`. This ordinal get's used to determine\nthe importance of the values taken from the very ConfigSource. A higher\nordinal means that the values taken from this ConfigSource will override\nvalues from less important ConfigSources. This is the trick which allows\nto amend configuration from outside a binary - given those outside\nConfigSources have a higher `deltaspike_ordinal` than the ones who\npickup the values from within the release binaries.\n\n=== ConfigSources Provided by Default\n\nBy default there are implementations for the following configuration sources\n(listed in the lookup order):\n\n* System properties (deltaspike_ordinal = 400)\n* Environment properties (deltaspike_ordinal = 300)\n* JNDI values (deltaspike_ordinal = 200, the base name is \"java:comp/env/deltaspike/\")\n* All apache-deltaspike.properties files on the classpath (deltaspike_ordinal = 100, default filename is \"META-INF/apache-deltaspike.properties\")\n* A property file in user.home `~/.deltaspike/apache-deltaspike.properties` (if exists, deltaspike_ordinal = 100)\n\n\n*It is possible to change this order and to add custom configuration sources.*\n\n.Important Tips Especially for Custom Implementations\nTIP: - The config-source with the highest ordinal gets used first. - If a custom\nimplementation should be invoked _before_ the default implementations,\nuse an ordinal-value > 400. - If a custom implementation should be\ninvoked _after_ the default implementations, use an ordinal-value < 100.\n- The `ConfigResolver` performs no caching. If your custom ConfigSource\noperation is expensive, then you might think about introducing some\ncaching.\n\n=== Reordering of the Default Order of ConfigSources\n\nTo change the lookup order, you have to configure the ordinal in the\ncorresponding configuration source (e.g. to change the configuration ordinal of the\nconfiguration source for system properties, you have to set the system property\nwith the ordinal key 'deltaspike_ordinal' and the new value).\n\nExample with `/META-INF/apache-deltaspike.properties`: If the properties\nfile/s should be used *before* the other implementations, you have to\nconfigure an ordinal > 400. That means, you have to add for example\n`deltaspike_ordinal=401`.\n\nEach single property file is treated as own `ConfigSource` and thus can\nhave different `deltaspike_ordinal` values!\n\nNOTE: In case of *property files* which are supported by default\n(`/META-INF/apache-deltaspike.properties`) every file is handled as\nindependent config-source, but all of them have ordinal 400 by default\n(and can be reordered in a fine-grained manner).\n\n=== Custom ConfigSources\n\nConfigSources are picked up using the `java.util.ServiceLoader'\nmechanism.\n\nTo add a custom config-source, you have to implement the interface\n`ConfigSource` and register your implementation in a file\n`/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource`\nby writing the fully qualified class name of the custom implementation/s\ninto it.\n\nIf you need dynamic ConfigSources you can also register a\n`ConfigSourceProvider` in a similar way. This is useful if you like to\ndynamically pick up multiple ConfigSources of the same kind. For example, if you\nlike to pick up all `myproject.properties` files from all the JARs in\nyour classpath.\n\nPlease note that a single `ConfigSource` should be either registered\ndirectly or via a `ConfigSourceProvider`, but never both ways.\n\nTIP: Have a look at the abstract base-implementation of `ConfigSource`\nDeltaSpike is using internally, if a custom implementation should load\nthe ordinal value from the config-source like the default\nimplementations provided by DeltaSpike do.\n\nSince 1.8.0 you can also decorate a CDI `ConfigSource` with `@Source` and it will\nbe added to DeltaSpike configuration *once the CDI container is started* (it means\nyou can't use this source in an `Extension`).\n\n==== PropertyFileConfig\n\nFor registering all your own property files of a certain name in your\nclasspath to get picked up as ConfigSources you can also provide a\nclass which implements the `PropertyFileConfig` interface.\n\nIf `getPropertyFileName()` returns an URL, e.g. `file:///var/opt/myapp/my.properties\"` then this will be used to pick up the configured values.\nIn other words: with using `file://` you can specify a file on the file system.\n\nThe method `isOptional` indicates whether your custom property file is mandatory.\nIf a mandatory property file is not found during deployment, DeltaSpike throws\nan `IllegalStateException` and stops the deployment.\n\n\n[source,java]\n---------------------------------------------------------------------\npublic class MyCustomPropertyFileConfig implements PropertyFileConfig\n{\n    @Override\n    public String getPropertyFileName()\n    {\n        return \"myconfig.properties\";\n    }\n\n    @Override\n    public boolean isOptional()\n    {\n        return false;\n    }\n}\n---------------------------------------------------------------------\n\n_Note: If you are using WildFly with EAR packaging and with\near-subdeployments-isolated=true, then your EAR should have a deployment\ndependency to the module that contains the property file._\n\n[source,xml]\n---------------------------------------------------------------------------------------------------\n<jboss-deployment-structure>\n    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>\n      <deployment>\n            <dependencies>\n            <!-- This module contains the custom PropertyFileConfig and the property file -->\n                  <module name=\"deployment.yourproject.ear.yoursubmodule.jar\"  meta-inf=\"import\" />\n            </dependencies>\n     </deployment>\n</jboss-deployment-structure>\n---------------------------------------------------------------------------------------------------\n\n== Filtering configured values\n\nIt is possible to perform filtering on all configured values on their way between the ConfigSource and user code.\nThis might be useful for example for decryption of values from an encrypted ConfigSource or to hide passwords from a\nlog.\n\nDeltaSpike doesn't provide any filters by default but custom filters can be provided by implementing the\n`ConfigFilter` interface. This is then enabled either using the ServiceLoader mechanism or by calling\n`ConfigResolver.addConfigFilter(ConfigFilter)`. Provided ConfigFilters are then enabled for the whole application.\n\nOnce some filters are provided, all operations of ConfigResolver return filtered values.\n\n.A custom ConfigFilter\n[source,java]\n-------------------------------------------------------------\npublic class DecryptingConfigFilter implements ConfigFilter\n{\n    private DefaultCipherService ciperSvc = new DefaultCipherService();\n    private String masterSalt = \"someApplicationMasterSalt\";\n\n    @Override\n    public String filterValue(String key, String value)\n    {\n        if (key.contains(\"password\"))\n        {\n            try\n            {\n                return cipherSvc.decrypt(value, masterSalt);\n            }\n            catch (Exception e)\n            {\n                return value;\n            }\n        }\n        return value;\n    }\n\n    @Override\n    public String filterValueForLog(String key, String value)\n    {\n        if (key.contains(\"password\"))\n        {\n            return \"***************\";\n        }\n\n        return value;\n    }\n}\n-------------------------------------------------------------\n\nFor more information about the `CipherService` please see the <<encryption#, Encryption>> section.\n\nSince 1.8.0 you can also decorate a CDI `ConfigFilter` with `@Filter` and it will\nbe added to DeltaSpike configuration *once the CDI container is started* (Note that this means\nyou can't use this ConfigFilter in a CDI `Extension`).\n"
  },
  {
    "path": "documentation/src/main/asciidoc/configure.adoc",
    "content": "= Configure DeltaSpike in Your Projects\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nDeltaSpike is available for use in projects of many build tools. Instructions are given here for obtaining released final versions of DeltaSpike for both approaches.\n\nNOTE: You can also opt to use the lastest DeltaSpike snapshots; for more information, see <<snapshots#,Use DeltaSpike Snapshots>>.\n\n== Maven Projects\nDeltaSpike released versions are available from the Maven Central repository for use in Maven-based projects. This means that you do not need to modify your Maven configuration `settings.xml` file; when building projects, Maven automatically searches the online Maven Central repository for project dependencies and downloads sources to your local Maven repository. \n\nTo begin use the DeltaSpike releases from Maven Central, you simply need to configure the project `pom.xml` file for each project with information about the release version and modules you want to use. At a minimum, you must add the DeltaSpike Core module, which provides the DeltaSpike API and utility classes.\n\n. Open the project `pom.xml` file for editing\n. Add the DeltaSpike version to the list of properties\n+\n[source,xml,subs=\"+attributes\"]\n----\n<properties>\n    <deltaspike.version>{latestStable}</deltaspike.version>\n</properties>\n----\n+\n. Add the DeltaSpike Core module to the list of dependencies\n+\n[source,xml]\n----\n<dependencyManagement>\n    <dependencies>\n        <dependency>\n            <groupId>org.apache.deltaspike.distribution</groupId>\n            <artifactId>distributions-bom</artifactId>\n            <version>${deltaspike.version}</version>\n            <type>pom</type>\n            <scope>import</scope>\n        </dependency>\n    </dependencies>\n</dependencyManagement>\n\n<dependency>\n    <groupId>org.apache.deltaspike.core</groupId>\n    <artifactId>deltaspike-core-api</artifactId>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.core</groupId>\n    <artifactId>deltaspike-core-impl</artifactId>\n    <scope>runtime</scope>\n</dependency>\n----\n+\n. Save the `pom.xml` file changes\n\nTIP: The API is scoped for compile time and implementation only included for runtime, assisting to prevent you from inadvertently depending on an implementation class.\n\nFor instructions on adding the optional DeltaSpike modules, see the relevant module page:\n\n* <<bean-validation#,Bean Validation>>\n* <<container-control#,Container Control>>\n* <<data#,Data>>\n* <<jpa#,JPA>>\n* <<jsf#,JSF>>\n* <<partial-bean#,Partial-Bean>>\n* <<scheduler#,Scheduler>>\n* <<security#,Security>>\n* <<servlet#,Servlet>>\n* <<test-control#,Test-Control>>\n\n[[config-gradle]]\n== Gradle Projects\n\nSetting up DeltaSpike in a Gradle based project is just as easy as Maven.\n[source,subs=\"+attributes\"]\n----\n// setup the Spring Dependency Management Plugin for Gradle, to import BOMs.\nplugins {\n    id \"io.spring.dependency-management\" version \"0.5.6.RELEASE\"\n    id \"java\" // you'll likely also want the WAR plugin\n}\nrepositories {\n    mavenCentral()\n}\ndependencyManagement {\n    imports {\n        mavenBom 'org.apache.deltaspike.distribution:distributions-bom:{latestStable}'\n    }\n}\ndependencies {\n     compile 'org.apache.deltaspike.core:deltaspike-core-api'\n     runtime 'org.apache.deltaspike.core:deltaspike-core-impl'\n}\nsourceSets {\n   main {\n     //To use standard bean discovery mechanisms, CDI expects beans.xml to be in your classes directory\n     output.resourcesDir = output.classesDir\n   }\n   test {\n        output.resourcesDir = output.classesDir\n   } // and any other sourceSet you might have.\n }\n----\n\nThis will give you a Gradle build setup to run DeltaSpike.\n\n[[config-maven-indep]]\n== Other Projects\nDeltaSpike is provided as a set of downloadable .jar files for projects not utilizing the Maven build system. Alternatively, you can build the DeltaSpike .jar files from source; for instructions, see <<build#,Build DeltaSpike from Source>>. In both cases, you must add the DeltaSpike .jar files directly to your projects.\n\nTo use DeltaSpike without Maven from the downloadable .jar files, complete the following steps:\n\n. Download the latest `distribution-full-<version>.zip` from https://deltaspike.apache.org/download.html\n. Extract the archive contents\n+\n[source,shell]\n----\n$ unzip distribution-full-<version>.zip\n----\n+\n. Add the source to your project\na. For .war projects, copy the .jar files to the `WEB-INF/lib` directory\nb. For .ear projects, copy the .jar files to the `EAR/lib directory` and add the following to `META-INF/application.xml`:\n+\n[source,xml]\n----\n<library-directory>lib</library-directory>\n----\n\n== Next\n* To check whether your Java environment needs any additional CDI-specific configuration, see <<cdiimp#,Enable CDI For Your Java Environment>>.\n* To see ready-to-deploy example DeltaSpike applications, see link:http://deltaspike.apache.org/examples.html[See DeltaSpike in Action].\n* To understand how the various DeltaSpike modules can enhance and extend your applications, see <<modules#,Overview of DeltaSpike Modules>> and the individual module pages.\n"
  },
  {
    "path": "documentation/src/main/asciidoc/container-control.adoc",
    "content": "= Container Control Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe Container Control module provides CDI container booting and shutdown, crucial for CDI use in Java SE6+ environments, and associated context lifecycle management. The module abstracts individual CDI container implementations, ensuring projects are container-independent.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== Enable CDI For Your Java Environment\nThis module requires a CDI implementation to be available in the Java environment where your projects are deployed. Dependent on the Java environment you choose, some setup may be necessary as detailed at the <<cdiimp#,Enable CDI For Your Java Environment>> page.\n\n=== Declare Container Control Module Dependencies\nAdd the Container Control module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     compile 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api'\n----\n\n== Start the CDI Container from Your Project\nTo start a CDI container in your application, you must instantiate a `CdiContainer` object and call the `#boot` method. When `#boot` is called, the `CdiContainer` scans CDI-enabled\narchives for beans and CDI extensions. Before the application exits, `#shutdown` must be called to correctly destroy all beans. An example is given in the code snippet here.\n\n[source,java]\n----\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\n\npublic class MainApp {\n    public static void main(String[] args) {\n\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        cdiContainer.boot();\n\n        // You can use CDI here\n\n        cdiContainer.shutdown();\n    }\n}\n----\n\nStarting the container does not automatically start all CDI Contexts. Contexts must be started independently using the provided `ContextControl` class. An example of starting the Context for `@ApplicationScoped` beans is added to the code snippet here.\n\n[source,java]\n----\nimport org.apache.deltaspike.cdise.api.CdiContainer;\nimport org.apache.deltaspike.cdise.api.CdiContainerLoader;\nimport org.apache.deltaspike.cdise.api.ContextControl;\nimport jakarta.enterprise.context.ApplicationScoped;\n\npublic class MainApp {\n    public static void main(String[] args) {\n\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n        cdiContainer.boot();\n\n        // Starting the application-context enables use of @ApplicationScoped beans\n        ContextControl contextControl = cdiContainer.getContextControl();\n        contextControl.startContext(ApplicationScoped.class);\n\n        // You can use CDI here\n\n        cdiContainer.shutdown();\n    }\n}\n----\n\nTo resolve project beans, you can use the DeltaSpike `BeanProvider` class. Whether `EchoService` is a concrete implementation or just an interface depends on the application. In the case that it is an interface, the corresponding implementation is resolved. The resolved bean is a standard CDI bean and it can be used for all CDI concepts, such as `@Inject`, in the class without further uses of `BeanProvider`. An example of resolving the bean without qualifiers is given in the code snippet here.\n\n[source,java]\n----\nEchoService echoService = BeanProvider.getContextualReference(EchoService.class, false);\n----\n\n== CdiContainer\nThe `CdiContainer` interface provides booting and shutdown of the CDI containers from deployed applications, with `CdiContainerLoader` a simple factory providing access to the underlying `CdiContainer` implementation.\n\nThis is useful to Java SE6+ applications in which a standalone CDI implementation must be provided and booted and shutdown by the application. Booting and shutdown of the CDI container for Java EE and servlet containers is managed by the servlet container integration.\n\nFor instructions and examples on using this feature in your projects, see <<cdiimp#javase6,Enable CDI For Your Java Environment: Java SE6+>>.\n\n== ContextControl Usage\nThe `ContextControl` interface provides life-cycle control of the CDI container built-in contexts. This includes starting and stoping built-in standard contexts like `@RequestScoped`, `@ConversationScoped`, and `@SessionScoped`. It is provided as an `@Dependent` bean and can be injected in the classic CDI way. This feature can be used and is helpful in all Java environments, including Java SE, as illustrated here.\n\n== Procedure for building an uber jar\nUber jar or executable jar can created by using the maven shade plugin. Some things you needs to be aware of when you use it.\n\n* Multiple `beans.xml` and `jakarta.enterprise.inject.spi.Extension` files needs to be merged into the final jar using a transformer.\n[source,xml]\n----\n<transformer implementation=\"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer\"/>\n----\n* The _asm:asm:3.3.1_ transitive dependency of OpenWebBeans isn't properly included in the Uber jar.  Add it as a project dependency if you use OWB. (Only needed for OWB 1.1.8 !)\n* Some frameworks, like logging frameworks, aren't CDI compatible.  So you need to exclude them from scanning. Use for example the `scan` feature of Weld to define which packages needs to be excluded.\n\n=== Restart the RequestContext in Unit Tests\nIn unit testing it can be necessary to test with attached and also with\ndetached JPA entities. A very common approach for JPA is the\nhttp://docs.redhat.com/docs/en-US/JBoss_Enterprise_Web_Server/1.0/html/Hibernate_Entity_Manager_Reference_Guide/transactions.html[entitymanager-per-request\napproach] and thus have a producer method which creates a @RequestScoped\nEntityManager. Since a single unit test is usually treated as one\n‘request’ a problem arises detaching entities.\n\n.Using ContextControl to Detach Entities\n[source,java]\n---------------------------------------------------------------------------------------\n@Test\npublic void testMyBusinessLogic()\n{\n    doSomeJpaStuff()\n    MyEntity me = em.find(...);\n\n    ContextControl ctxCtrl = BeanProvider.getContextualReference(ContextControl.class);\n\n    //stop the RequestContext to dispose of the @RequestScoped EntityManager\n    ctxCtrl.stopContext(RequestScoped.class);\n\n    //immediately restart the context again\n    ctxCtrl.startContext(RequestScoped.class);\n\n    //the entity 'em' is now in a detached state!\n    doSomeStuffWithTheDetachedEntity(em);\n}\n---------------------------------------------------------------------------------------\n\n=== Attach a RequestContext to a New Thread in EE\nAccessing the `@RequestScoped` bean in a new thread will result in a\n`ContextNotActiveException`. The RequestContext usually gets started\nfor a particular thread via a simple `ServletRequestListener`. So \"no\nservlet-request\" means that there is no Servlet-Context for the current\n(/new) Thread. You might face such issues, if you would like to reuse\nbusiness services in for example a Quartz Job.\n\n.Using ContextControl to Control the RequestContext for a Quartz-Job\n[source,java]\n---------------------------------------------------------------------------------------------\npublic class CdiJob implements org.quartz.Job\n{\n    public void execute(JobExecutionContext context) throws JobExecutionException\n    {\n        ContextControl ctxCtrl = BeanProvider.getContextualReference(ContextControl.class);\n\n        //this will implicitly bind a new RequestContext to the current thread\n        ctxCtrl.startContext(RequestScoped.class);\n\n        try\n        {\n            doYourWork();\n        }\n        finally\n        {\n            //stop the RequestContext to ensure that all request-scoped beans get cleaned up.\n            ctxCtrl.stopContext(RequestScoped.class);\n        }\n    }\n}\n---------------------------------------------------------------------------------------------\n\n== Embedded Servlet Support\nFrom DeltaSpike 1.0.2, you can use DeltaSpike to power embedded Servlet\nruntimes. This work is done via Servlet Listeners. The configuration is\nspecific to each container, below are some examples.\n\nThe two main listeners are `CdiServletRequestListener` and\n`CdiServletContextListener`. `CdiServletRequestListener` is responsible\nfor starting a `RequestContext` on each incoming request. In most\ncontainers this is all you need. For Tomcat specifically, you need to\nuse `CdiServletContextListener` which registers the\n`CdiServletRequestListener`.\n\nThe main use case for this feature is for lightweight embedded runtimes,\nmicroservices. For each of these, it is assumed that you are using the\nfollowing start up code somewhere:\n\n[source,java]\n-----------------------------------------------------------------\nCdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\ncdiContainer.boot();\ncdiContainer.getContextControl().startContexts();\n-----------------------------------------------------------------\n\n=== Jetty\n\nFor Jetty, you need to add an `EventListener` which will be your\n`CdiServletRequestListener`. The object must be instantiated. This must\nbe done before the server is started.\n\n[source,java]\n------------------------------------------------------------------------------------------\nServer server = new Server(port);\nServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);\ncontext.setContextPath(\"/\");\nserver.setHandler(context);\n\ncontext.addEventListener(new CdiServletRequestListener());\ncontext.addServlet(new ServletHolder(new YourServlet()),\"/*\");\n\nserver.start();\n------------------------------------------------------------------------------------------\n\n=== Undertow\n\nFor Undertow, you register the `CdiServletRequestListener` via\n`ListenerInfo` by passing in the class to their builders. Then you add\nthe `ListenerInfo` to your deployment before starting.\n\n[source,java]\n--------------------------------------------------------------------------------------------------------\nServletInfo servletInfo = Servlets.servlet(\"YourServletName\", YourServlet.class).setAsyncSupported(true)\n    .setLoadOnStartup(1).addMapping(\"/*\");\nListenerInfo listenerInfo = Servlets.listener(CdiServletRequestListener.class);\nDeploymentInfo di = new DeploymentInfo()\n        .addListener(listenerInfo)\n        .setContextPath(\"/\")\n        .addServlet(servletInfo).setDeploymentName(\"CdiSEServlet\")\n        .setClassLoader(ClassLoader.getSystemClassLoader());\nDeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(di);\ndeploymentManager.deploy();\nUndertow server = Undertow.builder()\n        .addHttpListener(port, \"localhost\")\n        .setHandler(deploymentManager.start())\n        .build();\nserver.start();\n--------------------------------------------------------------------------------------------------------\n\n=== Tomcat\n\nFor Tomcat, you need to register the `CdiServletContextListener` instead\nof the `CdiServletRequestListener`. It is added as an\n`ApplicationListener` by passing in the class name as a `String`.\n\n[source,java]\n-----------------------------------------------------------------------------------\nTomcat tomcat = new Tomcat();\ntomcat.setPort(port);\nFile base = new File(\"...\");\nContext ctx = tomcat.addContext(\"/\",base.getAbsolutePath());\nStandardContext standardContext = (StandardContext)ctx;\nstandardContext.addApplicationListener(CdiServletContextListener.class.getName());\nWrapper wrapper = Tomcat.addServlet(ctx,\"YourServlet\",YourServlet.class.getName());\nwrapper.addMapping(\"/*\");\ntomcat.start();\n-----------------------------------------------------------------------------------\n"
  },
  {
    "path": "documentation/src/main/asciidoc/core.adoc",
    "content": ":modulebase: core\n:moduleconf: api:org.apache.deltaspike.core.api.config.base.CoreBaseConfig\n\n= Core Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nThe Core module provides fundamental and defining DeltaSpike API and utility classes. As such, this module must be included in every project that uses DeltaSpike.\nInstructions for configuring your projects to use the DeltaSpike Core module are detailed in\n<<configure#, Configure DeltaSpike in Your Projects>> as part of the general instructions for configuring your projects for DeltaSpike.\n\n== Project Setup\n\nAdd Core-API and Core-Impl to your project as detailed in <<configure#, Configure DeltaSpike Core in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike Core in Maven-independent Projects>>.\n\n== DeltaSpike Configuration\n\nDeltaSpike provides a very flexible application configuration mechanism. Its main goal is to make it possible\nto never have to rebuild a project just for the sake of adjusting configuration values. It respects the usual\nsoftware development cycle and takes into account project stages, various configuration sources and resolution\nmechanisms. Configuration can be overridden just by dropping a JAR into the classpath.\n\nDetailed documentation is available on a separate page: <<configuration.adoc#,Configuration>>.\n\n== DeltaSpike CipherService\n\nApache DeltaSpike also provides an <<encryption#, Encryption>> mechanism for handling secret values within your application.\n\n=== Internal configuration\n\nThe functionality of DeltaSpike itself and its modules is adjustable using the same mechanism. There are two main\ntypes of internal configuration:\n\n* *static configuration:* certain configurable options, like the maximum number of windows in the window scope or the\n priority for DeltaSpike's global interceptors, are defined using the DeltaSpike configuration mechanism and can be\n adjusted by redefining their value in the `apache-deltaspike.properties` file, as described in the\n <<configuration.adoc#,documentation>>. All of these configuration options and their corresponding properties can be\n found as members of interfaces extending `DeltaSpikeBaseConfig`, e.g. `CoreBaseConfig` which configures the core\n  module.\n\n* *dynamic configuration:* certain values can change dynamically during runtime and some may differ even among\ncontexts. For example, much of the behaviour of the JSF module is configured in `JsfModuleConfig`. To override any of\n the default configuration options, the `JsfModuleConfig` bean can be overridden using a custom implementation of\n `JsfModuleConfig` which would be annotated `@Alternative` or `@Specializes`. All of the dynamic CDI-based\n configuration beans can be found as implementations of the `DeltaSpikeConfig` interface.\n\n== BeanProvider\n\nThe `BeanProvider` utility class provides static methods for manual lookup of bean instances in places where\nstandard injection is not available or if the lookup depends on dynamic conditions.\n\nWARNING: `BeanProvider` is only used to look up normal-scoped contextual\ninstances. To obtain instances of dependent-scoped beans, use <<_dependentprovider, DependentProvider>>.\n\nNOTE: The term 'contextual instance' is used instead of 'bean' because that's the term used by CDI itself.\n\nThe following example shows a simple lookup. With the second parameter\nit is possible to specify if the contextual instance is optional. If it\nis not expected that the contextual instance is optional, but no instance\nhas been found, an `IllegalStateException` will be thrown.\n\n.Resolving a Simple Contextual Instance\n[source,java]\n-------------------------------------------------------------------------\nMyBean myBean = BeanProvider.getContextualReference(MyBean.class, false);\n-------------------------------------------------------------------------\n\nPass `true` as second argument, if you look for an implementation of the\ngiven interface and an implementation is not required or it is not\nrequired that there is an instance with the given qualifier (see the\nqualifier example for further details).\n\n.Resolving an Optional Contextual Instance\n[source,java]\n---------------------------------------------------------------------------------------------------------\nMyServiceInterface optionalService = BeanProvider.getContextualReference(MyServiceInterface.class, true);\n---------------------------------------------------------------------------------------------------------\n\nOptionally you can provide a qualifier for the contextual instance in\nquestion. CDI qualifiers are annotations, therefore you need to\nimplement a corresponding literal for providing an instance.\n\n.Literal Implementation for '@MyQualifier'\n[source,java]\n---------------------------------------------------------------------------------------------\nimport jakarta.enterprise.util.AnnotationLiteral;\n//...\n\npublic class MyQualifierLiteral extends AnnotationLiteral<MyQualifier> implements MyQualifier\n{\n}\n---------------------------------------------------------------------------------------------\n\nThe following example will return a contextual instance with the\nqualifier `@MyQualifier`.\n\n.Resolving a Simple Contextual Instance with Qualifier\n[source,java]\n---------------------------------------------------------------------------------------------------\nMyBean myBean = BeanProvider.getContextualReference(MyBean.class, false, new MyQualifierLiteral());\n---------------------------------------------------------------------------------------------------\n\nThe `@Named` qualifier has a special role and allows to specify a string\nbased name (e.g. for referencing CDI beans in EL-expressions). However,\nthe following examples show how to do a manual lookup by name.\n\n.Resolving a Simple Contextual Instance by Name\n[source,java]\n---------------------------------------------------------------------\nObject myBean = BeanProvider.getContextualReference(\"myBean\", false);\n---------------------------------------------------------------------\n\n.Resolving a Simple Contextual Instance by Name and Expected Type\n[source,java]\n-----------------------------------------------------------------------------------\nMyBean myBean = BeanProvider.getContextualReference(\"myBean\", false, MyBean.class);\n-----------------------------------------------------------------------------------\n\nSometimes it is essential to resolve all contextual instances which\nimplement for example an interface or all beans with the same type but a\ndifferent qualifier. The following example shows how to do such a lookup\nwhich returns all contextual instances (independent of the scope -> also\ndependent scoped instances).\n\n.Resolving All Contextual Instances of a Given Type\n[source,java]\n---------------------------------------------------------------------------------------------------------------\nList<MyServiceInterface> myServiceList = BeanProvider.getContextualReferences(MyServiceInterface.class, false);\n---------------------------------------------------------------------------------------------------------------\n\nSince dependent scoped beans have a special role in CDI (you have to\ndestroy them manually - especially if you get them via a manual lookup), you\ncan also call the previous util method with an additional parameter to\nfilter dependent scoped instances.\n\n.Resolving All Contextual Instances of a Given Type without Dependent-scoped Instances\n[source,java]\n----------------------------------------------------------------------------------------------------------------------\nList<MyServiceInterface> myServiceList = BeanProvider.getContextualReferences(MyServiceInterface.class, false, false);\n----------------------------------------------------------------------------------------------------------------------\n\nFurthermore, it is possible to trigger the injection of fields of any\ngiven instance, if it was not done by the container (e.g. because the\nclass is in a jar-file without beans.xml) and `@Inject` is used for 1-n\nfields.\n\n.Manually Inject Fields\n[source,java]\n------------------------------------\nBeanProvider.injectFields(myObject);\n------------------------------------\n\n=== DependentProvider\n\n`DependentProvider` must be used instead of `BeanProvider` to obtain instances of dependent-scoped beans to allow for\ntheir proper destruction.\n\nWhen obtaining contextual instances using `@Inject`, the normal-scoped ones get destroyed along with their associated\ncontext. However, instances of dependent-scoped beans -- as implied by their name -- depend on the lifecycle of\nthe contextual instance which declares them and get destroyed along with this declaring bean's instance.\n\nHowever, if dependent-scoped instances are obtained programmatically using `DependentProvider`, there's no\n\"declaring bean\" to speak of and they *must be destroyed manually*.\n\n.Obtaining and destroying an instance of a dependent-scoped bean using DependentProvider\n[source,java]\n-----------------------------------------------------------------------------------\nDependentProvider<MyBean> myBeanProvider = BeanProvider.getDependent(MyBean.class);\nMyBean myBean = myBeanProvider.get();\n\n// ...work with myBean...\n\nmyBeanProvider.destroy();\n-----------------------------------------------------------------------------------\n\n== BeanManagerProvider\n\nThis mechanism provides access to the `BeanManager` by registering the\ncurrent `BeanManager` during the startup. This is really handy if you\nlike to access CDI functionality from places where no CDI based\ninjection is available. If a simple but manual bean-lookup is needed,\nit is easier to use the `BeanProvider`.\n\n.Resolving the BeanManager\n[source,java]\n-----------------------------------------------------------------------------\n//in most cases the following works without problems:\n@Inject\nprivate BeanManager beanManager;\n\n//use\nBeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();\n\n//if CDI based injection is not available.\n-----------------------------------------------------------------------------\n\n`BeanManagerProvider` uses a different approach to find the correct `BeanManager`,\nbecause a portable API for it has only been available from CDI 1.1.\nHowever, once you are using CDI 1.1+ DeltaSpike delegates the lookup to the CDI container\ninstead of using its own approach.\nIf you migrate from CDI 1.0 to a later version of CDI and you would like to keep\nthe lookup strategy you used before, you can deactivate the delegation to the container by adding\n`deltaspike.bean-manager.delegate_lookup=false` to your config-source\n(e.g. in `/META-INF/apache-deltaspike.properties`).\n\n\n== AnnotationInstanceProvider\n\nJava EE provides a standard mechanism for obtaining annotation instances -- the `AnnotationLiteral` class.\n\n[source,java]\n------------------------------------------------------------------------------------------------\npublic class CurrentUserLiteral extends AnnotationLiteral<CurrentUser> implements CurrentUser {}\n------------------------------------------------------------------------------------------------\n[source,java]\n-----------------------------------------------\nCurrentUser user = new CurrentUserLiteral() {};\n-----------------------------------------------\n\n`AnnotationLiteral` can however be used only if the annotation class name is known beforehand.\n`AnnotationInstanceProvider` is the solution for dynamic creation of annotation instances, with\nthe option to provide a map of values for annotation members. That might be useful in many situations,\nespecially for CDI extension authors. For example:\n\n* avoiding a compile-time dependency on an annotation class\n+\n[source,java]\n--------------------------------------------------------------------------------------------------------------------\nClass<? extends Annotation> priorityAnnotationClass = ClassUtils.tryToLoadClassForName(\"javax.annotation.Priority\");\npriorityAnnotationInstance = AnnotationInstanceProvider.of(priorityAnnotationClass, mapOfMemberValues);\n--------------------------------------------------------------------------------------------------------------------\n\n* getting an instance of a dynamically obtained annotation class\n+\n[source,java]\n-------------------------------------------------------------------------------------------------------\nAnnotation exceptionQualifier = AnnotationInstanceProvider.of(jsfModuleConfig.getExceptionQualifier());\n-------------------------------------------------------------------------------------------------------\n\n* or simply for the sake of a prettier syntax compared to `AnnotationLiteral`\n+\n[source,java]\n-------------------------------------------------------------------------\nCurrentUser principal = AnnotationInstanceProvider.of(CurrentUser.class);\n-------------------------------------------------------------------------\n\n== Type-safe ProjectStage\n\nThe DeltaSpike <<projectstage.adoc#,ProjectStage>> mechanism allows to use configuration and implementations depending on the server environment you currently run on.\n\nDeltaSpike provides some pre-defined <<projectstage.adoc#_introduction,ProjectStages>> but it's also possible to create your own <<projectstage.adoc#_custom_project_stages,Custom Project Stage>>, Please, check the <<projectstage.adoc#,DeltaSpike ProjectStage>> page for more details.\n\n== @Exclude\n\nWith `@Exclude` it is possible to annotate beans which should be ignored\nby CDI even if they are in a CDI enabled archive.\n\n.Excluding a Bean in any Case\n[source,java]\n-------------------\n@Exclude\npublic class NoBean\n{\n}\n-------------------\n\n.Excluding a Bean in Case of ProjectStageDevelopment\n[source,java]\n---------------------------------------------------------\n@Exclude(ifProjectStage = ProjectStage.Development.class)\npublic class MyBean\n{\n}\n---------------------------------------------------------\n\n.Excluding a Bean if the ProjectStage is different from Development\n[source,java]\n---------------------------------------------------------------\n@Exclude(exceptIfProjectStage = ProjectStage.Development.class)\npublic class MyDevBean\n{\n}\n---------------------------------------------------------------\n\nThe following usage allows to exclude a bean based on a configured value\n(see the <<configuration.adocl#_configsources_provided_by_default,supported configuration sources>>).\n\n.Excluding a Bean based on an Expression which Evaluates to True\n[source,java]\n-------------------------------------\n@Exclude(onExpression = \"db==prodDB\")\npublic class DevDbBean\n{\n}\n-------------------------------------\n\nBy default a simple syntax is supported ([TODO]), however, it is possible\nto provide a custom `ExpressionInterpreter` for interpreting custom\nexpressions.\n\n.Excluding a Bean based on a Custom Expression\n[source,java]\n------------------------------------------------------------------------------------------\n@Exclude(onExpression = \"db eq prodDB\", interpretedBy = SimpleExpressionInterpreter.class)\npublic class DevDbBean\n{\n}\n\npublic class SimpleExpressionInterpreter implements ExpressionInterpreter<String, Boolean>\n{\n    @Override\n    public Boolean evaluate(String expression)\n    {\n        if(expression.contains(\" eq \"))\n        {\n            //...\n        }\n        //...\n    }\n}\n------------------------------------------------------------------------------------------\n\nIn several cases it is also useful to combine this feature with the `@Alternative` annotation provided by CDI.\n\nIn addition to the following snippet, it is required to configure the\nimplementation as alternative in the beans.xml file. This configuration entry\nwill not be changed, for example for different environments, because it just gets\nactive if it is not excluded during the bootstrapping process.\n\n.Excluding an Alternative implementation if the ProjectStage is different from Development\n[source,java]\n---------------------------------------------------------------\n@Exclude(exceptIfProjectStage = ProjectStage.Development.class)\n@Alternative\npublic class MyDevBean\n{\n}\n---------------------------------------------------------------\n\n=== Custom ExpressionInterpreter\n\nBy default only a very simple and limited syntax is supported. In real\nprojects there are usually quite concrete requirements. Since it would\nbe very complex to support most of them, it is easier for users to\nimplement an optimized syntax. For such cases a custom\nExpressionInterpreter is needed:\n\n[source,java]\n----------------------------------------------------------------------------------------------------\n@Alternative\n@Exclude(onExpression = \"environment!=HSQL\", interpretedBy = ConfigAwareExpressionInterpreter.class)\npublic class DevDbBean implements DbBean\n{\n}\n\npublic class ConfigAwareExpressionInterpreter implements ExpressionInterpreter<String, Boolean>\n{\n    public Boolean evaluate(String expression)\n    {\n        if (expression == null)\n        {\n            return false;\n        }\n\n        String[] values = expression.split(\"!=\");\n\n        if (values.length != 2)\n        {\n            throw new IllegalArgumentException(\"'\" + expression + \"' is not a supported syntax\");\n        }\n\n        String configuredValue = ConfigResolver.getPropertyValue(values[0], null);\n\n        //exclude if null or the configured value is different\n        return configuredValue == null || !values[1].trim().equalsIgnoreCase(configuredValue);\n    }\n}\n----------------------------------------------------------------------------------------------------\n\n== Type-safe View-Config\n\nTODO (Overview)\n\n== Literals\n\nLiterals allow the instantiation of annotations by extending the\nabstract class `jakarta.enterprise.util.AnnotationLiteral`\n\n.Example\n[source,java]\n----------------------------------------------------------------------------------------------\npublic abstract class PayByQualifier\n       extends AnnotationLiteral<PayBy>\n       implements PayBy {}\n\n PayBy paybyCheque = new PayByQualifier() { public PaymentMethod value() { return CHEQUE; } };\n----------------------------------------------------------------------------------------------\n\nDeltaSpike provides many annotation literals that you can use, including the following:\n\n* AlternativeLiteral\n* AnyLiteral\n* ApplicationScopedLiteral\n* ConversationScopedLiteral\n* DefaultLiteral\n* DependentScopeLiteral\n* ModelLiteral\n* NamedLiteral\n* NewLiteral\n* RequestedScopeLiteral\n* SessionScopeLiteral\n* Singleton\n* SpecializesLiteral\n* TypedLiteral\n\n== Messages and i18n\n\nThe following implementation is the minimal effort to use type-safe\nmessages (which are hardcoded in this case).\n\n.Simple Type-safe Message\n[source,java]\n---------------------------------------------\n@MessageBundle\npublic interface SimpleMessage\n{\n    @MessageTemplate(\"Welcome to DeltaSpike\")\n    String welcomeToDeltaSpike();\n}\n---------------------------------------------\n\nThe following implementation uses the key `welcome_to_deltaspike` to do\na lookup in the default message bundle. The default bundle has the same\nname as the interface (but .properties instead of .java (/.class) as\nfile extension).\n\n.Internationalized Type-safe Message\n[source,java]\n-----------------------------------------------------------------\n@MessageBundle\npublic interface SimpleMessage\n{\n    @MessageTemplate(\"{welcome_to_deltaspike}\")\n    String welcomeToDeltaSpike();\n}\n\norg.apache.deltaspike.example.message.SimpleMessage\n\n->\n\norg/apache/deltaspike/example/message/SimpleMessage.properties\norg/apache/deltaspike/example/message/SimpleMessage_en.properties\norg/apache/deltaspike/example/message/SimpleMessage_de.properties\n...\n\n//content (as usual in message bundle files):\nwelcome_to_deltaspike=Welcome to DeltaSpike\n-----------------------------------------------------------------\n\nThe following implementation uses the key `welcome_to_deltaspike` to do\na lookup in a custom message bundle known by `CustomMessageResolver`.\n\n.Internationalized Type-safe Message\n[source,java]\n--------------------------------------------------------------------\n@MessageBundle\n@MessageContextConfig(messageResolver = CustomMessageResolver.class)\npublic interface SimpleMessage\n{\n    @MessageTemplate(\"{welcome_to_deltaspike}\")\n    String welcomeToDeltaSpike();\n}\n--------------------------------------------------------------------\n\n`@MessageContextConfig` allows to provide a custom `MessageResolver`,\n`MessageInterpolator` and `LocaleResolver`.\n\nThe following implementation shows the usage of an internationalized\nsimple type-safe message.\n\n.Internationalized Type-safe Message with Parameter/s\n[source,java]\n----------------------------------------------------------------------------\n@MessageBundle\n@MessageContextConfig(messageInterpolator = CustomMessageInterpolator.class)\npublic interface SimpleMessage\n{\n    //in the message bundle: welcome_to=Welcome to %s\n\n    @MessageTemplate(\"{welcome_to}\")\n    String welcomeTo(String name);\n}\n\n//...\npublic class MyBean\n{\n    @Inject\n    private SimpleMessage messages;\n\n    public String welcomeToDeltaSpike\n    {\n        return this.messages.welcomeTo(\"DeltaSpike\");\n    }\n}\n----------------------------------------------------------------------------\n\n=== Dynamic Message Builder\n\n==== Creating Message Instances\n\nThe following implementation creates an instance of `Message` for the\nkey `hello`. The final text will be resolved and interpolated lazily.\nLater on it might be supported to provide a different `MessageContext`\nvia `#toString(MessageContext)` like it is in MyFaces CODI right now.\n\nYou can use `#argument(String)` to pass these arguments to the message\ntemplate specified on `#template(String)` method. The template pattern\nuses printf-style format strings.\n\n[source,java]\n---------------------------------------------------------------------------------------------\npublic class MyBean\n{\n\n    @Inject\n    private MessageContext messageContext;\n\n    public void action()\n    {\n        Message message = this.messageContext.message();\n        write(message.template(\"Hello %s from %s\").argument(\"World\").argument(\"DeltaSpike\"));\n    }\n    //...\n}\n---------------------------------------------------------------------------------------------\n\nBesides the static configuration via `@MessageContextConfig#messageSource`, you\ncan also specify the message sources dynamically.\n\n[source,java]\n--------------------------------------------------------------------------------------------------------------------\n@Inject\nprivate MessageContext messageContext;\n\npublic void action()\n{\n    Message message = this.messageContext.messageSource(\"org.apache.deltaspike.example.message.Messages\").message();\n    write(message.template(\"{hello}\").argument(\"World\").argument(\"DeltaSpike\"));\n}\n//...\n->\n\norg/apache/deltaspike/example/message/Messages.properties\norg/apache/deltaspike/example/message/Messages_en.properties\norg/apache/deltaspike/example/message/Messages_de.properties\n...\n\n//content (as usual) in message bundle files:\nhello=Hello %s from %s\n--------------------------------------------------------------------------------------------------------------------\n\n==== Customizing the Message Context\n\n===== MessageResolver\n\nA message-resolver is responsible for creating the message-text based on\nthe message-descriptor (key or inline-text), the current locale (and in\nsome cases the message-payload). (The supported format, for example, if it is\nrequired to escape a key, if inline-text is supported,... depends on the\nconcrete implementation.) In case of a message-key, the message-resolver\nhas to transform it to the message-text by looking it up in a message\nsource like a resource-bundle.\n\n*Configuration of a message-resolver*\n\nBesides the static configuration via `@MessageContextConfig#messageResolver`,\nyou can use it dynamically via passing a custom message-resolver\ninstance to the current messageContext:\n\n[source,java]\n---------------------------------------------------------------------------------------------\n@Inject\nprivate MessageContext messageContext;\n\n//...\n\nMessage message = this.messageContext.messageResolver(new CustomMessageResolver()).message();\n---------------------------------------------------------------------------------------------\n\nThe result of a `MessageResolver` is the message-text. The text might\ncontain placeholders which are processed by a `MessageInterpolator`\n\n===== MessageInterpolator\n\nA `MessageInterpolator` replaces the placeholders in a message-text with\nthe arguments of the message.\n\n*Configuration of a message-interpolator*\n\nBesides the static configuration via\n`@MessageContextConfig#messageInterpolator, you can use it dynamically\nvia passing a custom message-interpolator instance to the current\nmessageContext:\n\n[source,java]\n-----------------------------------------------------------------------------------------------------\n@Inject\nprivate MessageContext messageContext;\n\n//...\nMessage message = this.messageContext.messageInterpolator(new CustomMessageInterpolator()).message();\n-----------------------------------------------------------------------------------------------------\n\n===== LocaleResolver\n\nA locale resolver provides the current locale. The locale is, for example, used\nto by a `MessageResolver` to choose the correct language for the\nmessage-text.\n\n*Configuration of a locale-resolver*\n\nBesides the static configuration via `@MessageContextConfig#localeResolver, you\ncan use it dynamically via passing a custom locale-resolver instance to\nthe current messageContext:\n\n-------------------------------------------------------------------------------------------\n@Inject\nprivate MessageContext messageContext;\n\n//...\nMessage message = this.messageContext.localeResolver(new CustomLocaleResolver()).message();\n-------------------------------------------------------------------------------------------\n\n== Injecting Resources\n\nDeltaSpike has simple APIs for performing basic resource loading and\nproperty file reading.\n\n[source,java]\n----------------------------------------\n@Inject\n@InjectableResource(location=\"myfile.properties\")\nprivate InputStream inputStream;\n----------------------------------------\n\nThis can be used to read resources from the classpath or from the file\nsystem using the two default implementations -- `ClasspathResourceProvider`\nand `FileResourceProvider` -- or from any other source using a custom provider.\n\n=== Custom resource providers\n\nThe `InjectableResourceProvider` interface can be implemented to allow reading from\nalternate sources if needed (e.g. database LOBs, NoSQL storage areas). A base class called `AbstractResourceProvider`\nis provided by DeltaSpike and contains most of the methods for potential implementations. The only method which must be\nprovided is the `readStream(InjectableResource)` which returns an InputStream.\n\n\n== Exception Control\n\nException handling in DeltaSpike is based around the CDI eventing model.\nWhile the implementation of exception handlers may not be the same as a\nCDI event, and the programming model is not exactly the same as\nspecifying a CDI event observer, the concepts are very similar.\nDeltaSpike makes use of events for many of its features. Eventing is\nactually the only way to start using DeltaSpike's exception handling.\n\nThis event is fired either by the application or a DeltaSpike exception\nhandling integration. DeltaSpike then hands the exception off to a chain\nof registered handlers, which deal with the exception appropriately. The\nuse of CDI events to connect exceptions to handlers makes this strategy\nof exception handling non-invasive and minimally coupled to the\nexception handling infrastructure.\n\nThe exception handling process remains mostly transparent to the\ndeveloper. In most cases, you register an exception handler simply by\nannotating a handler method. Alternatively, you can handle an exception\nprogrammatically, just as you would observe an event in CDI.\n\n=== Usage\n\nThe entire exception handling process starts with an event. This helps\nkeep your application minimally coupled to DeltaSpike, but also allows\nfor further extension. Exception handling in DeltaSpike is all about\nletting you take care of exceptions the way that makes the most sense\nfor your application Events provide this delicate balance. Firing the\nevent is the main way of starting the exception handling proccess.\n\nManually firing an event to use DeltaSpike's exception handling is\nprimarily used in your own try/catch blocks. It is very painless and also\neasy. Let's examine a sample that might exist inside of a simple\nbusiness logic lookup into an inventory database:\n\n[source,java]\n----------------------------------------------------------------------------\npublic class InventoryActions {\n    @PersistenceContext private EntityManager em;\n    @Inject private Event<ExceptionToCatchEvent> catchEvent;\n\n    public Integer queryForItem(Item item) {\n        try {\n          Query q = em.createQuery(\"SELECT i from Item i where i.id = :id\");\n          q.setParameter(\"id\", item.getId());\n          return q.getSingleResult();\n        } catch (PersistenceException e) {\n          catchEvent.fire(new ExceptionToCatchEvent(e));\n        }\n    }\n}\n----------------------------------------------------------------------------\n\nThe `Event` of generic type `ExceptionToCatchEvent` is injected into\nyour class for use later within a try/catch block.\n\nThe event is fired with a new instance of `ExceptionToCatchEvent`\nconstructed with the exception to be handled.\n\n=== Exception Handlers\n\nAs an application developer (i.e., an end user of DeltaSpike's exception\nhandling), you'll be focused on writing exception handlers. An exception\nhandler is a method on a CDI bean that is invoked to handle a specific\ntype of exception. Within that method, you can implement any logic\nnecessary to handle or respond to the exception.\n\n*If there are no exception handlers for an exception, the exception is\nrethrown - except `ExceptionToCatchEvent#optinal` is set to true*\n\nGiven that exception handler beans are CDI beans, they can make use of\ndependency injection, be scoped, have interceptors or decorators and any\nother functionality available to CDI beans.\n\nException handler methods are designed to follow the syntax and\nsemantics of CDI observers, with some special purpose exceptions\nexplained in this guide. The advantage of this design is that exception\nhandlers will be immediately familiar to you if you are studying or\nwell-versed in CDI.\n\nIn this and subsequent sections, you'll learn how to define an exception\nhandler, explore how and when it gets invoked, modify an exception and a\nstack trace, and even extend exception handling further through events\nthat are fired during the handling workflow. We'll begin by covering the\ntwo annotations that are used to declare an exception handler,\n`@ExceptionHandler` and `@Handles`, and `@BeforeHandles` to create a\ncallback before the handler is called.\n\nException handlers are considered equal if they both handle the same\nexception class, have the same qualifiers, the same ordinal and the same\nvalue for `isBeforeHandler()`.\n\nException handlers are contained within exception handler beans, which\nare CDI beans annotated with `@ExceptionHandler`. Exception handlers are\nmethods which have a parameter which is an instance of\n`ExceptionEvent<T extends Throwable>` annotated with the `@Handles`\nannotation.\n\n==== @ExceptionHandler\n\nThe `@ExceptionHandler` annotation is simply a marker annotation that\ninstructs the DeltaSpike exception handling CDI extension to scan the\nbean for handler methods.\n\nLet's designate a CDI bean as an exception handler by annotating it with\n`@ExceptionHandler`.\n\n[source,java]\n--------------------------\n@ExceptionHandler\npublic class MyHandlers {}\n--------------------------\n\nThat's all there is to it. Now we can begin defining exception handling\nmethods on this bean.\n\n==== @Handles and @BeforeHandles\n\n`@Handles` is a method parameter annotation that designates a method as\nan exception handler. Exception handler methods are registered on beans\nannotated with `@ExceptionHandler`. DeltaSpike will discover all such\nmethods at deployment time.\n\nLet's look at an example. The following method is invoked for every\nexception that DeltaSpike processes and prints the exception message to\nstdout. (`Throwable` is the base exception type in Java and thus\nrepresents all exceptions).\n\n[source,java]\n----------------------------------------------------------------\n@ExceptionHandler\npublic class MyHandlers\n{\n    void printExceptions(@Handles ExceptionEvent<Throwable> evt)\n    {\n        System.out.println(\"Something bad happened:\" +\n        evt.getException().getMessage());\n        evt.handleAndContinue();\n    }\n}\n----------------------------------------------------------------\n\nThe `@Handles` annotation on the first parameter designates this method\nas an exception handler (though it is not required to be the first\nparameter). This parameter must be of type\n`ExceptionEvent<T extends Throwable>`, otherwise it is detected as a\ndefinition error. The type parameter designates which exception the\nmethod should handle. This method is notified of all exceptions\n(requested by the base exception type `Throwable`).\n\nThe `ExceptionEvent` instance provides access to information about the\nexception and can be used to control exception handling flow. In this\ncase, it is used to read the current exception being handled in the\nexception chain, as returned by `getException()`.\n\nThis handler does not modify the invocation of subsequent handlers, as\ndesignated by invoking `handleAndContinue()` on `ExceptionEvent`. As\nthis is the default behavior, this line could be omitted.\n\nThe `@Handles` annotation must be placed on a parameter of the method,\nwhich must be of type `ExceptionEvent<T extends Throwable>`. Handler\nmethods are similar to CDI observers and, as such, follow the same\nprinciples and guidelines as observers (such as invocation, injection of\nparameters, qualifiers, etc) with the following exceptions:\n\n* a parameter of a handler method must be a `ExceptionEvent`\n* handlers are ordered before they are invoked (invocation order of\nobservers is non-deterministic)\n* any handler can prevent subsequent handlers from being invoked\n\nIn addition to designating a method as exception handler, the `@Handles`\nannotation specifies an `ordinal` about when the method should be\ninvoked relative to other handler methods of the same type. Handlers\nwith higher ordinal are invoked before handlers with a lower ordinal\nthat handle the same exception type. The default ordinal (if not\nspecified) is 0.\n\nThe `@BeforeHandles` designates a method as a callback to happen before\nhandlers are called.\n\nLet's take a look at more sophisticated example that uses all the\nfeatures of handlers to log all exceptions.\n\n[source,java]\n-------------------------------------------------------------------------------------------\n@ExceptionHandler\npublic class MyHandlers\n{\n   void logExceptions(@BeforeHandles @WebRequest ExceptionEvent<Throwable> evt, Logger log)\n   {\n      log.warn(\"Something bad happened: \" + evt.getException().getMessage());\n   }\n\n   void logExceptions(@Handles @WebRequest ExceptionEvent<Throwable> evt, Logger log)\n   {\n      // possibly send a HTTP Error code\n   }\n}\n-------------------------------------------------------------------------------------------\n\nThis handler has a default ordinal of 0 (the default value of the\nordinal attribute on `@Handles`).\n\nThis handler is qualified with `@WebRequest`. When DeltaSpike calculates\nthe handler chain, it filters handlers based on the exception type and\nqualifiers. This handler will only be invoked for exceptions passed to\nDeltaSpike that carry the `@WebRequest` qualifier. We'll assume this\nqualifier distinguishes a web page request from a REST request.\n\nAny additional parameters of a handler method are treated as injection\npoints. These parameters are injected into the handler when it is\ninvoked by DeltaSpike. In this case, we are injecting a `Logger` bean\nthat must be defined within the application (or by an extension).\n\nA handler is guaranteed to only be invoked once per exception\n(automatically muted), unless it re-enables itself by invoking the\n`unmute()` method on the `ExceptionEvent` instance.\n\nHandlers must not throw checked exceptions, and should avoid throwing\nunchecked exceptions. Should a handler throw an unchecked exception it\nwill propagate up the stack and all handling done via DeltaSpike will\ncease. Any exception that was being handled will be lost.\n\n==== Ordinal\n\nWhen DeltaSpike finds more than one handler for the same exception type,\nit orders the handlers by ordinal. Handlers with higher ordinal are\nexecuted before handlers with a lower ordinal. If DeltaSpike detects two\nhandlers for the same type with the same ordinal, the order is\nnon-deterministic.\n\nLet's define two handlers with different ordinals:\n\n[source,java]\n------------------------------------------------------------------------------------\nvoid handleIOExceptionFirst(@Handles(ordinal = 100) ExceptionEvent<IOException> evt)\n{\n   System.out.println(\"Invoked first\");\n}\n\nvoid handleIOExceptionSecond(@Handles ExceptionEvent<IOException> evt)\n{\n System.out.println(“Invoked second”);\n}\n------------------------------------------------------------------------------------\n\nThe first method is invoked first since it has a higher ordinal (100)\nthan the second method, which has the default ordinal (0).\n\nTo summarize, here's how DeltaSpike determines the order of handlers to\ninvoke (until a handler marks exception as handled):\n\n1.  Unwrap exception stack\n2.  Begin processing root cause\n3.  Invoke any callback methods annotated with @BeforeHandles for the closest type to the exception\n4.  Find handler for the closest type to the exception\n5.  If multiple handlers for same type, invoke handlers with higher ordinal first\n6.  Continue above steps for each exception in stack\n\n=== Exception Chain Processing\n\nWhen an exception is thrown, chances are it is nested (wrapped) inside\nother exceptions. (If you've ever examined a server log, you'll\nappreciate this fact). The collection of exceptions in its entirety is\ntermed an exception chain.\n\nThe outermost exception of an exception chain (e.g., EJBException,\nServletException, etc) is probably of little use to exception handlers.\nThat's why DeltaSpike does not simply pass the exception chain directly\nto the exception handlers. Instead, it intelligently unwraps the chain\nand treats the root exception cause as the primary exception.\n\nThe first exception handlers to be invoked by DeltaSpike are those that\nmatch the type of root cause. Thus, instead of seeing a vague\n`EJBException`, your handlers will instead see an meaningful exception\nsuch as `ConstraintViolationException`. _This feature, alone, makes\nDeltaSpike's exception handling a worthwhile tool._\n\nDeltaSpike continues to work through the exception chain, notifying\nhandlers of each exception in the stack, until a handler flags the\nexception as handled or the whole exception chain has been iterated.\nOnce an exception is marked as handled, DeltaSpike stops processing the\nexception chain. If a handler instructs DeltaSpike to rethrow the\nexception (by invoking `ExceptionEvent#throwOriginal()`, DeltaSpike will\nrethrow the exception outside the DeltaSpike exception handling\ninfrastructure. Otherwise, it simply returns flow control to the caller.\n\nConsider a exception chain containing the following nested causes (from\nouter cause to root cause):\n\n* EJBException\n* PersistenceException\n* SQLGrammarException\n\nDeltaSpike will unwrap this exception and notify handlers in the\nfollowing order:\n\n* SQLGrammarException\n* PersistenceException\n* EJBException\n\nIf there's a handler for `PersistenceException`, it will likely prevent\nthe handlers for `EJBException` from being invoked, which is a good\nthing since what useful information can really be obtained from\n`EJBException`?\n\n=== APIs for Exception Information and Flow Control\n\nThere are two APIs provided by DeltaSpike that should be familiar to\napplication developers:\n\n* `ExceptionEvent`\n* `ExceptionStackEvent`\n\n==== ExceptionEvent\n\nIn addition to providing information about the exception being handled,\nthe `ExceptionEvent` object contains methods to control the exception\nhandling process, such as rethrowing the exception, aborting the handler\nchain or unmuting the current handler. Five methods exist on the\n`ExceptionEvent` object to give flow control to the handler\n\n* `abort()` -- terminate all handling immediately after this handler,\ndoes not mark the exception as handled, does not re-throw the exception.\n* `throwOriginal()` -- continues through all handlers, but once all\nhandlers have been called (assuming another handler does not call\nabort() or handled()) the initial exception passed to DeltaSpike is\nrethrown. Does not mark the exception as handled.\n* `handled()` -- marks the exception as handled and terminates further\nhandling.\n* `handleAndContinue()` -- default. Marks the exception as handled and\nproceeds with the rest of the handlers.\n* `skipCause()` -- marks the exception as handled, but proceeds to the\nnext cause in the cause container, without calling other handlers for\nthe current cause.\n* `rethrow(Throwable)` -- Throw a new exception after this handler is\ninvoked\n\nOnce a handler is invoked it is muted, meaning it will not be run again\nfor that exception chain, unless it is explicitly marked as unmuted via\nthe `unmute()` method on `ExceptionEvent`.\n\n== Scopes\n\nDeltaSpike Core provides the API and SPI for several scopes. Currently\nall scopes are only implemented in the <<jsf.adoc#_scopes,JSF module>>.\n\n=== @WindowScoped\n\n=== @ViewAccessScoped\n\n=== @GroupedConversationScoped\n\n=== Creating a Custom CDI Scope\n\nTo create a custom CDI scope to match your needs, complete the following steps:\n\n1. Create an Annotation with annotated with @jakarta.inject.Scope;\n+\n.Example\n[source,java]\n----------------------------------------------------------------\n@Scope\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD})\npublic @interface ACustomScope {}\n----------------------------------------------------------------\n+\n2. Create an Extension to add the scope and a context for it.\n+\n.Example\n[source,java]\n---------------------------------------------------------------------------------------\npublic class ACustomScopeExtension implements Extension, Serializable {\n\n    public void addACustomScope(@Observes final BeforeBeanDiscovery event) {\n        event.addScope(ACustomScope.class, true, false);\n    }\n\n    public void registerACustomScopeContext(@Observes final AfterBeanDiscovery event) {\n        event.addContext(new ACustomScopeContext());\n    }\n}\n---------------------------------------------------------------------------------------\n+\n3. Implement a jakarta.enterprise.context.spi.Context interface to hold the\njakarta.enterprise.inject.spi.Bean instances according to your needs.\n+\n.Example\n[source,java]\n-----------------------------------------------------------------------------------------------------\npublic class ACustomScopeContext implements Context, Serializable {\n\n  // Get the scope type of the context object.\n    public Class<? extends Annotation> getScope() {\n        return ACustomScope.class;\n    }\n\n    // Return an existing instance of certain contextual type or create a new instance by calling\n    // jakarta.enterprise.context.spi.Contextual.create(CreationalContext) and return the new instance.\n    public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {\n        Bean bean = (Bean) contextual;\n        // you can store the bean somewhere\n        if (somewhere.containsKey(bean.getName())) {\n            return (T) somewhere.get(bean.getName());\n        } else {\n            T t = (T) bean.create(creationalContext);\n            somewhere.put(bean.getName(), t);\n            return t;\n        }\n    }\n\n    // Return an existing instance of a certain contextual type or a null value.\n    public <T> T get(Contextual<T> contextual) {\n        Bean bean = (Bean) contextual;\n        // you can store the bean somewhere\n        if (somewhere.containsKey(bean.getName())) {\n            return (T) somewhere.get(bean.getName());\n        } else {\n            return null;\n        }\n    }\n\n  // Determines if the context object is active.\n    public boolean isActive() {\n        return true;\n    }\n\n}\n-----------------------------------------------------------------------------------------------------\n\n== Deactivatable\n\nDeltaSpike allows you to deactivate its own pre-configured parts (like Extensions, event-broadcasters,...).\nTherefore DeltaSpike offers `org.apache.deltaspike.core.spi.activation.ClassDeactivator` and\n`org.apache.deltaspike.core.spi.activation.Deactivatable`.\n\nA `ClassDeactivator` allows to specify deactivated classes (if they implement `Deactivatable`)\nwhich can't be deactivated/customized via std. CDI mechanisms\n(like the veto-method or alternative/specialized CDI-beans).\nThis might be the case e.g. for CDI Extensions because CDI mechanisms are not available at startup time.\n\nUse it mainly to deactivate specific parts *explicitly* (blacklist approach),\nif there is an issue with such parts (and waiting for the next release isn't an option).\n\nYou just need to implement your <<spi.adoc#_classdeactivator,ClassDeactivator>>.\n\nThe `ClassDeactivator` should be resolved by any ConfigSource using the\nkey `org.apache.deltaspike.core.spi.activation.ClassDeactivator`. For\nexample, if we need to provide our own version of the SecurityExtension,\nwe can disable the SecurityExtension provided by DeltaSpike with the following `ClassDeactivator`:\n\n.Disable a specific extension\n[source,java]\n--------------------------------------------------------------------------\npublic class CustomClassDeactivator implements ClassDeactivator\n{\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        if (targetClass.equals(SecurityExtension.class))\n        {\n            return Boolean.FALSE;\n        }\n        return null; //no result for the given class\n    }\n}\n--------------------------------------------------------------------------\n\nNow, we can use the file `/META-INF/apache-deltaspike.properties` (or any\nother <<configuration.adoc#_configsources_provided_by_default,ConfigSource>>) with the following key/value:\n\n------------------------------------------------------------------------------------------\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.test.CustomClassDeactivator\n------------------------------------------------------------------------------------------\n\nSecurityExtension still gets started, because it isn't possible to veto it, however, it isn't processing beans (once deactivated)\nand therefore it's e.g. possible to extend and customize the default implementation provided by DeltaSpike.\n\nThe following listing shows how to enable only a minimal set of extensions.\nTechnically that's possible, however, it isn't suggested to use such an approach,\nbecause you might disable mechanisms need later on (in your project).\n\n.Possible but not suggested\n[source,java]\n--------------------------------------------------------------------------\npublic class WhitelistFilter implements ClassDeactivator\n{\n    private List<Class<?>> limitedExtensions =\n      new ArrayList<Class<?>>()\n    {{\n        add(ConfigurationExtension.class);\n        add(PartialBeanBindingExtension.class);\n        add(RepositoryExtension.class);\n    }};\n\n    @Override\n    public Boolean isActivated(\n      Class<? extends Deactivatable> deactivatableClass)\n    {\n        return !Extension.class.isAssignableFrom(deactivatableClass) ||\n            limitedExtensions.contains(deactivatableClass);\n    }\n}\n--------------------------------------------------------------------------\n\nInstead it's better to disable the part you really like to deactivate (see `CustomClassDeactivator`).\n\n=== Deactivate Deactivatable-Classes via Config\n\nThe default implementation of `ClassDeactivator` allows to deactivate classes by adding config-entries to one of your config-sources (like `META-INF\\apache-deltaspike.properties`).\nThe following example shows how it would look like e.g. in case of the SecurityExtension:\n\n------------------------------------------------------------------------------------------\ndeactivate.org.apache.deltaspike.security.impl.extension.SecurityExtension=true\n------------------------------------------------------------------------------------------\n\n== Asynchronous Operations\n\nDeltaSpike provides support for executing code in an asynchronous manner.  The behavior is implemented as three different interceptors for your beans.\n\n- `@Futureable` - Designed for bean methods that return `Future's` of some form.  The method call will automatically be submitted to an `ExecutorService`\n- `@Locked` - Ability to prevent concurrent access to a method based on its usage of reads/writes.\n- `@Throttled` - Ability to limit how frequently a method can be invoked.\n\n== @Futureable configuration\n\nThe strategy to find the `ExecutorService` associated to the `@Futureable` name is the following one:\n\n1. Check if there is a CDI bean of type `ExecutorService` with the name of the pool, if not try 2\n2. Check if there is a JNDI entry matching the pool name directly or prefixed with `java:app/`, `java:global/`, `java:global/threads/`, `java:global/deltaspike/`, `java:`, if not try 3\n3. Read the configuration and create a `ThreadPoolExecutor`\n\nIMPORTANT: the instance is looked up only once so from the first time it was read you can't change any configuration anymore.\n\nIf you rely on the last option (configured executor) here are the keys you can set in DeltaSpike configuration:\n\n|===\n| Key | Description | Default\n| futureable.pool.<pool name>.coreSize | The core size of the pool. | Number of available processors\n| futureable.pool.<pool name>.maxSize | The max size of the pool. | coreSize value\n| futureable.pool.<pool name>.keepAlive.value | Pool keep alive (when a thread is released). | 0\n| futureable.pool.<pool name>.keepAlive.unit | Unit of keepAlive.value. It must match a `TIMEUNIT` name. | MILLISECONDS\n| futureable.pool.<pool name>.queue.type | The task queue type of the executor. Can be `ARRAY` to use an `ArrayBlockingQueue`, `LINKED` for a `LinkedBlockingQueue` or `SYNCHRONOUS` for a `SynchronousQueue`. | LINKED\n| futureable.pool.<pool name>.queue.fair | For synchronous and array queue types, if the queue is fair. | false\n| futureable.pool.<pool name>.queue.size | For array queue type, the size of the queue. | 1024\n| futureable.pool.<pool name>.queue.capacity | For linked queue type, the capacity of the queue. | `Integer.MAX_VALUE`\n| futureable.pool.<pool name>.threadFactory.name | If set a CDI bean matching the value will be looked up and used as `ThreadFactory`. | none, `Executors.defaultThreadFactory()` is used\n| futureable.pool.<pool name>.rejectedExecutionHandler.name | If set a CDI bean matching the value will be looked up and used as `RejectedExecutionHandler`. | none, `ThreadPoolExecutor.AbortPolicy` is used\n|===\n\n== Utilities\n\nDeltaSpike provides many utility classes (no constructor / static\nmethods) that can be useful for your project.\n\nBelow you can find an information about these classes.\n\n=== AnnotationUtils\n\nUtilities for working with annotations on methods and classes.\n\n* `#findAnnotation` -- obtains an `Annotation` instance of a given annotation `Class` from the given `Annotation[]`, recursing any possible stereotype tree along the way\n* `#extractAnnotationFromMethod` -- uses `findAnnotation` to obtain an `Annotation` from a given `Method`\n* `#extractAnnotationFromMethodOrClass` -- uses `findAnnotation` to obtain an `Annotation` on either the given `Method` or the given `Class`, in that order\n* `#getQualifierHashCode` -- computes the hashCode of a qualifier annotation, taking into account only the \"binding\" members (not annotated `@Nonbinding`)\n\n=== ArraysUtils\n\n\nA collection of utilities for working with Arrays\n\n* `#asSet` -- Create a set from an array. If the array contains duplicate\nobjects, the last object in the array will be placed in resultant set.\n\n\n=== BeanUtils\n\nA set of utility methods for working with beans.\n\n* `#getQualifiers` -- Extract the qualifiers from a set of annotations.\n* `#extractAnnotation` -- Extract the annotations.\n* `#createInjectionPoints` -- Given a method, and the bean on which the method is declared, create a collection of injection points representing the parameters of the method.\n\n\n=== ContextUtils\n\nA set of utility methods for working with contexts.\n\n* `#isContextActive` -- Checks if the context for the scope annotation is active.\n\n\n=== ClassDeactivationUtils\n\n\nHelper methods for `ClassDeactivator`\n\n* `#isActivated` -- Evaluates if the given `Deactivatable` is active.\n\nTo add a custom `ClassDeactivator` add `org.apache.deltaspike.core.spi.activation.ClassDeactivator=my.CustomClassDeactivator` to `META-INF\\apache-deltaspike.properties`. Or configure it via a custom `ConfigSource`.\n\n=== ExceptionUtils\n\nHelper methods to deal with Exceptions\n\n* `#throwAsRuntimeException` -- helper which allows to use a trick to throw a catched checked exception without a wrapping exception.\n* `#changeAndThrowException` -- helper which allows to use a trick to throw a cached checked exception without a wrapping exception.\n\n=== PropertyFileUtils\n\nHelper methods for Property files\n\n* `#resolvePropertyFiles` -- Allows to lookup for resource bundle files.\n* `#loadProperties` -- Load a Properties file from the given URL.\n* `#getResourceBundle` -- Return the ResourceBundle for the current default Locale.\n\n\n=== ProxyUtils\n\nHelper for CDI proxies\n\n* `#getUnproxiedClass` -- Return class of the real implementation.\n* `#isProxiedClass` -- Analyses if the given class is a generated proxy class.\n\n=== StringUtils\n\nA collection of utilities for working with Strings.\n\n* `#isEmpty` -- return true if the String is null or empty ( `string.trim().isEmpty()` )\n\n"
  },
  {
    "path": "documentation/src/main/asciidoc/data.adoc",
    "content": ":moduledeps: core, jpa, partial-bean\r\n\r\n= Data Module\r\n\r\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\r\n\r\n== Overview\r\nThe Data module provides capabilities for implementing repository patterns and thereby simplifying the repository layer. Repository patterns are ideal for simple queries that require boilerplate code, enabling centralization of query logic and consequently reducing code duplication and improving testability.\r\n\r\nThe code sample below gives you a quick overview on the common usage\r\nscenarios of the data module:\r\n\r\n[source,java]\r\n----------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findByAgeBetweenAndGender(int minAge, int maxAge, Gender gender);\r\n\r\n    @Query(\"select p from Person p where p.ssn = ?1\")\r\n    Person findBySSN(String ssn);\r\n\r\n    @Query(named=Person.BY_FULL_NAME)\r\n    Person findByFullName(String firstName, String lastName);\r\n\r\n}\r\n----------------------------------------------------------------------------------\r\n\r\nAs you see in the sample, there are several usage scenarios outlined\r\nhere:\r\n\r\n* Declare a method which executes a query by simply translating its name\r\nand parameters into a query.\r\n* Declare a method which automatically executes a given JPQL query\r\nstring with parameters.\r\n* Declare a method which automatically executes a named query with\r\nparameters.\r\n\r\nThe implementation of the method is done automatically by the CDI\r\nextension. A client can declare a dependency to the interface only. The\r\ndetails on how to use those features are outlined in the following\r\nchapters.\r\n\r\n== Project Setup\r\n\r\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\r\n\r\n=== 1. Declare Data Module Dependencies\r\n\r\nAdd the Data module to the list of dependencies in the project `pom.xml` file using this code snippet:\r\n\r\n[source,xml]\r\n----\r\n<dependency>\r\n    <groupId>org.apache.deltaspike.modules</groupId>\r\n    <artifactId>deltaspike-data-module-api</artifactId>\r\n    <version>${deltaspike.version}</version>\r\n    <scope>compile</scope>\r\n</dependency>\r\n\r\n<dependency>\r\n    <groupId>org.apache.deltaspike.modules</groupId>\r\n    <artifactId>deltaspike-data-module-impl</artifactId>\r\n    <version>${deltaspike.version}</version>\r\n    <scope>runtime</scope>\r\n</dependency>\r\n----\r\n\r\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\r\n\r\n[source]\r\n----\r\n     runtime 'org.apache.deltaspike.modules:deltaspike-data-module-impl'\r\n     compile 'org.apache.deltaspike.modules:deltaspike-data-module-api'\r\n----\r\n\r\n=== 2. Complete Additional Java Environment Configuration\r\n\r\nThe Data module requires a JPA implementation to be available in the Java environment where your projects are deployed.\r\n\r\nThe simplest way using the DeltaSpike Data module is to run your\r\napplication in a Java EE container supporting at least the Java EE6 Web\r\nProfile. Other configurations like running it inside Tomcat or even a\r\nJava SE application should be possible - you need to include a JPA\r\nprovider as well as a CDI container to your application manually.\r\n\r\nAs of DeltaSpike v1.4.0, the Data module internally leverages the Proxy module, which wraps ASM 5.  No external\r\ndependencies required, and now we have full support for interceptors on partial beans.\r\n\r\n=== 3. Complete Additional Project Configuration\r\n\r\nDeltaSpike Data requires an `EntityManager` exposed via a CDI producer -\r\nwhich is common practice in Java EE6 applications.\r\n\r\n[source,java]\r\n------------------------------------------------------\r\npublic class EntityManagerProducer\r\n{\r\n    @PersistenceUnit\r\n    private EntityManagerFactory emf;\r\n\r\n    @Produces // you can also make this @RequestScoped\r\n    public EntityManager create()\r\n    {\r\n        return emf.createEntityManager();\r\n    }\r\n\r\n    public void close(@Disposes EntityManager em)\r\n    {\r\n        if (em.isOpen())\r\n        {\r\n            em.close();\r\n        }\r\n    }\r\n}\r\n------------------------------------------------------\r\n\r\nThis allows the `EntityManager` to be injected over CDI instead of only\r\nbeing used with a `@PersistenceContext` annotation. Using multiple\r\n`EntityManager` is explored in more detail in a following section.\r\n\r\nIf you use a JTA DataSource with your `EntityManager`, you also have to\r\nconfigure the `TransactionStrategy` your repositories use. Adapt your\r\n`beans.xml` for this:\r\n\r\n[source,xml]\r\n----\r\n<beans>\r\n    <alternatives>\r\n        <class>org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy</class>\r\n    </alternatives>\r\n</beans>\r\n----\r\n\r\nIMPORTANT: Using the DeltaSpike Data module in an EAR deployment is currently restricted to\r\nannotation-based entities.\r\n\r\n== Core Concepts\r\n\r\n=== Repositories\r\n\r\nWith the DeltaSpike Data module, it is possible to make a repository out\r\nof basically any abstract class or interface (using a concrete class\r\nwill work too, but you will not be able to use most of the CDI extension\r\nfeatures). All that is required is to mark the type as such with a\r\nsimple annotation:\r\n\r\n[source,java]\r\n----------------------------------------\r\n@Repository(forEntity = Person.class)\r\npublic abstract class PersonRepository {\r\n    ...\r\n}\r\n\r\n@Repository(forEntity = Person.class)\r\npublic interface PersonRepository {\r\n    ...\r\n}\r\n----------------------------------------\r\n\r\nThe `@Repository` annotation tells the extension that this is a\r\nrepository for the `Person` entity. Any method defined on the repository\r\nwill be processed by the framework. The annotation does not require to\r\nset the entity class (we'll see later why) but if there are just plain\r\nclasses or interfaces this is the only way to tell the framework what\r\nentity the repository relates to. In order to simplify this, DeltaSpike\r\nData provides several base types.\r\n\r\n==== The `EntityRepository` Interface\r\n\r\nAlthough mainly intended to hold complex query logic, working with both\r\na repository and an `EntityManager` in the service layer might\r\nunnecessarily clutter code. In order to avoid this for the most common\r\ncases, DeltaSpike Data provides base types which can be used to replace\r\nthe entity manager.\r\n\r\nThe top base type is the `EntityRepository` interface, providing common\r\nmethods used with an `EntityManager`. The following code shows the most\r\nimportant methods of the interface:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------\r\npublic interface EntityRepository<E, PK extends Serializable>\r\n{\r\n\r\n    E save(E entity);\r\n\r\n    void remove(E entity);\r\n\r\n    void refresh(E entity);\r\n\r\n    void flush();\r\n\r\n    E findBy(PK primaryKey);\r\n\r\n    List<E> findAll();\r\n\r\n    List<E> findBy(E example, SingularAttribute<E, ?>... attributes);\r\n\r\n    List<E> findByLike(E example, SingularAttribute<E, ?>... attributes);\r\n\r\n    Long count();\r\n\r\n    Long count(E example, SingularAttribute<E, ?>... attributes);\r\n\r\n    Long countLike(E example, SingularAttribute<E, ?>... attributes);\r\n\r\n}\r\n-------------------------------------------------------------------------\r\n\r\nThe concrete repository can then extend this basic interface. For our\r\nPerson repository, this might look like the following:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    Person findBySsn(String ssn);\r\n\r\n}\r\n------------------------------------------------------------------------\r\n\r\nTIP: Annotations on interfaces do not inherit. If the `EntityRepository`\r\ninterface is extended by another interface adding some more common\r\nmethods, it is not possible to simply add the annotation there. It needs\r\nto go on each concrete repository. The same is not true if a base class\r\nis introduced, as we see in the next chapter.\r\n\r\n===== The AbstractEntityRepository Class\r\n\r\nThis class is an implementation of the `EntityRepository` interface and\r\nprovides additional functionality when custom query logic needs also to\r\nbe implemented in the repository.\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\npublic abstract class PersonRepository extends AbstractEntityRepository<Person, Long>\r\n{\r\n\r\n    public List<Person> findBySSN(String ssn)\r\n    {\r\n        return typedQuery(\"select p from Person p where p.ssn = ?1\")\r\n                .setParameter(1, ssn)\r\n                .getResultList();\r\n    }\r\n\r\n}\r\n-------------------------------------------------------------------------------------\r\n\r\n=== Deactivating Repositories\r\n\r\nRepositories can be deactivated creating a <<spi.adoc#_classdeactivator,ClassDeactivator>>.\r\n\r\nThe `EntityRepository` interface implements the <<core.adoc#_deactivatable,Deactivatable>> interface allowing it to be used in the ClassDeactivator.\r\n\r\nIf your repository does not implement `EntityRepository` and you want to deactivate it, you will need to implement the <<core.adoc#_deactivatable,Deactivatable>>  interface yourself.\r\n\r\n[source,java]\r\n----------------------------------------\r\n@Repository(forEntity = Person.class)\r\npublic abstract class PersonRepository implements Deactivatable {\r\n    ...\r\n}\r\n\r\n@Repository(forEntity = Person.class)\r\npublic interface PersonRepository extends Deactivatable {\r\n    ...\r\n}\r\n----------------------------------------\r\n\r\n=== Support of @TransactionScoped EntityManagers\r\n\r\nFor using `@TransactionScoped` beans like a `@TransactionScoped`-`EntityManager`,\r\nyou need to annotate the Data-repository with @Transactional explicitly or one of the beans in the call-hierarchy.\r\nThat's needed, because the context bound to `@TransactionScoped` needs to be active,\r\nbefore the `@TransactionScoped`-`EntityManager` gets resolved (internally).\r\n\r\nThe following examples illustrate the described usages:\r\n\r\n.@TransactionScoped EntityManager combined with a simple repository\r\n[source,java]\r\n---------------------------------------------------------------------------------------\r\npublic class EntityManagerProducer\r\n{\r\n    @Produces\r\n    @TransactionScoped\r\n    public EntityManager create() { ... }\r\n\r\n    public void close(@Disposes EntityManager em)  { ... }\r\n}\r\n\r\n@ApplicationScoped\r\npublic class MyService\r\n{\r\n    @Inject\r\n    private MyRepository myRepository;\r\n\r\n    public void create()\r\n    {\r\n        //...\r\n        this.myRepository.save(...); //executed in a transaction\r\n        //...\r\n    }\r\n}\r\n\r\n@Transactional\r\n@Repository\r\npublic interface MyRepository extends EntityRepository<MyEntity, String>\r\n{\r\n  //...\r\n}\r\n---------------------------------------------------------------------------------------\r\n\r\n.@TransactionScoped EntityManager combined with a simple repository called by a transactional bean\r\n[source,java]\r\n---------------------------------------------------------------------------------------\r\npublic class EntityManagerProducer\r\n{\r\n    @Produces\r\n    @TransactionScoped\r\n    public EntityManager create() { ... }\r\n\r\n    public void close(@Disposes EntityManager em)  { ... }\r\n}\r\n\r\n@Transactional\r\n@ApplicationScoped\r\npublic class MyService\r\n{\r\n    @Inject\r\n    private MyRepository myRepository;\r\n\r\n    public void create() //executed in a transaction\r\n    {\r\n        //...\r\n        this.myRepository.save(...);\r\n        //...\r\n    }\r\n}\r\n\r\n@Repository\r\npublic interface MyRepository extends EntityRepository<MyEntity, String>\r\n{\r\n  //...\r\n}\r\n---------------------------------------------------------------------------------------\r\n\r\n=== Using Multiple EntityManagers\r\n\r\nWhile most applications will run just fine with a single\r\n`EntityManager`, there might be setups where multiple data sources are\r\nused. This can be configured with the `EntityManagerConfig` annotation:\r\n\r\n[source,java]\r\n--------------------------------------------------------------------------------------------------------------\r\n@Repository\r\n@EntityManagerConfig(entityManagerResolver = CrmEntityManagerResolver.class, flushMode = FlushModeType.COMMIT)\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n    ...\r\n}\r\n\r\npublic class CrmEntityManagerResolver implements EntityManagerResolver\r\n{\r\n    @Inject @CustomerData // Qualifier - assumes a producer is around...\r\n    private EntityManager em;\r\n\r\n    @Override\r\n    public EntityManager resolveEntityManager()\r\n    {\r\n        return em;\r\n    }\r\n}\r\n--------------------------------------------------------------------------------------------------------------\r\n\r\nAgain, note that annotations on interfaces do not inherit, so it is not\r\npossible to create something like a base `CrmRepository` interface with\r\nthe `@EntityManagerConfig` and then extending / implementing this\r\ninterface.\r\n\r\n=== Other EntityManager Methods\r\n\r\nWhile the `EntityRepository` methods should cover most interactions\r\nnormally done with an `EntityManager`, for some specific cases it might\r\nstill be useful to have one or the other method available. For this\r\ncase, it is possible to extend / implement the `EntityManagerDelegate`\r\ninterface for repositories, which offers most other methods available in\r\na JPA 2.0 `EntityManager`:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>, EntityManagerDelegate<Person>\r\n{\r\n    ...\r\n}\r\n-------------------------------------------------------------------------------------------------------\r\n\r\nAlternatively, you can extend the `FullEntityRepository` interface which is a short-hand for extending\r\nall of `EntityRepository`, `EntityManagerDelegate` and `CriteriaSupport`.\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends FullEntityRepository<Person, Long>\r\n{\r\n    ...\r\n}\r\n-------------------------------------------------------------------------------------------------------\r\n\r\nFor abstract classes, there is a convenience base class `AbstractFullEntityRepository` which also\r\nimplements `EntityManagerDelegate` and `CriteriaSupport` and thus exposes most `EntityManager` methods:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------------------------\r\n@Repository\r\npublic abstract PersonRepository extends AbstractFullEntityRepository<Person, Long>\r\n{\r\n    ...\r\n}\r\n-------------------------------------------------------------------------------------------------------\r\n\r\n== Query Method Expressions\r\n\r\nGood naming is a difficult aspects in software engineering. A good\r\nmethod name usually makes comments unnecessary and states exactly what\r\nthe method does. And with method expressions, the method name is\r\nactually the implementation!\r\n\r\n=== Using Method Expressions\r\n\r\nLet's start by looking at a (simplified for readability) example:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------\r\n@Entity\r\npublic class Person\r\n{\r\n\r\n    @Id @GeneratedValue\r\n    private Long id;\r\n    private String name;\r\n    private Integer age;\r\n    private Gender gender;\r\n\r\n}\r\n\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findByNameLikeAndAgeBetweenAndGender(String name,\r\n                              int minAge, int maxAge, Gender gender);\r\n\r\n    long countByName(String name);\r\n\r\n    void removeByName(String name);\r\n}\r\n------------------------------------------------------------------------\r\n\r\nLooking at the method name, this can easily be read as query all Persons\r\nwhich have a name like the given name parameter, their age is between a\r\nmin and a max age and having a specific gender. The DeltaSpike Data\r\nmodule can translate method names following a given format and directly\r\ngenerate the query implementation out of it (in EBNF-like form):\r\n\r\n----------------------------------------------------------------------------------\r\n(Entity|Optional<Entity>|List<Entity>|Stream<Entity>) (prefix)(Property[Comparator]){Operator Property [Comparator]}\r\n----------------------------------------------------------------------------------\r\n\r\nOr in more concrete words:\r\n\r\n* The query method must return an entity, an `Optional` of an entity, a list of entities or a stream of entities.\r\n* It must start with the `findBy` prefix (or related `findOptionalBy`, `findAnyBy`, `findAll`, `findFirst` or `findTop`).\r\n* Followed by a property of the Repository entity and an optional comparator (we'll define this later). The property will be used in the query together with the comparator. Note that the number of arguments passed to the method depend on the comparator.\r\n* You can add more blocks of property-comparator which have to be concatenated by a boolean operator. This is either an `And` or `Or`.\r\n\r\nYou can also use the same way for delete an entity:\r\n* It must start with the `removeBy` keyword (or related `deleteBy`).\r\n\r\nor for counting:\r\n* It must start with the `countBy` keyword.\r\n* It must return a int or long.\r\n\r\nOther assumptions taken by the expression evaluator:\r\n\r\n* The property name starts lower cased while the property in the expression has an upper cases first character.\r\n\r\nFollowing comparators are currently supported to be used in method\r\nexpressions:\r\n\r\n[options=\"header, autowidth\"]\r\n|===\r\n| Name                |# of Arguments     |Description\r\n| Equal               |1 | Property must be equal to argument value. If the operator is omitted in the expression, this is assumed as default.\r\n| EqualIgnoreCase     |1 | Property must be equal to argument value (case insensitive).\r\n| IgnoreCase          |1 | Property must be equal to argument value (case insensitive).\r\n| NotEqual            |1 | Property must be not equal to argument value.\r\n| NotEqualIgnoreCase  |1 | Property must be not equal to argument value (case insensitive).\r\n| Like                |1 | Property must be like the argument value. Use the %-wildcard in the argument.\r\n| LikeIgnoreCase      |1 | Property must be like the argument value (case insensitive). Use the %-wildcard in the argument.\r\n| NotLike `*`         |1 | Property must be not like the argument value. Use the %-wildcard in the argument.\r\n| GreaterThan         |1 | Property must be greater than argument value.\r\n| GreaterThanEquals   |1 | Property must be greater than or equal to argument value.\r\n| LessThan            |1 | Property must be less than argument value.\r\n| LessThanEquals      |1 | Property must be less than or equal to argument value.\r\n| Between             |2 | Property must be between the two argument values.\r\n| IsNull              |0 | Property must be null.\r\n| IsNotNull           |0 | Property must be non-null.\r\n| In `*`              |1 | Property must be in the list of values given as a single argument. The argument should be of Collection type (e.g. List, Set, etc.).\r\n| NotIn `*`           |1 | Property must be not in the list of values given as a single argument. The argument should be of Collection type (e.g. List, Set, etc.).\r\n| True  `*`           |0 | Property must be true.\r\n| False `*`           |0 | Property must be false.\r\n| Containing `*`      |1 | Property must be like the argument value. Don't use the %-wildcard in the argument. The argument value would be automatically wrapped in a pair of %-wildcard.\r\n| StartingWith `*`    |1 | Property must begin with the argument value. Don't use the %-wildcard in the argument. A %-wildcard would be added automatically to the end of the argument value.\r\n| EndingWith `*`      |1 | Property must end with the argument value. Don't use the %-wildcard in the argument. A %-wildcard would be added automatically to the start of the argument value.\r\n|===\r\n\r\n`*` Comparator available since 1.9.1\r\n\r\nNote that DeltaSpike will validate those expressions during startup, so\r\nyou will notice early in case you have a typo in those expressions.\r\n\r\nAlso note that as of 1.7, the Entity type returned can either by the\r\nentity defined in this repository, or any other entity in your persistence\r\nunit, or any primitive type supported by your JPA implementation.\r\n\r\n=== Query Ordering\r\n\r\nBeside comparators it is also possible to sort queries by using the\r\n`OrderBy` keyword, followed by the attribute name and the direction\r\n(`Asc` or `Desc`).\r\n\r\n[source,java]\r\n------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findByLastNameLikeOrderByAgeAscLastNameDesc(String lastName);\r\n\r\n}\r\n------------------------------------------------------------------------------\r\n\r\n=== Query Limits\r\n\r\nStarting with Apache DeltaSpike 1.6.2, you can apply query limits using method\r\nexpressions.  They can be applied using `findFirst` or `findTop` prefixes in a\r\nmethod like this:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findFirst2ByLastNameOrderByAgeAscLastNameDesc(String lastName);\r\n\r\n    List<Person> findTop2ByLastNameOrderByAgeAscLastNameDesc(String lastName);\r\n\r\n}\r\n------------------------------------------------------------------------------\r\n\r\nThe number following the prefix indicates how many to limit by, when setting\r\nthe `maxResults` attribute of the underlying query.  You can pair this with\r\na `@FirstResult` parameter to give consistent paging.\r\n\r\nQuery Limits can be applied even when there is no where clause defined by your\r\nquery.\r\n\r\n[source,java]\r\n------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findAllOrderByAgeAsc();\r\n\r\n    List<Person> findTop20OrderByLastNameDesc();\r\n\r\n}\r\n------------------------------------------------------------------------------\r\n\r\nThe first query finding all entries ordered by age, and the second only 20\r\nordered by last name.\r\n\r\n=== Nested Properties\r\n\r\nTo create a comparison on a nested property, the traversal parts can be\r\nseparated by a `_`:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findByCompany_companyName(String companyName);\r\n\r\n}\r\n------------------------------------------------------------------------\r\n\r\n=== Query Options\r\n\r\n\r\nDeltaSpike supports query options on method expressions. If you want to\r\npage a query, you can change the first result as well as the maximum\r\nnumber of results returned:\r\n\r\n[source,java]\r\n-----------------------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> findByNameLike(String name, @FirstResult int start, @MaxResults int pageSize);\r\n\r\n}\r\n-----------------------------------------------------------------------------------------------\r\n\r\n=== Method Prefix\r\n\r\nIn case the `findBy` prefix does not comply with your team conventions,\r\nthis can be adapted:\r\n\r\n[source,java]\r\n--------------------------------------------------------------------------------------------------\r\n@Repository(methodPrefix = \"fetchWith\")\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    List<Person> fetchWithNameLike(String name, @FirstResult int start, @MaxResults int pageSize);\r\n\r\n}\r\n--------------------------------------------------------------------------------------------------\r\n\r\n== Query Annotations\r\n\r\nWhile method expressions are fine for simple queries, they will often\r\nreach their limit once things get slightly more complex. Another aspect\r\nis the way you want to use JPA: The recommended approach using JPA for\r\nbest performance is over named queries. To help incorporate those use\r\ncases, the DeltaSpike Data module supports also annotating methods for\r\nmore control on the generated query.\r\n\r\n\r\n=== Using Query Annotations\r\n\r\nThe simplest way to define a specific query is by annotating a method and\r\nproviding the JPQL query string which has to be executed. In code, this\r\nlooks like the following sample:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Query(\"select count(p) from Person p where p.age > ?1\")\r\n    Long countAllOlderThan(int minAge);\r\n\r\n}\r\n------------------------------------------------------------------------\r\n\r\nThe parameter binding in the query corresponds to the argument index in\r\nthe method.\r\n\r\nYou can also refer to a named query which is constructed and executed\r\nautomatically. The `@Query` annotation has a named attribute which\r\ncorresponds to the query name:\r\n\r\n[source,java]\r\n--------------------------------------------------------------------------------------------\r\n@Entity\r\n@NamedQueries({\r\n    @NamedQuery(name = Person.BY_MIN_AGE,\r\n                query = \"select count(p) from Person p where p.age > ?1 order by p.age asc\")\r\n})\r\npublic class Person\r\n{\r\n\r\n    public static final String BY_MIN_AGE = \"person.byMinAge\";\r\n    ...\r\n\r\n}\r\n\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Query(named = Person.BY_MIN_AGE)\r\n    Long countAllOlderThan(int minAge);\r\n\r\n}\r\n--------------------------------------------------------------------------------------------\r\n\r\nSame as before, the parameter binding corresponds to the argument index\r\nin the method. If the named query requires named parameters to be used,\r\nthis can be done by annotating the arguments with the `@QueryParam`\r\nannotation.\r\n\r\nTIP: Java does not preserve method parameter names (yet), that's why the\r\nannotation is needed.\r\n\r\n[source,java]\r\n---------------------------------------------------------------------------------------------\r\n@NamedQuery(name = Person.BY_MIN_AGE,\r\n            query = \"select count(p) from Person p where p.age > :minAge order by p.age asc\")\r\n\r\n...\r\n\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Query(named = Person.BY_MIN_AGE)\r\n    Long countAllOlderThan(@QueryParam(\"minAge\") int minAge);\r\n\r\n}\r\n---------------------------------------------------------------------------------------------\r\n\r\nIt is also possible to set a native SQL query in the annotation. The\r\n`@Query` annotation has a native attribute which flags that the query is\r\nnot JPQL but plain SQL:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------------------\r\n@Entity\r\n@Table(name = \"PERSON_TABLE\")\r\npublic class Person\r\n{\r\n    ...\r\n}\r\n\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Query(value = \"SELECT * FROM PERSON_TABLE p WHERE p.AGE > ?1\", isNative = true)\r\n    List<Person> findAllOlderThan(int minAge);\r\n\r\n}\r\n------------------------------------------------------------------------------------\r\n\r\n=== Annotation Options\r\n\r\nBeside providing a query string or reference, the `@Query` annotation\r\nprovides also two more attributes:\r\n\r\n[source,java]\r\n--------------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Query(named = Person.BY_MIN_AGE, max = 10, lock = LockModeType.PESSIMISTIC_WRITE)\r\n    List<Person> findAllForUpdate(int minAge);\r\n\r\n}\r\n--------------------------------------------------------------------------------------\r\n\r\n[options=\"header, autowidth\"]\r\n|===\r\n| Name | Description\r\n| max  | Limits the number of results.\r\n| lock | Use a specific LockModeType to execute the query.\r\n|===\r\n\r\nNote that these options can also be applied to method expressions.\r\n\r\n=== Query Options\r\n\r\nAll the query options you have seen so far are more or less static. But\r\nsometimes you might want to apply certain query options dynamically. For\r\nexample, sorting criteria could come from a user selection so they\r\ncannot be known beforehand. DeltaSpike allows you to apply query options\r\nat runtime by using the `QueryResult` result type:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Query(\"select p from Person p where p.age between ?1 and ?2\")\r\n    QueryResult<Person> findAllByAge(int minAge, int maxAge);\r\n\r\n}\r\n------------------------------------------------------------------------\r\n\r\nOnce you have obtained a `QueryResult`, you can apply further options to\r\nthe query:\r\n\r\n[source,java]\r\n-----------------------------------------------------------\r\nList<Person> result = personRepository.findAllByAge(18, 65)\r\n    .orderAsc(\"p.lastName\", false)\r\n    .orderDesc(\"p.age\", false)\r\n    .lockMode(LockModeType.WRITE)\r\n    .hint(\"org.hibernate.timeout\", Integer.valueOf(10))\r\n    .getResultList();\r\n-----------------------------------------------------------\r\n\r\nIMPORTANT: Note that sorting is only applicable to method expressions or non-named\r\nqueries. For named queries it might be possible, but is currently only\r\nsupported for Hibernate, EclipseLink and OpenJPA.\r\n\r\nNote that the `QueryResult` return type can also be used with method\r\nexpressions.\r\n\r\nIMPORTANT: `QueryResult` is based on our internal understanding of your query.\r\nDeltaSpike expects the alias used in your queries to refer to the entity as `e`\r\nYou can disable this behavior by passing in false with your attribute, `.orderDesc(\"p.age\", false)`\r\nwhich would add descending ordering to your existing query `select p from Person p`\r\n\r\n=== Pagination\r\n\r\nWe introduced the `QueryResult` type in the last chapter, which can also\r\nbe used for pagination:\r\n\r\n[source,java]\r\n-----------------------------------------------------------\r\n// Query API style\r\nQueryResult<Person> paged = personRepository.findByAge(age)\r\n    .maxResults(10)\r\n    .firstResult(50);\r\n\r\n// or paging style\r\nQueryResult<Person> paged = personRepository.findByAge(age)\r\n    .withPageSize(10) // equivalent to maxResults\r\n    .toPage(5);\r\n\r\nint totalPages = paged.countPages();\r\n-----------------------------------------------------------\r\n\r\n=== Bulk Operations\r\n\r\nWhile reading entities and updating them one by one might be fine for\r\nmany use cases, applying bulk updates or deletes is also a common usage\r\nscenario for repositories. DeltaSpike supports this with a special\r\nmarking annotation `@Modifying`:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------------\r\n@Repository\r\npublic interface PersonRepository extends EntityRepository<Person, Long>\r\n{\r\n\r\n    @Modifying\r\n    @Query(\"update Person as p set p.classifier = ?1 where p.classifier = ?2\")\r\n    int updateClassifier(Classifier current, Classifier next);\r\n\r\n}\r\n------------------------------------------------------------------------------\r\n\r\nBulk operation query methods can either return void or int, which counts\r\nthe number of entities affected by the bulk operation.\r\n\r\n=== Optional Query Results\r\n\r\nThe JPA spec requires to throw exceptions in case the\r\n`getSingleResult()` method does either return no or more than one\r\nresult. This can result in tedious handling with try-catch blocks or\r\nhave potential impact on your transaction (as the `RuntimeException`\r\nmight roll it back).\r\n\r\nDeltaSpike Data gives the option to change this to the way it makes most\r\nsense for the current usecase. While the default behavior is still fully\r\naligned with JPA, it is also possible to request optional query results.\r\n\r\n=== Zero or One Result\r\n\r\nWith this option, the query returns `null` instead of throwing a\r\n`NoResultException` when there is no result returned. It is usable with\r\nmethod expressions, `Query` annotations and `QueryResult<E>` calls.\r\n\r\n[source,java]\r\n----------------------------------------------------------------------------\r\n@Repository(forEntity = Person.class)\r\npublic interface PersonRepository\r\n{\r\n\r\n    Person findOptionalBySsn(String ssn);\r\n\r\n    @Query(named = Person.BY_NAME, singleResult = SingleResultType.OPTIONAL)\r\n    Person findByName(String firstName, String lastName);\r\n\r\n}\r\n----------------------------------------------------------------------------\r\n\r\nFor method expressions, the `findOptionalBy` prefix can be used. For\r\n`@Query` annotations, the `singleResult` attribute can be overridden\r\nwith the `SingleResultType.OPTIONAL` enum.\r\n\r\nIn case the query returns more than one result, a\r\n`NonUniqueResultException` is still thrown.\r\n\r\n=== Any Result\r\n\r\nIf the caller does not really mind what kind if result is returned, it is\r\nalso possible to request any result from the query. If there is no\r\nresult, same as for optional queries `null` is returned. In case there\r\nis more than one result, any result is returned, or more concretely the\r\nfirst result out of the result list.\r\n\r\n[source,java]\r\n-----------------------------------------------------------------------\r\n@Repository(forEntity = Person.class)\r\npublic interface PersonRepository\r\n{\r\n\r\n    Person findAnyByLastName(String lastName);\r\n\r\n    @Query(named = Person.BY_NAME, singleResult = SingleResultType.ANY)\r\n    Person findByName(String firstName, String lastName);\r\n\r\n}\r\n-----------------------------------------------------------------------\r\n\r\nFor method expressions, the `findAnyBy` prefix can be used. For `@Query`\r\nannotations, the `singleResult` attribute can be overridden with the\r\n`SingleResultType.ANY` enum.\r\n\r\nThis option will not throw an exception.\r\n\r\n=== Java 8 Semantics\r\n\r\nRepositories support returning instances of `java.util.Optional` and `java.util.stream.Stream` for any method.\r\n\r\n[source,java]\r\n-----------------------------------------------------------------------\r\n@Repository(forEntity = Person.class)\r\npublic interface PersonRepository\r\n{\r\n\r\n    Optional<Person> findBySsn(String ssn);\r\n\r\n    Stream<Person> findByLocation(String location);\r\n\r\n}\r\n-----------------------------------------------------------------------\r\n\r\nQueries returning `Optional<T>` will behave like `SingleResultType.OPTIONAL`, if the data is present, return the single\r\nresult, otherwise return `Optional.empty()`.  You can override this by using `SingleResultType.ANY` which takes the first\r\nresult of the list, or else `empty()`.\r\n\r\nQueries returning `Stream<T>` act as a simple wrapper for `query.getResultList().stream()` to give back the results.\r\n\r\n=== Entity Graphs\r\n\r\nEntityGraphs are a feature added in JPA 2.1.  The Data module supports entity graphs for query operations, where the results\r\nwill be limited based on a defined graph.  This feature is only available if you are using a JPA 2.1 implementation.\r\n\r\n`@EntityGraph` can be used for either `fetch` or `load` operations, depending on the `EntityGraphType` used in the annotation.  Most queries should use the `FETCH` option.\r\n\r\n==== Named Graphs\r\n\r\nEntity graphs can be selected by name.  A `@NamedEntityGraph` should be defined already within your persistence context to leverage this.  When this graph is referenced on a repository method, it will be applied to the query.\r\n\r\n==== Dyanmically built graphs\r\n\r\nIf you want to dynamically build a graph, you can do that via the `paths` attribute of the annotation.  The paths specified will be added as graph nodes.  Each graph node will be used in the select.  The format is the full path to the property, based on the property names.\r\n\r\n== Transactions\r\n\r\nIf you call any method expression, `@Query`-annotated method or a method\r\nfrom the `EntityRepository`, the repository will figure out if a\r\ntransaction is needed or not, and if so, if there is already one\r\nongoing. The Data module uses the `TransactionStrategy` provided by the\r\nhttp://deltaspike.apache.org/documentation/jpa.html[JPA Module] for this. See the JPA\r\nmodule documentation for more details.\r\n\r\nIMPORTANT: Some containers do not support `BeanManagedUserTransactionStrategy`! As\r\nJTA has still some portability issues even in Java EE 7, it might be\r\nrequired that you implement your own `TransactionStrategy`. We will\r\nthink about providing an acceptable solution for this.\r\n\r\n\r\nIf you need to open a transaction on a concrete repository method, we\r\ncurrently recommend creating an extension (see next chapter) which uses\r\n`@Transactional` and might look like the following sample.\r\n\r\n[source,java]\r\n---------------------------------------------------------------------------------------\r\npublic class TxExtension<E> implements DelegateQueryHandler, TxRepository // this is your extension interface\r\n{\r\n    @Inject\r\n    private EntityManager em;\r\n\r\n    @Override @Transactional\r\n    public List<E> transactional(ListResultCallback callback)\r\n    {\r\n        return callback.execute();\r\n    }\r\n\r\n}\r\n---------------------------------------------------------------------------------------\r\n\r\nRepositories can then implement the `TxRepository` interface and call\r\ntheir queries in the `transactional` method (where the callback\r\nimplementation can be, for example, in an anonymous class).\r\n\r\n== Extensions\r\n\r\n=== Query Delegates\r\n\r\nWhile several base interfaces are defined for repositories, there might still be\r\nthe odd convenience method that is missing. This is actually intentional\r\n- things should not get overloaded for each and every use case. That's\r\nwhy in DeltaSpike you can define your own reusable methods.\r\n\r\nFor example, you might want to use the QueryDsl library in your\r\nrepositories:\r\n\r\n[source,java]\r\n---------------------------------------------------------\r\nimport com.mysema.query.jpa.impl.JPAQuery;\r\n\r\npublic interface QueryDslSupport\r\n{\r\n    JPAQuery jpaQuery();\r\n}\r\n\r\n@Repository(forEntity = Person.class)\r\npublic interface PersonRepository extends QueryDslSupport\r\n{\r\n   ...\r\n}\r\n---------------------------------------------------------\r\n\r\n=== Implementing the Query Delegate\r\n\r\nThe first step is to define an interface which contains the extra\r\nmethods for your repositories (as shown above):\r\n\r\n[source,java]\r\n--------------------------------\r\npublic interface QueryDslSupport\r\n{\r\n    JPAQuery jpaQuery();\r\n}\r\n--------------------------------\r\n\r\nAs a next step, you need to provide an implementation for this interface\r\nonce. It is also important that this implementation implements the\r\n`DelegateQueryHandler` interface (do not worry, this is just an empty\r\nmarker interface):\r\n\r\n[source,java]\r\n--------------------------------------------------------------------------------------------\r\npublic class QueryDslRepositoryExtension<E> implements QueryDslSupport, DelegateQueryHandler\r\n{\r\n\r\n    @Inject\r\n    private QueryInvocationContext context;\r\n\r\n    @Override\r\n    public JPAQuery jpaQuery()\r\n    {\r\n        return new JPAQuery(context.getEntityManager());\r\n    }\r\n\r\n}\r\n--------------------------------------------------------------------------------------------\r\n\r\nAs you see in the sample, you can inject a `QueryInvocationContext`\r\nwhich contains utility methods like accessing the current\r\n`EntityManager` and entity class.\r\n\r\nNote that, if you define multiple extensions with equivalent method\r\nsignatures, there is no specific order in which the implementation is\r\nselected.\r\n\r\n== Mapping\r\n\r\nWhile repositories are primarily intended to work with Entities, it\r\nmight be preferable in some cases to have an additional mapping layer on\r\ntop of them, for example because the Entities are quite complex but the service\r\nlayer needs only a limited view on it, or because the Entities are\r\nexposed over a remote interface and there should not be a 1:1 view on\r\nthe domain model.\r\n\r\nDeltaSpike Data allows to directly plugin in such a mapping mechanism\r\nwithout the need to specify additional mapping methods:\r\n\r\n[source,java]\r\n----------------------------------------------------\r\n@Repository(forEntity = Person.class)\r\n@MappingConfig(PersonDtoMapper.class)\r\npublic interface PersonRepository\r\n{\r\n\r\n    PersonDto findBySsn(String ssn);\r\n\r\n    List<PersonDto> findByLastName(String lastName);\r\n\r\n}\r\n----------------------------------------------------\r\n\r\nThe `PersonDtoMapper` class has to implement the `QueryInOutMapper`\r\ninterface:\r\n\r\n[source,java]\r\n---------------------------------------------------------------------------------\r\npublic class PersonDtoMapper implements QueryInOutMapper<Person>\r\n{\r\n\r\n    @Override\r\n    public Object mapResult(Person result)\r\n    {\r\n        ... // converts Person into a PersonDto\r\n    }\r\n    ...\r\n\r\n    @Override\r\n    public Object mapResultList(List<Person> result)\r\n    {\r\n        ... // result lists can also be mapped into something different\r\n            // than a collection.\r\n    }\r\n\r\n    @Override\r\n    public boolean mapsParameter(Object parameter)\r\n    {\r\n        return parameter != null && (\r\n                parameter instanceof PersonDto || parameter instanceof PersonId);\r\n    }\r\n\r\n    @Override\r\n    public Object mapParameter(Object parameter)\r\n    {\r\n        ... // converts query parameters if required\r\n    }\r\n}\r\n---------------------------------------------------------------------------------\r\n\r\nThe mapper can also be used to transform query parameters. Parameters\r\nare converted before executing queries and calling repository\r\nextensions.\r\n\r\nNote that those mapper classes are treated as CDI Beans, so it is\r\npossible to use injection in those beans (e.g. you might inject an\r\n`EntityManager` or other mappers). As the `@MappingConfig` refers to the\r\nmapper class directly, the mapper must be uniquely identifiable by its\r\nclass.\r\n\r\nIt is also possible to combine mappings with the base Repository classes:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------\r\n@Repository(forEntity = Person.class)\r\n@MappingConfig(PersonDtoMapper.class)\r\npublic interface PersonRepository extends EntityRepository<PersonDto, PersonId>\r\n{\r\n    ...\r\n}\r\n-------------------------------------------------------------------------------\r\n\r\nIn this case, the `forEntity` attribute in the `@Repository` annotation\r\nis mandatory. Also it is up to the mapper to convert parameters\r\ncorrectly (in this example, a conversion from a `PersonDto` parameter to\r\n`Person` entity and from `PersonId` to `Long` is necessary).\r\n\r\n=== Simple Mappings\r\n\r\nIn many cases it is just required to map a DTO object back and forth. For\r\nthis case, the `SimpleQueryInOutMapperBase` class can be subclassed,\r\nwhich only requires to override three methods:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------\r\npublic class PersonMapper extends SimpleQueryInOutMapperBase<Person, PersonDto>\r\n{\r\n\r\n    @Override\r\n    protected Object getPrimaryKey(PersonDto dto)\r\n    {\r\n        return dto.getId();\r\n    }\r\n\r\n    @Override\r\n    protected PersonDto toDto(Person entity)\r\n    {\r\n        ...\r\n    }\r\n\r\n    @Override\r\n    protected Person toEntity(Person entity, PersonDto dto) {\r\n        ...\r\n        return entity;\r\n    }\r\n}\r\n-------------------------------------------------------------------------------\r\n\r\nThe first method, `getPrimaryKey`, identifies the primary key of an\r\nincoming DTO (this might need mapping too). If there is a primary key in\r\nthe DTO, Data tries to retrieve the Entity and feed it to the `toEntity`\r\nmethod, so the entity to be mapped is **attached to the persistence\r\ncontext**. If there is no primary key, a new instance of the Entity is\r\ncreated. In any case, there is no need to map the primary key to the\r\nentity (it either does not exist or is already populated for an existing\r\nentity).\r\n\r\n== JPA Criteria API Support\r\n\r\nBesides automatic query generation, the DeltaSpike Data module also\r\nprovides a DSL-like API to create JPA 2 Criteria queries. It takes\r\nadvantage of the JPA 2 meta model, which helps creating type safe\r\nqueries.\r\n\r\nTIP: The JPA meta model can easily be generated with an annotation processor.\r\nHibernate or EclipseLink provide such a processor, which can be\r\nintegrated into your compile and build cycle.\r\n\r\nNote that this criteria API is not intended to replace the standard\r\ncriteria API - it is rather a utility API that should make life easier on\r\nthe most common cases for a custom query. The JPA criteria API's\r\nstrongest point is certainly its type safety - which comes at the cost\r\nof readability. We're trying to provide a middle way here. A less\r\npowerful API, but still type safe and readable.\r\n\r\n=== API Usage\r\n\r\nThe API is centered around the Criteria class and is targeted to provide\r\na fluent interface to write criteria queries:\r\n\r\n[source,java]\r\n---------------------------------------------------------------------------\r\n@Repository(forEntity = Person.class)\r\npublic abstract class PersonRepository implements CriteriaSupport<Person>\r\n{\r\n\r\n    public List<Person> findAdultFamilyMembers(String name, Integer minAge)\r\n    {\r\n        return criteria()\r\n                .like(Person_.name, \"%\" + name + \"%\")\r\n                .gtOrEq(Person_.age, minAge)\r\n                .eq(Person_.validated, Boolean.TRUE)\r\n                .orderDesc(Person_.age)\r\n                .getResultList();\r\n    }\r\n\r\n}\r\n---------------------------------------------------------------------------\r\n\r\nFollowing comparators are supported by the API:\r\n\r\n[options=\"header,autowidth\"]\r\n|===\r\n| Name                    | Description\r\n| .eq(..., ...)           | Property value must be equal to the given value\r\n| .in(..., ..., ..., ...) | Property value must be in one of the given values.\r\n| .notEq(..., ...)        | Negates equality\r\n| .like(..., ...)         | A SQL `like` equivalent comparator. Use % on the value.\r\n| .notLike(..., ...)      | Negates the like value\r\n| .lt(..., ...)           | Property value must be less than the given value.\r\n| .ltOrEq(..., ...)       | Property value must be less than or equal to the given value.\r\n| .gt(..., ...)           | Property value must be greater than the given value.\r\n| .ltOrEq(..., ...)       | Property value must be greater than or equal to the given value.\r\n| .between(..., ..., ...) | Property value must be between the two given values.\r\n| .isNull(...)            | Property must be `null`\r\n| .isNotNull(...)         | Property must be non-`null`\r\n| .isEmpty(...)           | Collection property must be empty\r\n| .isNotEmpty(...)        |Collection property must be non-empty\r\n|===\r\n\r\nThe query result can be modified with the following settings:\r\n\r\n[options=\"header,autowidth\"]\r\n|===\r\n| Name                     | Description\r\n| .orderAsc(...)           | Sorts the result ascending by the given property. Note that this can be applied to several properties\r\n| .orderDesc(...)          | Sorts the result descending by the given property. Note that this can be applied to several properties\r\n| .distinct()              | Sets distinct to true on the query.\r\n|===\r\n\r\nOnce all comparators and query options are applied, the `createQuery()`\r\nmethod is called. This creates a JPA TypedQuery object for the\r\nrepository entity. If required, further processing can be applied here.\r\n\r\n=== Joins\r\n\r\nFor simple cases, restricting on the repository entity only works out\r\nfine, but once the Data model gets more complicated, the query will have\r\nto consider relations to other entities. The module's criteria API\r\ntherefore supports joins as shown in the sample below:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\n@Repository\r\npublic abstract class PersonRepository extends AbstractFullEntityRepository<Person, Long>\r\n{\r\n\r\n    public List<Person> findByCompanyName(String companyName)\r\n    {\r\n        return criteria()\r\n                .join(Person_.company,\r\n                    where(Company.class)\r\n                        .eq(Company_.name, companyName)\r\n                )\r\n                .eq(Person_.validated, Boolean.TRUE)\r\n                .getResultList();\r\n    }\r\n\r\n}\r\n-------------------------------------------------------------------------------------\r\n\r\nBeside the inner and outer joins, also fetch joins are supported. Those\r\nare slighly simpler as seen in the next sample:\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\npublic abstract class PersonRepository extends AbstractFullEntityRepository<Person, Long>\r\n{\r\n\r\n    public Person findBySSN(String ssn)\r\n    {\r\n        return criteria()\r\n                .fetch(Person_.familyMembers)\r\n                .eq(Person_.ssn, ssn)\r\n                .distinct()\r\n                .getSingleResult();\r\n    }\r\n\r\n}\r\n-------------------------------------------------------------------------------------\r\n\r\n=== Boolean Operators\r\n\r\nBy default, all query operators are concatenated as an and conjunction\r\nto the query. The DeltaSpike criteria API also allows to add groups of\r\ndisjunctions.\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\npublic abstract class PersonRepository extends AbstractFullEntityRepository<Person, Long>\r\n{\r\n\r\n    public List<Person> findAdults()\r\n    {\r\n        return criteria()\r\n                .or(\r\n                    criteria().\r\n                        .gtOrEq(Person_.age, 18)\r\n                        .eq(Person_.origin, Country.SWITZERLAND),\r\n                    criteria().\r\n                        .gtOrEq(Person_.age, 21)\r\n                        .eq(Person_.origin, Country.USA)\r\n                )\r\n                .getResultList();\r\n    }\r\n\r\n}\r\n-------------------------------------------------------------------------------------\r\n\r\n=== Selections\r\n\r\nIt might not always be appropriate to retrieve full entities - you might\r\nalso be interested in scalar values or by modified entity attributes.\r\nThe Criteria interface allows this with the selection method:\r\n\r\n[source,java]\r\n------------------------------------------------------------------------------------------------------\r\npublic abstract class PersonRepository extends AbstractFullEntityRepository<Person, Long>\r\n{\r\n\r\n    public Statistics ageStatsFor(Segment segment)\r\n    {\r\n        return criteria()\r\n                 .select(Statistics.class, avg(Person_.age), min(Person_.age), max(Person_.age))\r\n                 .eq(Person_.segment, segment)\r\n                 .getSingleResult();\r\n    }\r\n\r\n    public List<Object[]> personViewForFamily(String name)\r\n    {\r\n        return criteria()\r\n                 .select(upper(Person_.name), attribute(Person_.age), substring(Person_.firstname, 1))\r\n                 .like(Person_.name, name)\r\n                 .getResultList();\r\n    }\r\n\r\n}\r\n------------------------------------------------------------------------------------------------------\r\n\r\nThere are also several functions supported which can be used in the\r\nselection clause:\r\n\r\n[options=\"header,autowidth\"]\r\n|===\r\n|Name                              | Description\r\n| abs(...)                         | Absolute value. Applicable to Number attributes.\r\n| avg(...)                         | Average value. Applicable to Number attributes.\r\n| count(...)                       | Count function. Applicable to Number attributes.\r\n| max(...)                         | Max value. Applicable to Number attributes.\r\n| min(...)                         | Min value. Applicable to Number attributes.\r\n| modulo(...)                      | Modulo function. Applicable to Integer attributes.\r\n| neg(...)                         | Negative value. Applicable to Number attributes.\r\n| sum(...)                         | Sum function. Applicable to Number attributes.\r\n| lower(...)                       | String to lowercase. Applicable to String attributes.\r\n| substring(int from, ...)         | Substring starting from. Applicable to String attributes.\r\n| substring(int from, int to, ...) | Substring starting from ending to. Applicable to String attributes.\r\n| upper(...)                       | String to uppercase. Applicable to String attributes.\r\n| currDate()                       | The DB sysdate. Returns a Date object.\r\n| currTime()                       | The DB sysdate. Returns a Time object.\r\n| currTStamp()                     | The DB sysdate. Returns a Timestamp object.\r\n|===\r\n\r\n\r\n== Auditing\r\n\r\nA common requirement for entities is tracking what is being done with\r\nthem. DeltaSpike provides a convenient way to support this requirement.\r\n\r\nNOTE: DeltaSpike does not support creating revisions of entities. If this is a\r\nrequirement for your audits, have a look at Hibernate Envers.\r\n\r\n=== Activating Auditing\r\n\r\nDeltaSpike uses an entity listener to update auditing data before\r\nentities get created or update. The entity listener must be activated\r\nbefore it can be used. This can either be done globally for all entities\r\nof a persistent unit or per entity.\r\n\r\nActivation per persistence unit in `orm.xml`:\r\n\r\n[source,xml]\r\n-----------------------------------------------------------------------------------------------------------------------------------------\r\n<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\r\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n        xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\" version=\"2.0\">\r\n    <persistence-unit-metadata>\r\n        <persistence-unit-defaults>\r\n            <entity-listeners>\r\n                <entity-listener class=\"org.apache.deltaspike.data.impl.audit.AuditEntityListener\" />\r\n            </entity-listeners>\r\n        </persistence-unit-defaults>\r\n    </persistence-unit-metadata>\r\n</entity-mappings>\r\n-----------------------------------------------------------------------------------------------------------------------------------------\r\n\r\nActivation per entity:\r\n\r\n[source,java]\r\n-------------------------------------------\r\n@Entity\r\n@EntityListeners(AuditEntityListener.class)\r\npublic class AuditedEntity\r\n{\r\n\r\n    ...\r\n\r\n}\r\n-------------------------------------------\r\n\r\nNote that for this variant, you need a compile dependency on the impl\r\nmodule. Alternatively, also the per entity listener can be configured by\r\nXML.\r\n\r\n=== Using Auditing Annotations\r\n\r\nAll that has to be done now is annotating the entity properties which\r\nare used to audit the entity.\r\n\r\n====  Updating Timestamps\r\n\r\nTo keep track on creation and modification times, following annotations\r\ncan be used:\r\n\r\n[source,java]\r\n-------------------------------------\r\n@Entity\r\npublic class AuditedEntity\r\n{\r\n\r\n    ...\r\n\r\n    @Temporal(TemporalType.TIMESTAMP)\r\n    @CreatedOn\r\n    private Date created;\r\n\r\n    @Temporal(TemporalType.TIMESTAMP)\r\n    @ModifiedOn\r\n    private Date updated;\r\n\r\n    ...\r\n\r\n}\r\n-------------------------------------\r\n\r\nIn case the modification date should also be set during entity creation,\r\nthe annotation can be customized:\r\n\r\n-----------------------------\r\n@ModifiedOn(setOnCreate=true)\r\n-----------------------------\r\n\r\n====  Who's Changing My Entities?\r\n\r\nBeside keeping track of when a change has happened, it is also often\r\ncritical to track who's responsible for the change. Annotate a user\r\ntracking field with the following annotation:\r\n\r\n[source,java]\r\n-----------------------------\r\n@Entity\r\npublic class AuditedEntity\r\n{\r\n\r\n    ...\r\n\r\n    @ModifiedBy\r\n    private String auditUser;\r\n\r\n    ...\r\n\r\n}\r\n-----------------------------\r\n\r\nNow a little help is needed. The entity listener needs to be able to\r\nresolve the current user - there must be a bean available of the\r\nmatching type for the annotation property, exposed over a special CDI\r\nqualifier:\r\n\r\n[source,java]\r\n----------------------------------\r\npublic class UserProvider\r\n{\r\n\r\n    @Inject\r\n    private User user;\r\n\r\n    @Produces @CurrentUser\r\n    public String currentUser() {\r\n        return user.getUsername();\r\n    }\r\n\r\n    ...\r\n\r\n}\r\n----------------------------------\r\n\r\nTIP: The JPA Spec does not recommend to modify entity relations from within a\r\nlifecycle callback. If you expose another entity here, make sure that\r\nyour persistence provider supports this. Also you should ensure that the\r\nentity is attached to a persistent context. Also, be aware that the CDI\r\ncontainer will proxy a scoped bean, which might confuse the persistence\r\nprovider when persisting / updating the target entity.\r\n"
  },
  {
    "path": "documentation/src/main/asciidoc/encryption.adoc",
    "content": "= DeltaSpike Crypto Mechanism\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n\n== Introduction\n\nMany applications still use plaintext to store sensitive information.\nThis should be avoided to not loose sensible user information in case of a security breach.\n\nApache DeltaSpike provides a mechanism to encrypt and decrypt secured information to better guard such information.\n\n\n\n== The Algorithm\n\nDeltaSpike provides encryption based on a split secret approach.\nMany systems (like Maven, Jenkins) store the hash of a 'master password' in the users home folder.\nThis master hash is then used to encrypt/decrypt the actual passwords.\nIf an attacker manages to get his hands on the content of the database then he still cannot do much with the encrypted content stored therein.\nHe would also need the content of the file containing the master password.\n\nDeltaSpike improves this mechanism by adding an additional secret (`masterSalt`) which needs to be provided by the application.\nWith this approach we add an additional obstacle for any attacker.\nThe attacker would now not only need the file from the users home folder but also need to debug and reconstruct the application.\nThis approach additionally has the benefit to be able to store and use multiple different master passwords at the same time.\n\nThat means that DeltaSpike needs 3 different pieces\n\n- the encryted content. E.g. a password stored in some property file or in the database\n- The `~/.deltaspike/master.hash` file containing the previously set master password.\n- the `masterSalt` provided by the application and while setting the master password.\n\nAll that still does *not* create absolute security, mostly because there is no such thing like _absolute_ security!\n\nEach system which claims absolute security is to be taken with caution.\n\nBut this handling will drastically improve the security of your application.\nSee the section about the `masterSalt` for more tips to strengthten security.\n\n== Using the Command Line Interface\n\nApache DeltaSpike also contains CLI commands to store the `masterPassword` and encrypt user values.\n\nThe first step is to create a master hash.\nIt is by default stored in the users home folder at `~/.deltaspike/master.hash`.\nFor creating a master hash you need to use a `masterPassword` and a `masterSalt`\n\n[source,bash]\n----\n$> java -jar deltaspike-core-impl.jar encode -masterPassword myMasterPassword -masterSalt myMasterSalt\nA new master password got set. Hash key is cbd90f294dc4ed3d1113a98107fabbc370b303c4a5e3208c2df3e0326c31499c\n----\n\nYou can now go on and encrypt your plaintext information:\n\n\n[source,bash]\n----\n$> java -jar deltaspike-core-impl.jar encode -plaintext textOneWantsToEncrypt -masterSalt myMasterSalt\nEncrypted value: 9d4196aa28d83a08b32752966aa5f4aa41c359fec847fdad3565241bb5e2df12\n----\n\n\nThe encrypted value can then be stored in the databas, config files, etc.\n\n\n== The masterPassword\n\nThe masterPassword is used to protect the secret.\nNote that it's not possible to reconstruct the masterPassword from the master.hash file.\n\n== Providing a masterSalt\n\nThe `masterSalt` is not used to encrypt the secrets but it only protects the `masterPassword` in the `master.hash` file.\nThis means that the masterSalt could be either static or even change over time.\n\nThe `masterSalt` could also be a combined local information.\nAs an example we take the local IP address and the user name running the application.\n\n[source,java]\n----\nString localInformation = InetAddress.getLocalHost().getHostAddress() + System.getProperty(\"user.name\");\nString masterSalt = sha1(localInformation);\n----\n\nNote the usage of the hash.\nOtherwise it would be too obvious how the masterSalt gets constructed\nIf this code is well hidden within the application code it is really hard for an attacker to find out how it is determined.\nOtoh this hash can easily be constructed on the command line with classic unix tools like `sha1sum`\n\n\n== Programmatic usage\n\nA program could either inject a CipherService or create a new DefaultCipherService to programmatically decrypt values.\nA usr could also provide a `ConfigFilter` to apply decryption on encrypted configuration values on the fly\n\n"
  },
  {
    "path": "documentation/src/main/asciidoc/index.adoc",
    "content": ":notoc:\n\n= Documentation\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n++++\n<style>\n#doc-content h2 {\n    border-bottom: none;\n}\n</style>\n<div class=\"row-fluid\">\n    <div class=\"span4\">\n        <h2>Get Started</h2>\n        <ul class=\"nav nav-list toc-like\">\n            <li><a href=\"overview.html\">Overview of DeltaSpike</a></li>\n            <li><a href=\"configure.html\">Configure DeltaSpike in Your Projects</a></li>\n            <li><a href=\"cdiimp.html\">Enable CDI For Your Java Environment</a></li>\n            <li><a href=\"../examples.html\">See DeltaSpike in Action</a></li>\n        </ul>\n\n        <h2>More resources</h2>\n        <ul class=\"nav nav-list toc-like\">\n            <li><a href=\"../articles.html\">Articles and Blogs</a></li>\n            <li><a href=\"../addons.html\">Add-ons</a></li>\n            <li><a href=\"../external.html\">External Examples</a></li>\n        </ul>\n    </div>\n\n    <div class=\"span4\">\n        <h2>Modules</h2>\n        <ul class=\"nav nav-list toc-like\">\n            <li><a href=\"modules.html\">Overview of DeltaSpike Modules</a></li>\n            <li><a href=\"core.html\">Core</a></li>\n            <li><a href=\"configuration.html\">Configuration</a></li>\n            <li><a href=\"bean-validation.html\">Bean Validation</a></li>\n            <li><a href=\"container-control.html\">Container Control</a></li>\n            <li><a href=\"data.html\">Data</a></li>\n            <li><a href=\"jpa.html\">JPA</a></li>\n            <li><a href=\"jsf.html\">JSF</a></li>\n            <li><a href=\"partial-bean.html\">Partial-Bean</a></li>\n            <li><a href=\"proxy.html\">Proxy</a></li>\n            <li><a href=\"scheduler.html\">Scheduler</a></li>\n            <li><a href=\"security.html\">Security</a></li>\n            <li><a href=\"servlet.html\">Servlet</a></li>\n            <li><a href=\"test-control.html\">Test-Control</a></li>\n        </ul>\n    </div>\n\n    <div class=\"span4\">\n        <h2>Advanced information</h2>\n        <ul class=\"nav nav-list toc-like\">\n            <li><a href=\"build.html\">Build and Test DeltaSpike from Source</a></li>\n            <li><a href=\"snapshots.html\">Use DeltaSpike Snapshots</a></li>\n            <li><a href=\"../migration-guide.html\">Migrate to DeltaSpike</a></li>\n            <li><a href=\"../source.html\">Contribute to the DeltaSpike Source</a></li>\n            <li><a href=\"spi.html\">DeltaSpike Service Provider Interface (SPI)</a></li>\n        </ul>\n    </div>\n\n</div>\n++++"
  },
  {
    "path": "documentation/src/main/asciidoc/jpa.adoc",
    "content": ":moduledeps: core\n:moduleconf: api:org.apache.deltaspike.jpa.api.transaction.TransactionConfig\n\n= JPA Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe JPA module provides a transactional context and scope, enabling execution of methods within transactions.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== 1. Declare JPA Module Dependencies\nAdd the JPA module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jpa-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jpa-module-impl</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-jpa-module-impl'\n     compile 'org.apache.deltaspike.modules:deltaspike-jpa-module-api'\n----\n\n=== 2. (Optional) Enable the Transaction Interceptor\nNOTE: If you are using CDI 1.0 or CDI 1.1+ with DeltaSpike v1.1.0 and earlier, you must enable the transaction interceptor in the project `beans.xml` file:\n\n[source,xml]\n----\n<beans>\n    <!-- Not needed with CDI 1.1+ and DeltaSpike v1.1.1+ -->\n    <interceptors>\n        <class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>\n    </interceptors>\n</beans>\n----\n\n== @Transactional\n\nThis annotation is an alternative to transactional EJBs and enables the execution\nof a method within a transaction. Before it is possible to start\nusing the annotation, it is required to implement a CDI producer for an\n`EntityManager` and it is needed to inject the `EntityManager` in the\nbean which uses `@Transactional`. As shown later on, it is also possible\nto use multiple qualifiers for using different EntityManagers.\n\n=== Basic usage\n\nThe following example shows a simple producer for an `EntityManager` and\nthe corresponding disposer method. Producing it as request scoped bean\nmeans that the disposer method will be called on finishing the request.\nAlternatively it is possible to use a special scope called\n<<__transactionscoped, `@TransactionScoped`>>.\n\n.Producer for the Default EntityManager (non-EE server)\n[source,java]\n----------------------------------------------------------------------------\n//...\npublic class EntityManagerProducer\n{\n    //or manual bootstrapping\n    @PersistenceContext\n    private EntityManager entityManager;\n\n    @Produces\n    @RequestScoped\n    protected EntityManager createEntityManager()\n    {\n        return this.entityManager;\n    }\n\n    protected void closeEntityManager(@Disposes EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n}\n----------------------------------------------------------------------------\n\n.Producer for the Default EntityManager (EE server)\n[source,java]\n-----------------------------------------------------------------------\n@ApplicationScoped\npublic class EntityManagerProducer\n{\n    @PersistenceUnit\n    private EntityManagerFactory entityManagerFactory;\n\n    @Produces\n    @Default\n    @RequestScoped\n    public EntityManager create()\n    {\n        return this.entityManagerFactory.createEntityManager();\n    }\n\n    public void dispose(@Disposes @Default EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n}\n-----------------------------------------------------------------------\n\nThe following examples show how to use the `EntityManager` produced by\nthe example above.\n\n.Bean with a Transactional Method\n[source,java]\n----------------------------------------\n//...\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        //...\n    }\n}\n----------------------------------------\n\n.Simple Transactional Bean (All Methods are Transactional)\n[source,java]\n----------------------------------------\n//...\n@Transactional\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    //...\n}\n----------------------------------------\n\nAs illustrated in the following example it is also possible to use\n`@Transactional` for stereotypes.\n\n.Stereotype for Transactional Beans (+ Usage)\n[source,java]\n----------------------------------------\n@Stereotype\n@Transactional\n@ApplicationScoped\npublic @interface Repository\n{\n}\n\n//...\n@Repository\npublic class TransactionalBean\n{\n    @Inject\n    private EntityManager entityManager;\n\n    //...\n}\n----------------------------------------\n\n=== Multiple EntityManagers\n\nThe default qualifier for `@Transactional` is `@Any` whereby a transaction gets started for every injected entity manager. Besides such simple usages, it is also possible to access multiple persistence units in parallel using qualifiers. \n\nFirst, the EntityManagers or EntityManagerFactories must be obtained from the JPA subsystem, then EntityManagers must be made available as CDI beans and finally injected into `@Transactional` beans for usage.\n\n==== Obtaining EntityManagers from JPA\n\nIn EE managed environments the EntityManager can be obtained directly or through an EntityManagerFactory using standard JPA annotations `@PersistenceContext` for an EntityManager or `@PersistenceUnit` for an EntityManagerFactory.\n\nWhen using `@PersistenceContext` the Container has the full control over the EntityManager.\nIn this case transactions have to be conducted via a `TransactionManager` or `UserTransaction`.\nIf the Database connection is set up to be JTA aware then please also see our <<JTA Support>> section.\n\n.Container Managed EntityManager\n[source,java]\n----\npublic class EntityManagerProducer {\n\n    @PersistenceContext(unitName = \"firstDB\")\n    private EntityManager firstEntityManager;\n\n    @PersistenceContext(unitName = \"secondDB\")\n    private EntityManager secondEntityManager;\n    \n    // ...\n}\n----\n\nAn alternative for non-EE environments is available through DeltaSpike's `@PersistenceUnitName` qualifier allowing to inject EntityManagerFactories.\n\n.Unmanaged EntityManagerFactory\n[source,java]\n----\npublic class EntityManagerProducer {\n\n    @Inject\n    @PersistenceUnitName(\"puA\")\n    private EntityManagerFactory emfA;\n\n    @Inject\n    @PersistenceUnitName(\"puB\")\n    private EntityManagerFactory emfB;\n    \n    // ...\n}\n----\n\nObtaining an EntityManager from an EntityManagerFactory is just a matter of calling `emfA.createEntityManager()`.\nDeltaSpike provides a built-in producer for `@PersistenceUnitName` qualified EntityManagerFactories.\nThis producer also looks up  a property files with the name `persistence-{persistenceunit name}.properties` via the DeltaSpike `PropertyLoader`.\nFor the example above this would be `persistence-puA.properties`.\nThe properties in this file will be passed 1:1 to `Persistence#createEntityManagerFactory(properties)` by the built-in producer method.\n\n==== Producing Multiple EntityManagers\nThere are several ways to make multiple entity managers available for use in `@Transactional` methods, each suitable for a different situation.\n\nThe simplest method employs a producer and a disposer for each EntityManager.\n\n.Deciding using qualifiers\n[source,java]\n----\npublic class EntityManagerProducer {\n    \n    // ...entity managers or factories injected here\n    \n    @Produces\n    @RequestScoped // or other\n    @DbA //custom qualifier annotation\n    public EntityManager createEntityManagerA()\n    {\n        return emfA.createEntityManager();\n    }\n\n    public void closeEmA(@Disposes @DbA EntityManager em)\n    {\n        em.close();\n    }\n\n    @Produces\n    @RequestScoped\n    @DbB //custom qualifier annotation\n    public EntityManager createEntityManagerB()\n    {\n        return emfB.createEntityManager();\n    }\n\n    public void closeEmB(@Disposes @DbB EntityManager em)\n    {\n        em.close();\n    }\n    \n}\n----\n\nIf there's the need to decide dynamically on which EntityManager should be used when it's possible to use the standard CDI facility of `InjectionPoint` to get information about the injection points and produce different EntityManagers with just one producer method.\n\n.Deciding using InjectionPoint\n[source,java]\n----\npublic class EntityManagerProducer {\n\n    // ...entity managers or factories injected here\n\n    @Produces\n    protected EntityManager createEntityManager(InjectionPoint injectionPoint)\n    {\n        CustomQualifier customQualifier = injectionPoint.getAnnotated().getAnnotation(CustomQualifier.class);\n        return selectEntityManager(customQualifier); //selects firstEntityManager or secondEntityManager based on the details provided by CustomQualifier\n    }\n}\n----\n\nThe information necessary to make the decision about the EntityManager appropriate for the current situation and injection point may be available elsewhere, for example in a custom context.\n\n.Deciding using anything else\n[source,java]\n----\npublic class EntityManagerProducer {\n\n    // ...entity managers or factories injected here\n    \n    @Inject\n    private CustomDatabaseContext customDatabaseContext;\n\n    @Produces\n    protected EntityManager createEntityManager()\n    {\n        if (customDatabaseContext.usePrimaryDb()) {\n            return firstEntityManager;\n        }\n        return secondEntityManager;\n    }\n}\n----\n\n==== Using transactions with multiple EntityManagers\n\nOne use case for multiple EntityManagers is their usage in nested transactions. When a transactional method is called from within a transactional method, it joins the existing transaction.\n\n.Nested transactions with multiple EntityManagers\n[source,java]\n----\npublic class FirstLevelTransactionBean\n{\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private NestedTransactionBean nestedTransactionBean;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        //...\n        this.nestedTransactionBean.executeInTransaction();\n    }\n}\n\npublic class NestedTransactionBean\n{\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional\n    public void executeInTransaction()\n    {\n        //...\n    }\n}\n----\n\nIt's also easy to use multiple EntityManagers in the same bean in different transactional methods. By default, a `@Transactional` method would enroll all of the EntityManagers in the transaction. By using `@Transactional(qualifier=...)` it's easy to choose individual EntityManagers for each transactional method.\n\n.Selecting individual EntityManagers for a transactional method\n[source,java]\n-----------------------------------------------------------\npublic class MultiTransactionBean\n{\n    @Inject\n    private EntityManager defaultEntityManager;\n\n    @Inject\n    private @First EntityManager firstEntityManager;\n\n    @Inject\n    private @Second EntityManager secondEntityManager;\n\n    @Transactional(qualifier = Default.class)\n    public void executeInDefaultTransaction() {...}\n\n    @Transactional(qualifier = First.class)\n    public void executeInFirstTransaction() {...}\n\n    @Transactional(qualifier = {First.class, Second.class})\n    public void executeInFirstAndSecondTransaction() {...}\n}\n-----------------------------------------------------------\n\nThe final transaction handling for all `EntityManager` s is also done\nafter the outermost transactional method if `NestedTransactionBean` uses\na different `EntityManager`. So it is possible to catch an exception in\n`FirstLevelTransactionBean`, for example, to try an optional path instead of an\nimmediate rollback.\n\n== @TransactionScoped\n\n`@Transactional` also starts a context which is available as long as the\ntransaction started by `@Transactional`. Besides other beans you can use\nthis scope for the `EntityManager` itself. That means the\n`EntityManager` will be closed after leaving the method annotated with\n`@Transactional`. \n\n.Using a transaction-scoped EntityManager\n[source,java]\n----------------------------------------------------------------------------\npublic class EntityManagerProducer\n{\n    //or manual bootstrapping\n    @PersistenceContext\n    private EntityManager entityManager;\n\n    @Produces\n    @TransactionScoped\n    protected EntityManager createEntityManager()\n    {\n        return this.entityManager;\n    }\n\n    protected void closeEntityManager(@Disposes EntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n}\n----------------------------------------------------------------------------\n\n== Extended Persistence Contexts\n\nFrameworks like MyFaces Orchestra provide a feature which allows keeping\nan `EntityManager` across multiple requests. That means it is not\nrequired to call `EntityManager#merge` to add detached entities to the\ncontext. However, several application architectures do not allow such an\napproach (due to different reasons like scalability). In theory that\nsounds nice and it works pretty well for small to medium sized projects\nespecially if an application does not rely on session replication in clusters.\nThat also means that such an approach restricts your target environment\nfrom the very beginning. One of the base problems is that an\n`EntityManager` is not serializable. Beans which are scoped in a\nnormal-scoped CDI context have to be serializable. So by default it\nis not allowed by CDI to provide a producer-method which exposes, for example, a\nconversation scoped `EntityManager` as it is. We *do not* recommend this approach and therefore it is not available out-of-the-box.\nHowever, if you really need this approach to avoid calling `#merge` for\nyour detached entities, it is pretty simple to add this functionality.\n\n.Usage of a Simple extended EntityManager\n[source,java]\n------------------------------------\n@Inject\nprivate EntityManager entityManager;\n------------------------------------\n\nAs you see the usage is the same. You *do not* have to use\n`ExtendedEntityManager` at the injection point. It is just needed in the\nproducer-method:\n\n.Producer for an extended EntityManager (non-EE server)\n[source,java]\n------------------------------------------------------------------------------------\n//...\npublic class ExtendedEntityManagerProducer\n{\n    //or manual bootstrapping\n    @PersistenceContext\n    private EntityManager entityManager;\n\n    @Produces\n    @RequestScoped\n    protected ExtendedEntityManager createEntityManager()\n    {\n        return new ExtendedEntityManager(this.entityManager);\n    }\n\n    protected void closeEntityManager(@Disposes ExtendedEntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n}\n------------------------------------------------------------------------------------\n\n.Producer for an extended EntityManager (EE server)\n[source,java]\n------------------------------------------------------------------------------------------\n@ApplicationScoped\npublic class ExtendedEntityManagerProducer\n{\n    @PersistenceUnit\n    private EntityManagerFactory entityManagerFactory;\n\n    @Produces\n    @Default\n    @RequestScoped\n    public ExtendedEntityManager create()\n    {\n        return new ExtendedEntityManager(this.entityManagerFactory.createEntityManager());\n    }\n\n    public void dispose(@Disposes @Default ExtendedEntityManager entityManager)\n    {\n        if (entityManager.isOpen())\n        {\n            entityManager.close();\n        }\n    }\n}\n------------------------------------------------------------------------------------------\n\n.Implementation of a simple extended EntityManager\n[source,java]\n-------------------------------------------------------------------------\n@Vetoed\npublic class ExtendedEntityManager implements EntityManager, Serializable\n{\n    private static final long serialVersionUID = 3770954229283539616L;\n\n    private transient EntityManager wrapped;\n\n    protected ExtendedEntityManager()\n    {\n    }\n\n    public ExtendedEntityManager(EntityManager wrapped)\n    {\n        this.wrapped = wrapped;\n    }\n\n    /*\n     * generated\n     */\n    //delegate all calls to this.wrapped - most IDEs allow to generate it\n}\n-------------------------------------------------------------------------\n\nThis approach just works if it *does not come to serialization* of this\nwrapper, for example in case of session-replication. If those beans get\nserialized, you have to overcome this restriction by storing the\npersistence-unit-name and recreate the `EntityManager` via\n`Persistence.createEntityManagerFactory(this.persistenceUnitName).createEntityManager();`\nand sync it with the database before closing it on serialization.\nFurthermore, you have to intercept some methods of the `EntityManager`\nto merge detached entities automatically if those entities get\nserialized as well. However, as mentioned before *we do not recommend*\nsuch an approach.\n\n== JTA Support\n\nBy default the transaction-type used by `@Transactional` is\n`RESOURCE_LOCAL`. If you configure `transaction-type=\"JTA\"` in the\npersistence.xml file, you have to enable an alternative `TransactionStrategy`\nin the beans.xml which is called\n`org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy`.\n\n[source,xml]\n----------------------------------------------------------------------------------------------------\n<beans>\n    <alternatives>\n        <class>org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy</class>\n    </alternatives>\n</beans>\n----------------------------------------------------------------------------------------------------\n\nAlternatively, you may expect that your transactions are started at a higher level, e.g. you're exposing a REST API\nand the endpoints themselves are either `@Transactional` or Stateless session beans, either with container managed\nTransactions, you would use `org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy`.  This\nis the strategy to use if you are leveraging `@PersistenceContext` to inject your `EntityManager`.\n\nIf you have multiple persistence units and you have to use both\ntransaction types or the settings for development have to be different\nthan the production settings, you can use\n`org.apache.deltaspike.jpa.impl.transaction.EnvironmentAwareTransactionStrategy`\ninstead.\n\nNOTE: In case of some versions of Weld - including several versions of JBoss EAP/Wildfly and Websphere Liberty Profile -\nor OpenWebBeans in BDA mode - which is not the default one, you have\nto configure it as a <<spi.adoc#GlobalAlternative,global alternative>> instead of an `alternative` in\n`beans.xml`. That means you have to add, for example,\n`globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy \n=org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy` or \n`globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy = org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy` \nto `/META-INF/apache-deltaspike.properties`.\n"
  },
  {
    "path": "documentation/src/main/asciidoc/jsf.adoc",
    "content": ":moduledeps: core, security, proxy\n:moduleconf: api:org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig, api:org.apache.deltaspike.jsf.api.config.JsfModuleConfig\n\n= JSF Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe JSF module provides CDI integration with JSF, with type-safe view config, multi-window handling, new scopes (WindowScoped, ViewScope, ViewAccessScoped, GroupedConversationScoped) and integration with DeltaSpike “core” messages and exception handling.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== Declare JSF Module Dependencies\nAdd the JSF module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jsf-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jsf-module-impl</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-jsf-module-impl'\n     compile 'org.apache.deltaspike.modules:deltaspike-jsf-module-api'\n----\n\nSome EE6 servers cannot handle optional classes. From DeltaSpike 1.0.1, if you do not like the corresponding log entries during startup or the deployment fails, you can use an alternative impl-module (instead of deltaspike-jsf-module-impl):\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-jsf-module-impl-ee6</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-jsf-module-impl-ee6'\n----\n\n.Support of EAR deployments\nIMPORTANT: Before using features described by this page, please ensure that you are\naware of\nhttps://issues.apache.org/jira/browse/DELTASPIKE-335[DELTASPIKE-335] and\nthe corresponding impact.\n\n== JSF Messages\n\nDeltaSpike provides an injectable component for typesafe FacesMessages.\n\nIs provides an integration with <<core.adoc#_messages_and_i18n,MessageBundle>> making the use of JSF messages and I18N simple and type-safe.\n\nUsage:\n\n[source,java]\n---------------------------------------------\n\n@MessageBundle\npublic interface Messages\n{\n    @MessageTemplate(\"Welcome to DeltaSpike\")\n    String welcomeToDeltaSpike();\n}\n\n @Model\n public class MyJSFBean\n {\n    @Inject\n    private JsfMessage<Messages> messages;\n\n    ...\n    messages.addInfo().welcomeToDeltaSpike();\n}\n---------------------------------------------\n\nMessageBundle methods which are used as JsfMessage can return a `org.apache.deltaspike.core.api.message.Message` or a String.\nIn case of a String we use it for both the summary and detail information on the FacesMessage.\n\nIf a Message is returned, we lookup the 'detail' and 'summary' categories (see `org.apache.deltaspike.core.api.message.Message#toString(String)` for creating the FacesMessage.\n\n== Multi-Window Handling\n\n=== Background\n\n==== Historic Considerations\n\nUntil the end of the 1990s web browsers are usually single threaded and\nonly had one window. But in the last years browsers supporting multiple\nwindows or even tab became the standard. Since those days lots of\nefforts went into uniquely identifying a single browser window on the\nserver side. Sadly browser windows still lack of a native windowId, thus\nmaintaining web application data in @SessionScoped backing beans is\nstill used in most of the cases.\n\n==== How JSF-2 Changed the World\n\nThe MyFaces Orchestra community did a good summary about the various\nways to handle multiple window support in JSF Applications. Those\nfindings are still valid and up to date, but the environmental\nconditions have changed slightly since then. It is easy to pass a\nwindowId around with a POST request, but it gets tricky with GET\nrequests. Due to the new JSF-2 ability to use bookmarkable URLs and deep\nlinks, a typical JSF-2 application contains much more GET links than we\nused to see in JSF-1, thus we have far more href links to cope with.\n\n==== Standard windowId Handling\n\nWith a classical approach we would not be able to simply add a windowId\nparameter to such links because if the user would open the link in a new\nbrowser window or tab, we would carry the windowId - and thus the window\nscope - over to the new browser tab/window. The classic solution was to\nomit the windowId for all GET links, but by doing this we would now\nloose the window scope far too often with JSF-2! Marios summary also\ncontains a method to prevent this problem by storing a value directly in\nthe browser window via JavaScript. Usually this is rendered and executed\nin the same page as the user form. See the \"Post-render window\ndetection\" paragraph for a more detailed description. The major downside\nof this solution is that we might already pollute 'foreign' beans (and\ndestroy their information) while rendering the page, which means this is\nnot feasible as general solution.\n\n\n=== Available Modes\n\n==== CLIENTWINDOW\n\nEach GET request results in an intermediate small HTML page (aka \"windowhandler\").\nIf the window.name is empty, a new windowId will stored into window.name.\nIf the window.name is already set, the windowhandler checks if the\nwindow.name equals the requested windowId. When the windowId is valid, a unique\ntoken (called `dsrid`) will be generated for the current\nrequest and added to the URL. In addition a cookie with with the\ndsrid/dswid will be added. On the server side, the verified windowId\nwill be extracted from the cookie. For POST request detection, the\nwindowId will be added as hidden input to all forms.\n\n===== Advantage\n\n* Covers all edge cases\n\n\n===== Disadvantage\n\n* Having the windowhandler.html site rendered between requests sometimes\nleads to some 'flickering' if the destination page takes some time to\nload. The browser first renders our windowhandler and only after that\nthe original page will get loaded. This effect may be minimized by\nbranding the windowhandler.html page and providing an own one with a\nbgcolor which matches your application. For html-5 aware browsers we\nalso got rid of this flickering by storing away a 'screenshot' of the\nfirst page in onclick() and immediately restore this 'screenshot' on the\nintermediate windowhandler.html page. Technically we do this by storing\naway the HTML DOM tree and css information into the html5 localStorage and restore them on the\nintermediate page. We also introduced a WindowConfig which is able to\nparse a request and decide upon the UserAgent or any other information\nif a client will get an intermediate page or if he gets the result page\ndirectly.\n\n===== Configuration\n\n====== Reduce windowhandler.html flickering\n\nPer default we only overwrite the onclick events of all links on the current page to make a 'screenshot' between requests.\nWe also provide a mechanism to store the 'screenshot' on every button onclick:\n\n[source,java]\n----------------------------------------------------------------------------\n@Specializes\npublic class MyClientWindowConfig extends DefaultClientWindowConfig\n{    \n    @Override\n    public boolean isClientWindowStoreWindowTreeEnabledOnButtonClick()\n    {\n        return true;\n    }\n}\n----------------------------------------------------------------------------\n\n====== Change windowhandler.html\n\nTo customize the look and feel of the windowhandler.html, you can simply\nprovide a own via:\n\n[source,java]\n----------------------------------------------------------------------------\n@Specializes\npublic class MyClientWindowConfig extends DefaultClientWindowConfig\n{\n    @Override\n    public String getClientWindowHtml()\n    {\n        return \"<html><body>Loading...</body></html>\";\n    }\n}\n----------------------------------------------------------------------------\n\nIf you didn't copy the JS logic from our default windowhandler.html or\nif you would like to always show your custom html instead the 'screenshot', you should disable logic via:\n\n[source,java]\n----------------------------------------------------------------------------\n@Specializes\npublic class MyClientWindowConfig extends DefaultClientWindowConfig\n{\n    @Override\n    public boolean isClientWindowStoreWindowTreeEnabledOnLinkClick()\n    {\n        return false;\n    }\n\n    @Override\n    public boolean isClientWindowStoreWindowTreeEnabledOnButtonClick()\n    {\n        return false;\n    }\n}\n----------------------------------------------------------------------------\n\n====== Minimize windowhandler.html streaming\n\nIt's possible to reduce the windowhandler.html streaming if we overwrite the onclick event of all links to mark the next request as 'valid'.\nThe onclick handler appends a request token to the URL and creates a cookie for the request token.\n\nYou can enable this via:\n\n[source,java]\n----------------------------------------------------------------------------\n@Specializes\npublic class MyClientWindowConfig extends DefaultClientWindowConfig\n{\n    @Override\n    public String isClientWindowTokenizedRedirectEnabled()\n    {\n        return true;\n    }\n}\n----------------------------------------------------------------------------\n\n==== LAZY\n\nAlways appends the windowId to all, from JSF generated, URLs. On the\nfirst GET request without a windowId, it will generate a new windowId\nand redirect, with the windowId in the URL, to the same view again. The\ncurrent windowId will be stored in the `window.name` variable on the\nclient side. For all further requests, a lazy check will be performed to\ncheck if the windowId in the URL is matching with the `window.name`. If\nit is not matching, the view will be refreshed with the right windowId in\nthe URL.\n\n\n===== Advantage\n\n* No windowhandler.html / loading screen required\n\n===== Disadvantage\n\n* It could happen that 2 tabs will share the same windowId for 1 request\nbecause the `LAZY` mode will check lazily, after rendering the view, if\nthe windowId matches the `window.name`. Therefore it could happen that\nscopes, which are based on the window handling (@ViewAccessScoped, @WindowScoped and @GroupedConversationScoped),\nwill unintentionally be destroyed.\n\n\n===== Workflow Example\n\nFirst GET request with windowId\n\n* Renders the view\n* Stores the windowId as `window.name` on the client side\n\n\nFirst GET request without windowId\n\n* Redirect to the same view with a new windowId in the URL\n* Renders the view\n* Stores the windowId as `window.name` on the client side\n\n\nFurther GET request with windowId\n\n* Renders the view\n* Checks if the requested windowId matches the `window.name`\n* If it does not match, reload the URL with the right windowId taken\nfrom `window.name`\n\n\nFurther GET request without windowId\n\n* Redirect to the same view with a new windowId in the URL\n* Renders the view\n* If it does not match, reload the URL with the right windowId taken\nfrom `window.name`\n\n\n==== NONE\n\nAny window or browser tab detection will be disabled for the current\nrequest. Scopes like @WindowScoped, @GroupedConversationScoped or\n@ViewAccessScoped will not work. This is also the default mode if the\ncurrent request does not support Javascript or if the user agent is a\nbot/crawler.\n\n\n==== DELEGATED\n\nDelegates the complete window handling to the new JSF 2.2 ClientWindow\n(if not disabled).\n\n\n==== CUSTOM\n\nEnables to use an complete own\n`org.apache.deltaspike.jsf.spi.scope.window.ClientWindow`\nimplementation.\n\n\n=== Configuration\n\n==== ds:windowId\n\nThe component `ds:windowId`\n(`xmlns:ds=\"http://deltaspike.apache.org/jsf\"`) is required to enable\nthe full control of the DeltaSpike window handling. It will import and\nrender the required script parts for both `LAZY` and `CLIENTWINDOW`\nmode. The best way, to apply it for all views, is to add this component\nto all of your templates.\n\n\n==== ds:disableClientWindow\n\nSimiliar to JSF 2.2' `disableClientWindow` attribute,\n`ds:disableClientWindow` provides the ability to disable the rendering\nof the windowId to all links of all child components:\n\n[source,xml]\n----------------------------------------------------------------------------\n<ds:disableClientWindow>\n    <h:link value=\"Link without windowId\" outcome=\"target.xhtml\" />\n</ds:disableClientWindow>\n<h:link value=\"Link with windowId\" outcome=\"target.xhtml\"/>\n----------------------------------------------------------------------------\n\n==== Number of Active Windows\n\nBy default, DeltaSpike allows `1024` active windows per session. Anyway, this number is reduced inside this JSF module to `64` for JSF applications. Once that the limit number of active windows is reached, DeltaSpike will drop the oldest active window.\n\nYou can change the default value by setting the property `deltaspike.scope.window.max-count` using  <<configuration.adoc#_configsources_provided_by_default, DeltaSpike configuration mechanism>>.\n\nYou can also provide this value via:\n\n[source,java]\n-----------------------------------------------------------------------------------\n@Specializes\npublic class MyClientWindowConfig extends DefaultClientWindowConfig\n{\n\n    @Override\n    public int getMaxWindowContextCount()\n    {\n        // return the max active windows per session\n    }\n}\n-----------------------------------------------------------------------------------\n\n==== Switch Mode\n\nTo switch the mode, just provide a\n`org.apache.deltaspike.jsf.api.config.JsfModuleConfig` and overwrite\n`#getDefaultWindowMode`:\n\n[source,java]\n---------------------------------------------------------------------------\n@Specializes\npublic class MyJsfModuleConfig extends JsfModuleConfig\n{\n    @Override\n    public ClientWindowConfig.ClientWindowRenderMode getDefaultWindowMode()\n    {\n        //...\n    }\n}\n---------------------------------------------------------------------------\n\n\n==== Provide a Custom ClientWindow\n\nIf you would like to provide an custom\n`org.apache.deltaspike.jsf.spi.scope.window.ClientWindow`\nimplementation, you can just do it, for example, via CDI alternatives:\n\n[source,java]\n---------------------------------------------------\n@ApplicationScoped\npublic class MyClientWindow implements ClientWindow\n{\n    //...\n}\n---------------------------------------------------\n\nDo not forget to set the `ClientWindowRenderMode` to 'CUSTOM' via the\n`JsfModuleConfig`:\n\n[source,java]\n---------------------------------------------------------------------------\n@Specializes\npublic class MyJsfModuleConfig extends JsfModuleConfig\n{\n    @Override\n    public ClientWindowConfig.ClientWindowRenderMode getDefaultWindowMode()\n    {\n        return ClientWindowConfig.ClientWindowRenderMode.CUSTOM;\n    }\n}\n---------------------------------------------------------------------------\n\n=== Based Scopes\n\n* @WindowScoped\n* @ViewAccessScoped\n* @GroupedConversationScoped\n\n\n== Scopes\n\n=== @WindowScoped\n\nThe window-scope is like a session per window. That means that the data\nis bound to a window/tab and it not shared between windows (like the\nsession scope does). Usually you need the window-scope instead of the\nsession-scope. There areis not a lot of use-cases which need shared data\nbetween windows.\n\n[source,java]\n----------------------------------------------------\n@WindowScoped\npublic class PreferencesBean implements Serializable\n{\n    //...\n}\n----------------------------------------------------\n\n\n=== @ViewAccessScoped\n\nIn case of conversations you have to un-scope beans manually (or they\nwill be terminated automatically after a timeout). However, sometimes\nyou need beans with a lifetime which is as long as needed and as short\nas possible - which are terminated automatically (as soon as possible).\nIn such an use-case you can use this scope. The simple rule is, as long\nas the bean is referenced by a page - the bean will be available for the\nnext page (if it is used again the bean will be forwarded again). It is\nimportant that it is based on the view-id of a page (it is not based on\nthe request) so, for example, Ajax requests do not trigger a cleanup if the\nrequest does not access all view-access scoped beans of the page. That's\nalso the reason for the name @__View__AccessScoped.\n\n[source,java]\n-----------------------------------------------\n@ViewAccessScoped\npublic class WizardBean implements Serializable\n{\n    //...\n}\n-----------------------------------------------\n\nTIP: @ViewAccessScoped beans are best used in conjunction with the\n`CLIENTWINDOW` window handling, which ensures a clean browser-tab\nseparation without touching the old windowId. Otherwise a 'open in new\ntab' on a page with a @ViewAccessScoped bean might cause the termination\n(and re-initialization) of that bean.\n\n=== @GroupedConversationScoped\n\nSee (Grouped-)Conversations\n\n=== @ViewScoped\n\nDeltaSpike provides an CDI context for the JSF 2.0/2.1\n@javax.faces.bean.ViewScoped. You can simply annotate your bean with\n@javax.faces.bean.ViewScoped and @Named.\n\n=== JSF 2.0 Scopes\n\nJSF 2.0 introduced new annotations as well as a new scope - the View\nScope. DeltaSpike allows to use all the CDI mechanisms in beans annotated\nwith:\n\n* javax.faces.bean.ApplicationScoped\n* javax.faces.bean.SessionScoped\n* javax.faces.bean.RequestScoped\n* javax.faces.bean.ViewScoped\n\nFurthermore, the managed-bean annotation (javax.faces.bean.ManagedBean)\nis mapped to @Named from CDI.\n\nAll these annotations are mapped automatically. So you will not face\nissues, if you import a JSF 2 annotation instead of the corresponding\nCDI annotation.\n\n== Integration with DeltaSpike Type-safe Messages\n\nYou can use <<core.adoc#_messages_i18n,DeltaSpike type-safe messages>>\nwith JSF to provide i18n messages and test to an JSF appplicaton.\n\nJSF module is also capable to use messages provided through in\nfaces-config.xml file. The element allows you to override JSF default\nmessages (Section 2.5.2.4 of the JSF specification contains the list of\nall JSF default messages that could be override.).\n\nDeltaSpike can also reuse the same file to provide type-safe messages so\nyou do not have to use the naming convention nor `@MessageContextConfig`.\nIf there is a config for supported locales it will be checked as well\nand fallback to the configured default locale.\n\n.Example\n[source,java]\n------------------------------------------------------------------------------------------------------------\n@MessageBundle\npublic interface SimpleMessage\n{\n    @MessageTemplate(\"{welcome_to_deltaspike}\")\n    String welcomeToDeltaSpike();\n}\n\n@Model\npublic class PageBean\n{\n\n    @Inject\n    private SimpleMessage messages;\n\n    public void actionMethod(){\n        FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(messages.welcomeToDeltaSpike()));\n    }\n\n}\n\n\norg.apache.deltaspike.example.message.SimpleMessage\n\n->\n\norg/apache/deltaspike/example/message/SimpleMessage.properties\norg/apache/deltaspike/example/message/SimpleMessage.properties\norg/apache/deltaspike/example/message/SimpleMessage_en.properties\norg/apache/deltaspike/example/message/SimpleMessage_de.properties\n\n...\n\n//content (as usual in message bundle files):\nwelcome_to_deltaspike=Welcome to DeltaSpike\n//Overrided JSF messages\njavax.faces.component.UIInput.REQUIRED = {0}: Please enter a value\n------------------------------------------------------------------------------------------------------------\n\n.Faces-config.xml File\n[source,xml]\n--------------------------------------------------------------------------------------------\n<faces-config>\n    <application>\n        <message-bundle>org.apache.deltaspike.example.message.SimpleMessage</message-bundle>\n    </application>\n</faces-config>\n--------------------------------------------------------------------------------------------\n\n== Type-safe View-Configs\n\n=== Intro\n\nType-safe view-configs are static configs which can be used in\ncombination with every view-technology which is based on Java. Currently\nDeltaSpike itself provides an integration for JSF, however, the basic\nconcepts are independent of it. (Since DeltaSpike provides the default\nintegration only for JSF, the whole documentation for view-configs is\nlocated here.)\n\nThanks to features like multiple (meta-data-)inheritance via interfaces,\nit provides a powerful approach to bind meta-data to one or multiple\nviews. In case of the JSF integration it is possible to provide, for example,\ntype-safe meta-data for security, navigation, callbacks for\nview-controllers. Beyond configuring view (/pages) via this concept,\nit is also possible to use the (view-)config classes for type-safe\nnavigation. Since it is standard Java, you can benefit from any Java-IDE and\nyou do not need special IDE-Addons to use it efficiently.\n\nEven the concepts provided by modules (of DeltaSpike itself) are based\non the basic API provided by the Core. So it is possible to introduce\ncustom concepts the same way DeltaSpike itself does.\n\n=== Motivation\n\nInstead of learning the concepts and rules of view-configs provided by\nDeltaSpike, it might be easier for simple demos to just type some\nsimple(r) strings. So why should you use something which is slightly\nmore work **initially**?\n\n*The short answer is:* It gives a good return in case of real applications (especially beyond simple demos).\n\n*The long answer is:* You can benefit from it from the first second:\n\n* It is type-safe\n** the Java compiler ensures that you do not have typos at the final usages (and the rest can be checked during bootstrapping of the application)\n** you can benefit from the auto.complete features of any modern Java IDE.\n* If you change the name of a file/folder, you need only one (easy) code-change in a single place and your (standard Java-) IDE will do the rest for you (= update all usages) without a special plug-in\n* It is possible to restrict the navigation target -> you can ensure that the navigation target is still the intended one (e.g. after a refactoring)\n* You can configure meta-data in a central place (which can get inherited via *multiple* inheritance based on Java interfaces)\n* Easier for developers to find usages\n* Allows easy(er) refactorings and maintenance\n* You can use your IDE more efficiently especially in large projects (there are some users who initially switched to it, because their tools for displaying the config they had before open large config files very slowly...)\n* Modern Java IDEs show inheritance of interfaces and classes in a nice way. Since the view-config is based on standard classes and interfaces, you can benefit from it easily.\n\nAdvantages which are planned for later (= currently not supported):\n\n* It is possible to check if the configured folders and files really exist during/after the bootstrapping phase of the application (currently it is not implemented, but it is possible to do it).\n* It is also easy(er) for tools (IDE plugins,...) to validate it\n* It is possible to validate the config (if the corresponding path (view or folder) really exists (after v0.5 it is done out-of-the-box)\n\nIf you are still not convinced, you just have to try it. You will see how your daily workflow benefits from it pretty soon.\n\n=== Bean-discovery-mode Annotated\n\nCDI 1.1 introduced a concept called bean-discovery-mode. If you would\nlike to use the mode `annotated`, please have a look at the tip at\n@ViewConfigRoot\n\n=== Basic API Usages\n\nWhile reading this section keep the following simple rules in mind:\nMeta-data gets inherited along the path of Java inheritance\nFile-/Folder- paths are build based on nesting classes and interfaces\nUsually users do not need to be aware of all descriptors, SPIs,... which\nare described by this documentation.\n\nThere are a lot of possibilities to configure views and some of them are\noptional. The following examples show some of them in combination with\nfeatures provided by the JSF- and Security-Module of DeltaSpike.\n\nThe following example shows the minimal syntax for providing a config\nfor a view (/page).\n\n[source,java]\n-----------------------------------------\npublic class MyPage implements ViewConfig\n{\n}\n-----------------------------------------\n\nSince it is a class (and not an interface), it is automatically recognized as\nconfig for a page (and not a folder) and the default settings get\napplied during bootstrapping. In case of JSF you can use it for\nnavigation, for example, via action-methods.\n\n[source,java]\n-----------------------------------------------\npublic Class<? extends ViewConfig> toNextPage()\n{\n    return MyPage.class;\n}\n-----------------------------------------------\n\nThis leads to a forward to `/myPage.xhtml`. Information like base-path,\nfile- (and folder-)name/s, file-extension, navigation mode,\nview-params,... can be customized with the corresponding\n(meta-data-)annotations. One of those annotations provided by the JSF\nmodule (which is optional) is `@View`. That means the following example\nleads to the same as the first one.\n\n[source,java]\n-----------------------------------------\n@View //optional\npublic class MyPage implements ViewConfig\n{\n}\n-----------------------------------------\n\nBut it is also possible to reflect the folder structure via nesting of\ninterfaces and classes. An example for it is:\n\n[source,java]\n------------------------------------------\npublic interface Pages\n{\n    class Index implements ViewConfig { }\n\n    interface AdminArea extends ViewConfig\n    {\n        class Index implements Admin { }\n    }\n}\n------------------------------------------\n\nIn case of the JSF integration it leads to the following view-ids:\n/pages/index.xhtml /pages/adminArea/index.xhtml\n\nLike the optional `@View` for pages represented by the classes, it is\npossible to use the optional `@Folder` annotation for directories\nrepresented by the (nested) interfaces.\n\nFurthermore, it is possible to inherit meta-data along with the normal\ninheritance.\n\nIn the following example `Pages.Admin.Index`, `Pages.Admin.Home` and\n`Pages.Admin.Statistics.Home` inherit the meta-data from `Pages.Admin`\nbecause they implement the interface whereas\n`Pages.Admin.Statistics.Index` does not. However, `Pages.Admin.Home`\noverrides `View#navigation`. During the bootstrapping process the\nmeta-data gets merged and at runtime you only see the final result\n(which is cached).\n\n[source,java]\n------------------------------------------------------\npublic interface Pages\n{\n    @View(name = \"home\", extension = JSP)\n    class Index implements ViewConfig { }\n\n    @View(navigation = REDIRECT, viewParams = INCLUDE)\n    interface Admin extends ViewConfig\n    {\n        interface Statistics\n        {\n            @View //optional\n            class Index implements ViewConfig { }\n\n            class Home implements Admin { }\n        }\n\n        class Index implements Admin { }\n\n        @View(navigation = FORWARD)\n        class Home implements Admin { }\n    }\n}\n------------------------------------------------------\n\nIn this case `Pages.Admin.Statistics` is just an interface to reflect\nthe folder structure. For sure it is also possible that it extends an\nexisting view-config interface and other folders and/or pages inherit\nits meta-data (like `Pages.Admin`).\n\nFurthermore, inheritance can be used to ensure navigation to the correct\narea in the application. In the following example the return type of the\naction-method (and therefore the compiler of Java) ensures that the\nnavigation target of this method is within the admin-area.\n\n[source,java]\n------------------------------------------------\npublic Class<? extends Pages.Admin> toNextPage()\n{\n    return Pages.Admin.Index.class;\n}\n------------------------------------------------\n\n==== File (@View) and Folder (@Folder) Paths\n\n`@View` as well as `@Folder` are optional annotations. `@Folder` is only\nneeded for using a different folder-name or for marking folder configs\nif they do not inherit from\n`org.apache.deltaspike.core.api.config.view.ViewConfig` *nor* have a\nview-config for a page nested into them (like Pages.Wizard1.Step1). If\nit is not used explicitly, it gets added automatically (so you can query\nthe meta-data at runtime even in cases you haveis not placed the\nannotations explicitly). `@View` allows to customize a bit more and it\nalso gets added automatically if it is not used explicitly. Whereas\n`@Folder` gets added to all nested interfaces (above a view-config class\n- like Pages and Pages.Wizard1), `@View` only gets added to classes\nwhich in-/directly inherit from\n`org.apache.deltaspike.core.api.config.view.ViewConfig` (like\nPages.Wizard1.Step1).\n\nThat means at runtime the following two configs lead to the same.\n\n[source,java]\n---------------------------------------------\npublic interface Pages\n{\n    interface Wizard1\n    {\n        class Step1 implements ViewConfig { }\n    }\n}\n\n//leads to the same as\n\n@Folder\npublic interface Pages\n{\n    @Folder\n    interface Wizard1\n    {\n        @View\n        class Step1 implements ViewConfig { }\n    }\n}\n---------------------------------------------\n\nThe example above leads to the following paths:\n\n* /pages/\n* /pages/wizard1\n* /pages/wizard1/step1.xhtml\n\nTo customize it you can use `@Folder#name`, `@View#basePath`,\n`@View#name` and `@View#extension` (or you register custom\n`NameBuilder`s inline or globally).\n\n===== @Folder#name\n\nThe rules are pretty simple. You will get what you write. There are only\ntwo additional features:\n\n* You do not have to care about duplicated '/' (e.g. /folder1//folder2/step1.xhtml would get corrected auto. to /folder1/folder2/step1.xhtml)\n* With \".\" at the beginning (e.g. \"./\") you can keep the path before.\n\nThe following example\n\n[source,java]\n---------------------------------------------------------------------------------\ninterface Pages\n{\n    @Folder(name = \"/w1/\")\n    interface Wizard1\n    {\n        class Step1 implements ViewConfig { }\n    }\n\n    @Folder(name = \"./w2/\")\n    interface Wizard2 extends ViewConfig\n    {\n        class Step1 implements Wizard2 { }   //ViewConfig is inherited indirectly\n    }\n}\n---------------------------------------------------------------------------------\n\nleads to the following paths:\n\n* /pages/\n* /w1/\n* /w1/step1.xhtml\n* /pages/w2/step1.xhtml\n\n===== @View\n\nThe same naming rules apply to `@View#basePath`. However, it is only\nvalid to be used at view-config nodes which represent pages (-> classes\nand not interfaces). On interfaces always use `@Folder`\n(`@View#basePath` will get ignored there).\n\n[source,java]\n---------------------------------------------\ninterface Pages\n{\n    interface Wizard1\n    {\n        @View //optional\n        class Step1 implements ViewConfig { }\n\n        @View(basePath = \"/\")\n        class Step2 implements ViewConfig { }\n\n        @View(basePath = \"./\") //or just \".\"\n        class Step3 implements ViewConfig { }\n\n        @View(basePath = \"/w1/\")\n        class Step4 implements ViewConfig { }\n\n        @View(basePath = \"./w1/\")\n        class Step5 implements ViewConfig { }\n    }\n}\n---------------------------------------------\n\nleads to the following paths:\n\n* /pages\n* /pages/wizard1/\n* /pages/wizard1/step1.xhtml\n* /step2.xhtml\n* /pages/wizard1/step3.xhtml\n* /w1/step4.xhtml\n* /pages/wizard/w1/step5.xhtml\n\nand depending on additional meta-data you would like to inherit (e.g.\n`@View(navigation = REDIRECT)`), you can also use:\n\n[source,java]\n------------------------------------------\n@View(navigation = REDIRECT)\ninterface Pages extends ViewConfig\n{\n    interface Wizard1 extends Pages\n    {\n        @View\n        class Step1 implements Wizard1 { }\n\n        @View(basePath = \"/\")\n        class Step2 implements Wizard1 { }\n\n        @View(basePath = \"./\")\n        class Step3 implements Wizard1 { }\n\n        @View(basePath = \"/w1/\")\n        class Step4 implements Wizard1 { }\n\n        @View(basePath = \"./w1/\")\n        class Step5 implements Wizard1 { }\n    }\n}\n------------------------------------------\n\nIt leads to the same paths, but in addition `@View#navigation` gets\ninherited along the inheritance path.\n\n==== Navigation Parameters\n\nSince the view-config is static, an approach to add parameters is\nneeded. The following part shows different possibilities to add\nparameters which end up in the final URL after '?' (in case of the\nintegration with JSF). It is not needed to add all (types of) parameters\nthat way. Some get added automatically based on special meta-data (e.g.\n`@View#navigation` and `@View#viewParams`). Instead of adding\n`\"faces-redirect=true\"` manually it is done for you as soon as you are\nusing `@View(navigation = REDIRECT)`. The same goes for\n`\"includeViewParams=true\"` and `@View(viewParams = INCLUDE)`.\n\n==== Static Configuration via @NavigationParameter\n\nIn some cases, it is needed to add an information in any case. So you can\nannotate the view-config class with `@NavigationParameter`. Supported\nvalues are static strings or EL-expressions.\n\n[source,java]\n---------------------------------------------------------------------------\npublic interface Pages extends ViewConfig\n{\n    @NavigationParameter(key = \"param1\", value = \"staticValue1\")\n    class Index implements Pages { }\n\n    @NavigationParameter.List({\n        @NavigationParameter(key = \"param1\", value = \"staticValue1\"),\n        @NavigationParameter(key = \"param2\", value = \"#{myBean.property1}\")\n    })\n    class Overview implements Pages { }\n}\n---------------------------------------------------------------------------\n\nInstead of using parameters in any case, it is also possible to configure\nthem statically for particular methods:\n\n[source,java]\n-----------------------------------------------------------------------\n@Model\npublic class PageBean\n{\n    @NavigationParameter(key = \"param2\", value = \"#{myBean.property1}\")\n    public Class<? extends ViewConfig> actionMethod1()\n    {\n        return SimplePageConfig.class;\n    }\n\n    @NavigationParameter.List({\n        @NavigationParameter(key = \"param1\", value = \"staticValue1\"),\n        @NavigationParameter(key = \"param2\", value = \"staticValue2\")\n    })\n    public Class<? extends ViewConfig> actionMethod2()\n    {\n        return SimplePageConfig.class;\n    }\n}\n-----------------------------------------------------------------------\n\n===== Dynamic Configuration via NavigationParameterContext\n\nInstead of using parameters in a static fashion (as shown above), it is\nalso possible to add them dynamically (e.g. in case of special\nconditions).\n\n[source,java]\n--------------------------------------------------------------------------------------\n@Named\n@SessionScoped\npublic class PageBean\n{\n    private int currentValue = -10;\n\n    @Inject\n    private NavigationParameterContext navigationParameterContext;\n\n    public Class<? extends ViewConfig> actionMethod()\n    {\n        currentValue++;\n\n        if (currentValue >= 0)\n        {\n            this.navigationParameterContext.addPageParameter(\"cv\", this.currentValue);\n        }\n        return SimplePageConfig.class;\n    }\n}\n--------------------------------------------------------------------------------------\n\n==== Security Integration via @Secured\n\nThis annotation is a custom view-meta-data provided by the\nSecurity-module which allows to integrate third-party frameworks (or\ncustom approaches) to secure pages as well as whole folders. You can\nannotate specific parts or a marker-interface.\n`CustomAccessDecisionVoter` used in the following example can be any\nimplementation of\n`org.apache.deltaspike.security.api.authorization.AccessDecisionVoter`\nand needs to be a standard CDI bean which means you can use\ndependecy-injection to trigger any kind of security check. All parts\nwhich inherit from `SecuredPages` (`Pages.Admin`, `Pages.Admin.Index`\nand `Pages.Admin.Home`) are protected by `CustomAccessDecisionVoter`.\n\n(It is easy to check this hierarchy in a modern Java-IDE. Only for\ndisplaying the final meta-data for every node in the IDE a special\nplug-in would be needed.)\n\n[source,java]\n-----------------------------------------------\n@Secured(CustomAccessDecisionVoter.class)\npublic interface SecuredPages {}\n\n@View(navigation = REDIRECT)\npublic interface Pages extends ViewConfig\n{\n    class Index implements Pages { }\n\n    interface Admin extends Pages, SecuredPages\n    {\n        class Index implements Admin { }\n\n        @View(navigation = FORWARD)\n        class Home implements Admin { }\n    }\n}\n-----------------------------------------------\n\nFor sure it is also possible to use it without a special interface. In\nthis case you would need:\n\n[source,java]\n---------------------------------------------\n@View(navigation = REDIRECT)\npublic interface Pages extends ViewConfig\n{\n    class Index implements Pages { }\n\n    @Secured(CustomAccessDecisionVoter.class)\n    interface Admin extends Pages\n    {\n        class Index implements Admin { }\n\n        @View(navigation = FORWARD)\n        class Home implements Admin { }\n    }\n}\n---------------------------------------------\n\nor:\n\n[source,java]\n-------------------------------------------------\n@View(navigation = REDIRECT)\npublic interface Pages extends ViewConfig\n{\n    class Index implements Pages { }\n\n    interface Admin extends Pages\n    {\n        @Secured(CustomAccessDecisionVoter.class)\n        class Index implements Admin { }\n\n        @Secured(CustomAccessDecisionVoter.class)\n        @View(navigation = FORWARD)\n        class Home implements Admin { }\n    }\n}\n-------------------------------------------------\n\n\n==== View-Controller Callbacks via @ViewControllerRef\n\nThis annotation is a custom view-meta-data provided by the JSF-module\nwhich allows to configure beans which should act as view-controllers.\nThat means they can use view-controller callbacks like `@InitView`,\n`@PreViewAction`, `@PreRenderView` and `@PostRenderView`. The following\nexample shows the usage of `@PreRenderView`.\n\n[source,java]\n------------------------------------------\n//@View //optional\n@ViewControllerRef(MyPageController.class)\npublic class MyPage implements ViewConfig\n{\n}\n\n@Model\npublic class MyPageController\n{\n    @PreRenderView\n    protected void load()\n    {\n        //...\n    }\n}\n------------------------------------------\n\nFrom DeltaSpike 0.7, it is possible to observe exceptions thrown by a\n@PreRenderView callback and use your configured Default-Error-View to\ndisplay the exception.\n\n.Example\n[source,java]\n--------------------------------------------------------------------------------------------------------------\n@ExceptionHandler\npublic class ErrorViewAwareExceptionHandler {\n    @Inject\n    private ViewConfigResolver viewConfigResolver;\n\n    public void onIllegalStateException(@Handles ExceptionEvent<IllegalStateException> e)\n    {\n        FacesContext facesContext = FacesContext.getCurrentInstance();\n\n        String viewId = viewConfigResolver.getDefaultErrorViewConfigDescriptor().getViewId();\n        UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);\n        facesContext.setViewRoot(viewRoot);\n        //... - e.g.: store the exception in a page-bean for the default-error-view\n    }\n}\n--------------------------------------------------------------------------------------------------------------\n\n==== Referencing Views via @ViewRef\n\nWith `@ViewControllerRef#value` you can annotate a view-config class to\nbind (/reference) a controller to it. `@ViewRef#config` allows the same\nin the other direction. Use an existing view-config to reference one or\nmany view/s.\n\n.Example\n[source,java]\n----------------------------------------------------\npublic interface Pages extends ViewConfig\n{\n    class Index implements Pages { }\n}\n\n@ViewRef(Pages.Index.class)\n//...\npublic class IndexController implements Serializable\n{\n    @PreRenderView\n    protected void preRenderView()\n    {\n        //...\n    }\n\n    //...\n}\n----------------------------------------------------\n\nThe above example leads to the invocation of the pre-render-view logic before\n/pages/page1.xhtml gets rendered (and it will not be called for other\npages).\n\n==== Using the (Optional) ViewNavigationHandler\n\nWith JSF you typically navigate with the action-method bound to a\ncommand-component. However, also JSF supports manual navigation via\n`javax.faces.application.NavigationHandler`. With\n`ViewNavigationHandler` DeltaSpike provides an equivalent optimized for\ntype-safe view-configs which is easier to use (and can be used also for\nother (supported) view technology).\n\n.Simple Example\n[source,java]\n-----------------------------------------------------------------\npublic interface Pages {\n    class Index implements ViewConfig { }\n}\n\n@Model\npublic class AnyController\n{\n    @Inject\n    private ViewNavigationHandler viewNavigationHandler;\n\n    public void anyMethod()\n    {\n        //navigates to /pages/index.xhtml\n        this.viewNavigationHandler.navigateTo(Pages.Index.class);\n    }\n}\n-----------------------------------------------------------------\n\nAlso in this case (optional) meta-data will be used for the navigation\nprocess, since `ViewNavigationHandler` just delegates to the active\nnavigation-handler (of JSF).\n\n==== Configuring a Default Error-View\n\nIt is possible to mark one view-config class as default error-view. That\nmeans in case of errors it will be used as navigation target\nautomatically. Furthermore, it is also possible to use it in your code\ninstead of hardcoding your error-view across the whole application.\n\nIn case of\n\n[source,java]\n------------------------------------------------------\npublic interface Pages {\n    class Index implements ViewConfig { }\n\n    class CustomErrorPage extends DefaultErrorView { }\n}\n------------------------------------------------------\n\nit is possible to navigate with `DefaultErrorView.class` instead of\nhardcoding it to `Pages.CustomErrorPage.class`.\n\n[source,java]\n-------------------------------------------------------------------------\n@Model\npublic class PageController\n{\n    public Class<? extends ViewConfig> actionWithoutError()\n    {\n        return Pages.Index.class;\n    }\n\n    public Class<? extends ViewConfig> actionWithError()\n    {\n        //navigates to the view which is configured as default error-view\n        return DefaultErrorView.class;\n    }\n}\n-------------------------------------------------------------------------\n\nIf you are outside of an action-method you can also use it in\ncombination with `ViewNavigationHandler`.\n\n[source,java]\n-------------------------------------------------------------------------\n@Model\npublic class AnyController\n{\n    @Inject\n    private ViewNavigationHandler viewNavigationHandler;\n\n    public void anyMethod()\n    {\n        //navigates to the view which is configured as default error-view\n        this.viewNavigationHandler.navigateTo(DefaultErrorView.class);\n    }\n}\n-------------------------------------------------------------------------\n\nHowever, in case of JSF you have to ensure that you are at a valid point\nin the JSF request-lifecycle for a navigation, because invocation gets\ntransformed to a standard (implicit) JSF navigation.\n\n==== Using ViewConfigResolver\n\nIf you would like to query view-meta-data yourself (for whatever\nreason), you can do that with `ViewConfigResolver`.\n\n[source,java]\n----------------------------------------------------------------------------------------------------------------------------------------\n@RequestScoped\npublic class ApiDemoBean\n{\n    @Inject\n    private ViewConfigResolver viewConfigResolver;\n\n    public String getViewId(Class<? extends ViewConfig> viewConfigClass)\n    {\n        return viewConfigResolver.getViewConfigDescriptor(viewConfigClass).getViewId(); //or #getPath\n    }\n\n    public String getPath(Class pathConfigClass)\n    {\n        return viewConfigResolver.getConfigDescriptor(pathConfigClass).getPath();\n    }\n\n    public List<ConfigDescriptor<?>> getAllFolderDescriptors()\n    {\n        return viewConfigResolver.getConfigDescriptors();\n    }\n\n    public List<ViewConfigDescriptor> getAllPageDescriptors()\n    {\n        return viewConfigResolver.getViewConfigDescriptors();\n    }\n\n    public ViewConfigDescriptor getCurrentViewConfig()\n    {\n        return viewConfigResolver.getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId());\n    }\n\n    public Class<? extends ViewConfig> getCurrentViewConfigClass()\n    {\n        return viewConfigResolver.getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId()).getConfigClass();\n    }\n    //...\n}\n----------------------------------------------------------------------------------------------------------------------------------------\n\nFor folders it is optional to implement the `ViewConfig` interface,\ntherefore you see 2 different types of API. `#getConfigDescriptor` as\nthe general API and `#getViewConfigDescriptor` which is specific for\npages (which have to implement the `ViewConfig` interface).\n\n*Besides* translating a config class to the final path of the folder or\npage, it is possible to get the implicitly as well as explicitly\nconfigured (view-)meta-data and get and/or execute configured callbacks.\n\n=== Advanced API Usages\n\n==== Creating Custom Meta-Data via @ViewMetaData\n\nThis meta-annotation allows to create custom view-meta-data which can be\nused for view-configs. By default meta-data of a lower level overrides\nmeta-data on a higher level which has the same type. That can be\ncustomized via annotating the final annotation as a whole via\n`@Aggregated(true)`.\n\n[source,java]\n-------------------\n@ViewMetaData\n@interface InfoPage\n{\n}\n-------------------\n\nBy just using `@InfoPage` in view-configs, it can be queried via:\n\n[source,java]\n----------------------------------------------------------------------------------------------------------\n@Inject\nprivate ViewConfigResolver viewConfigResolver;\n//...\n\nViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);\nList<InfoPage> metaDataList = viewConfigDescriptor.getMetaData(InfoPage.class)\n----------------------------------------------------------------------------------------------------------\n\n==== Creating Custom Meta-Data via @Stereotype\n\nLike with CDI itself you can encapsulate multiple view meta-data\nannotation in one annotation.\n\n.Example\n[source,java]\n-------------------------------------------------------------\n@Target({TYPE})\n@Retention(RUNTIME)\n\n@Stereotype\n@Secured(CustomAccessDecisionVoter.class) //view meta-data #1\n@View(navigation = REDIRECT) //view meta-data #2\n@interface MySecuredView {}\n-------------------------------------------------------------\n\nInstead of using the same combination of annotations in multiple places,\nyou can use the stereotype annotation. If you query the meta-data at\nruntime (see `ViewConfigDescriptor#getMetaData`), you can access\n`@Secured` as well as `@View` (in the example above). however, you will not\nsee `@MySecuredView` itself at runtime, because stereotype annotations\nare by default transparent.\n\nFrom DeltaSpike 1.0.1, it is possible to access such stereotype annotations as\nwell, once you annotate them with `@ViewMetaData`.\n\n\n==== Creating Custom Callbacks via @ViewMetaData\n\nVia a custom ConfigPreProcessor it is possible to register custom\ncallbacks dynamically. The following listing shows a view-config which\nadds a simple callback including the corresponding `ConfigPreProcessor`\nand `ExecutableCallbackDescriptor`.\n\n[source,java]\n----------------------------------------------------------------------------------------------------------\n@ViewMetaData(preProcessor = MySecured.AnnotationPreProcessor.class)\npublic @interface MySecured\n{\n    Class<? extends TestAccessDecisionVoter>[] value();\n\n    class AnnotationPreProcessor implements ConfigPreProcessor<MySecured>\n    {\n        @Override\n        public MySecured beforeAddToConfig(MySecured metaData, ViewConfigNode viewConfigNode)\n        {\n            List<CallbackDescriptor> descriptors = viewConfigNode.getCallbackDescriptors(MySecured.class);\n            descriptors.add(new Descriptor(metaData.value(), DefaultCallback.class));\n            return metaData;\n        }\n    }\n\n    static class Descriptor extends ExecutableCallbackDescriptor<Set<String>>\n    {\n        public Descriptor(Class[] beanClasses, Class<? extends Annotation> callbackMarker)\n        {\n            super(beanClasses, callbackMarker);\n        }\n\n        public List<Set<String>> execute(String param1, String param2)\n        {\n            return super.execute(param1, param2);\n        }\n    }\n}\n----------------------------------------------------------------------------------------------------------\n\nBy just using `@MySecured` in view-configs, it can be queried and\nexecuted via:\n\n[source,java]\n------------------------------------------------------------------------------------------------------------------\n@Inject\nprivate ViewConfigResolver viewConfigResolver;\n//...\nViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Secured.Index.class);\n\nList<Set<String> /*return type of one callback*/> callbackResult =\n    viewConfigDescriptor.getExecutableCallbackDescriptor(MySecured.class, MySecured.Descriptor.class)\n        .execute(\"param1\", \"param2\");\n------------------------------------------------------------------------------------------------------------------\n\nIt is also possible do register different callback-types per\nview-meta-data. An example can be found at `ViewControllerRef` which\nregisters different callback-types for `InitView`, `PreViewAction`,\n`PreRenderView` and `PostRenderView`. In this case it is needed to use\nthe type of the callback (= class of the annotation) as additional\nparameter for `#getExecutableCallbackDescriptor`.\n\n\n==== Creating Custom inline Meta-Data via @InlineViewMetaData\n\nThis annotation can be used for view-meta-data which can be placed on\nother classes than view-config-classes. It is used, for example, for `@ViewRef`.\nVia a `TargetViewConfigProvider` it is possible to point to the\nview-config the meta-data should get applied to and via\n`InlineMetaDataTransformer` it is possible to convert it to a different\nmeta-data-representation (which allows that at runtime you only have to\nsupport one side since the inline-meta-data was converted to the same\nmeta-data representation which is used for the normal view-meta-data).\n\n\n=== Path-Validation\n\nDeltaSpike (after v0.5) validates your configs out-of-the-box. The\napplication will fail to start, if there is an invalid config (e.g. a\nview-config without a corresponding view). Right now the validation is\nrestricted to folders and view-ids with .xhtml or .jsp as suffix. Other\nview-ids (e.g. *.faces) do not get checked. In such cases a custom\nvalidator can be used (e.g. based on `ViewConfigPathValidator`).\n\nTo disable the view-config (path) validation, add a `ClassDeactivator`\nwhich restricts\n`org.apache.deltaspike.jsf.impl.config.view.ViewConfigPathValidator`.\n\n=== View-Config SPI\n\n==== ConfigDescriptorValidator\n\nAllows to validate the final view-config descriptors before they get\ndeployed. Since the config-descriptor contains, for example, the final path, it is\nalso possible to validate if the corresponding file exists. Use\n`@ViewConfigRoot` to configure 1-n validators.\n\n==== ConfigNodeConverter\n\nAllows to provide custom strategies to process the nodes of the built\nconfig-tree. Use `@ViewConfigRoot` to configure a custom converter.\n\n==== ConfigPreProcessor\n\nAllows to change the found meta-data (e.g. replace default values,\ncallbacks,...) or the `ViewConfigNode` itself.\n\n==== InlineMetaDataTransformer\n\nAllows to transform an annotation annotated with `@InlineViewMetaData`\nto an annotation annotated with `@ViewMetaData`. This transformer is\noptional and only needed if it should result in the same at runtime, but\nthe inline-meta-data needs a different syntax via a different annotation\n(compared to the view-config meta-data). See for example `@ViewRef` vs.\n`@ViewControllerRef`.\n\n==== TargetViewConfigProvider\n\nAllows to provide a custom reference to `ViewConfig` classes (see for example\n`@InlineViewMetaData` and `@ViewRef`)\n\n==== ViewConfigInheritanceStrategy\n\nAllows to customize the inheritance-strategy for meta-data. For example,\ninheritance via standard java inheritance vs. inheritance via nested\ninterfaces. Use `@ViewConfigRoot` to configure a custom\ninheritance-strategy.\n\n==== ViewConfigNode\n\nNode-type used for building the meta-data-tree during the bootstrapping\nprocess.\n\n==== @ViewConfigRoot\n\nOptional annotation which allows to provide custom implementations. Only\nannotate one `ViewConfig` class which represents the root node.\n\nIf you are using CDI 1.1+ with bean-discovery-mode `annotated`, you can\nuse `@ViewConfigRoot` in combination with `@ApplicationScoped` as marker\nannotations. From DeltaSpike 1.0.1, this combination allows to add all\nnested interfaces and classes and therefore no additional annotations\n(required by bean-discovery-mode `annotated`) are needed. Minimal\nexample:\n\n[source,java]\n-----------------------------------------\n@ApplicationScoped\n@ViewConfigRoot\npublic interface Pages extends ViewConfig\n{\n    class Index implements Pages { }\n}\n-----------------------------------------\n\n=== Activation of Custom Naming Conventions\n\nDeltaSpike allows to customize the default naming convention via\n`View.DefaultBasePathBuilder` and/or `View.DefaultFileNameBuilder`\nand/or `View.DefaultExtensionBuilder`. It is possible to change it for\none usage via `View.basePathBuilder` and/or `View.fileNameBuilder`\nand/or `View.extensionBuilder` or globally via the config mechanism\nprovided by DeltaSpike. The same is supported for folders via\n`Folder.DefaultFolderNameBuilder`. In this case changing only one usage\nis possible via `Folder.folderNameBuilder`.\n\n== (Grouped-)Conversations\n\nDeltaSpike conversations are based on the window-scope. Therefore, do not\nforget to add the `ds:windowId`\n(`xmlns:ds=\"http://deltaspike.apache.org/jsf\"`) component in case of\n`ClientWindowConfig#CLIENTWINDOW` to your page(/template) and ensure\nthat the window-handling works properly (otherwise conversations will not\nwork correctly). The base principle is similar to CODI-Conversations.\nCODI users just have to ensure that they have to add `ds:windowId` and\nthe names are slightly different.\n\nFirst of all, it is important to mention that DeltaSpike starts (grouped)\nconversations automatically as soon as you access conversation scoped\nbeans. Furthermore, the invocation of `GroupedConversation#close` leads\nto an immediate termination of the conversation.\n\n[source,java]\n----------------------------------------------\n@GroupedConversationScoped\npublic class DemoBean1 implements Serializable\n{\n    //...\n}\n----------------------------------------------\n\n ... leads to a conversation which contains just one bean with the group\nDemoBean1.\n\nTIP: If you would like to use the bean within your JSF pages, you have\nto add `@Named` (jakarta.inject.Named ).\n\n(In case of CDI standard conversations there is just one big conversation\nwhich contains all conversation scoped beans.) The grouped conversations\nprovided by DeltaSpike are completely different. By default every\nconversation scoped bean exists in an \"isolated\" conversation. That\nmeans there are several parallel conversations within the same window.\n\n.Separated DeltaSpike Conversations\n[source,java]\n----------------------------------------------\n@GroupedConversationScoped\npublic class DemoBean2 implements Serializable\n{\n    //...\n}\n\n@GroupedConversationScoped\npublic class DemoBean3 implements Serializable\n{\n    //...\n}\n----------------------------------------------\n\nThe above example leads to two independent conversations in the same window (context).\nIf you close the conversation of DemoBean2, the conversation of\nDemoBean3 is still active. If you have an use-case (e.g. a wizard) which\nuses multiple beans which are linked together very tightly, you can\ncreate a type-safe conversation group.\n\n.Grouped Conversation Scoped Beans\n[source,java]\n----------------------------------------------\ninterface Wizard1 {}\n\n@GroupedConversationScoped\n@ConversationGroup(Wizard1.class)\npublic class DemoBean4 implements Serializable\n{\n    //...\n}\n\n@GroupedConversationScoped\n@ConversationGroup(Wizard1.class)\npublic class DemoBean5 implements Serializable\n{\n    //...\n}\n----------------------------------------------\n\nYou can use `@ConversationGroup` to tell DeltaSpike that there is a\nlogical group of beans. Technically `@ConversationGroup` is just a CDI\nqualifier. Internally DeltaSpike uses this information to identify a\nconversation. In the previous example both beans exist in the same\nconversation (group). If you terminate the conversation group, both\nbeans will be destroyed. If you do not use `@ConversationGroup`\nexplicitly, DeltaSpike uses the class of the bean as conversation group.\n\n.Injecting a Conversation Scoped Bean with an Explicit Group\n[source,java]\n------------------------------------\n//...\npublic class CustomBean1\n{\n    @Inject\n    @ConversationGroup(Group1.class)\n    private CustomBean2 demoBean;\n\n    @Inject\n    @ConversationGroup(Group2.class)\n    private CustomBean2 demoBean;\n}\n------------------------------------\n\nSince `@ConversationGroup` is a standard CDI qualifier you have to use it at\nthe injection point. You have to do that especially because it is possible to\ncreate beans of the same type which exist in different groups (e.g. via\nproducer methods).\n\n.Producer Methods which Produce Conversation Scoped Beans with\nDifferent Groups\n[source,java]\n------------------------------------------------\ninterface Group1 {}\ninterface Group2 {}\n\npublic class CustomBean2\n{\n    @Produces\n    @GroupedConversationScoped\n    @ConversationGroup(Group1.class)\n    public CustomBean2 createInstanceForGroup1()\n    {\n        return new CustomBean2();\n    }\n\n    @Produces\n    @GroupedConversationScoped\n    @ConversationGroup(Group2.class)\n    public CustomBean2 createInstanceForGroup2()\n    {\n        return new CustomBean2();\n    }\n}\n------------------------------------------------\n\n=== Terminating Conversations\n\nYou can inject the conversation via `@Inject` and use it to terminate\nthe conversation immediately or you inject the\n`GroupedConversationManager` which can be used to terminate a given\nconversation (group). All conversations within a window are closed\nautomatically, once `WindowContext#closeWindow` gets called for the window.\n\n.Injecting and Using the Current Conversation\n[source,java]\n--------------------------------------------------------------------------------------------------------------------\n@GroupedConversationScoped\npublic class DemoBean6 implements Serializable\n{\n    @Inject\n    private GroupedConversation conversation; //injects the conversation of DemoBean6 (!= conversation of DemoBean7)\n\n    //...\n\n    public void finish()\n    {\n        this.conversation.close();\n    }\n}\n\n@GroupedConversationScoped\npublic class DemoBean7 implements Serializable\n{\n    @Inject\n    private GroupedConversation conversation; //injects the conversation of DemoBean7 (!= conversation of DemoBean6)\n\n    //...\n\n    public void finish()\n    {\n        this.conversation.close();\n    }\n}\n--------------------------------------------------------------------------------------------------------------------\n\n.Injecting and Using the Explicitly Grouped Conversation\n[source,java]\n----------------------------------------------------------------------------------------------------------------------\ninterface Wizard2 {}\n\n@GroupedConversationScoped\n@ConversationGroup(Wizard2.class)\npublic class DemoBean8 implements Serializable\n{\n    @Inject\n    private GroupedConversation conversation; //injects the conversation of Wizard2 (contains DemoBean8 and DemoBean9)\n\n    //...\n\n    public void finish()\n    {\n        this.conversation.close();\n    }\n}\n\n@GroupedConversationScoped\n@ConversationGroup(Wizard2.class)\npublic class DemoBean9 implements Serializable\n{\n    @Inject\n    private GroupedConversation conversation; //injects the conversation of Wizard2 (contains DemoBean8 and DemoBean9)\n\n    //...\n\n    public void finish()\n    {\n        this.conversation.close();\n    }\n}\n----------------------------------------------------------------------------------------------------------------------\n\n.Terminating a Grouped Conversation Outside of the Conversation\n[source,java]\n-------------------------------------------------------------------------------------------------------------------------\n//...\npublic class DemoBean10 implements Serializable\n{\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    //...\n\n    public void finish()\n    {\n        this.conversationManager.closeConversationGroup(Wizard2.class);  //closes the conversation of group Wizard2.class\n    }\n}\n-------------------------------------------------------------------------------------------------------------------------\n\n.Terminate All Conversations\n[source,java]\n-------------------------------------------------------------------------------------------------------------------------\n//...\npublic class DemoBean11 implements Serializable\n{\n    @Inject\n    private GroupedConversationManager conversationManager;\n\n    //...\n\n    public void finish()\n    {\n        this.conversationManager.closeConversations();  //closes all existing conversations within the current window (context)\n    }\n}\n-------------------------------------------------------------------------------------------------------------------------\n\nTIP: DeltaSpike conversations get closed/restarted immediately instead\nof keeping them until the end of the request like standard conversations do,\nbecause the behaviour of standard conversations breaks a lot of use-cases.\nHowever, if you really need to keep them until the end of the request,\nyou can close them in a `@PostRenderView` callback.\n\n=== Sub-Conversation-Groups\n\nDue to the parallel conversation concept of DeltaSpike there is no need\nof something like nested conversations. Just use them in parallel and\nterminate them in a fine-granular way as soon as you do not need them any\nlonger. As described above, you can terminate a whole\nconversation-group. However, sometimes it is essential to have subgroups\nif you need to end just a part of an use-case instead of all beans\nrelated to an use-case. A sub-group is just a class or an interface used\nto identify a bunch of beans within a group. To terminate such a\nsub-group, it is just needed to pass the class/interface to the\ncorresponding API for terminating a conversation. The sub-group gets\ndetected automatically and instead of terminating a whole conversation-group,\nthe beans of the sub-group get un-scoped.\n\n.Explicitly Listing Beans of a Sub-group\n[source,java]\n--------------------------------------------------------------------------------\npublic class MyGroup{}\n\n@GroupedConversationScoped\n@ConversationGroup(MyGroup.class)\npublic class BeanA {}\n\n@GroupedConversationScoped\n@ConversationGroup(MyGroup.class)\npublic class BeanB {}\n\n@GroupedConversationScoped\n@ConversationGroup(MyGroup.class)\npublic class BeanC {}\n\n@ConversationSubGroup(subGroup = {BeanA.class, BeanB.class})\npublic class MySubGroup extends MyGroup {}\n\n//or\n\n@ConversationSubGroup(of = MyGroup.class, subGroup = {BeanA.class, BeanB.class})\npublic class MySubGroup {}\n--------------------------------------------------------------------------------\n\n.Terminating a Sub-group\n[source,java]\n------------------------------------------------------------------\n@Inject\nprivate GroupedConversationManager conversationManager;\n\n//...\nthis.conversationManager.closeConversationGroup(MySubGroup.class);\n------------------------------------------------------------------\n\nAs you see the class/interface of the sub-group has to extend/implement\nthe group or you specify it via the `@ConversationSubGroup#of`. With\n`@ConversationSubGroup#subGroup` you can list all beans which belong to\nthe sub-group. If you have a lot of such beans or you would like to form\n(sub-)use-case oriented groups, you can use implicit groups:\n\n.Implicit Sub-group\n[source,java]\n------------------------------------------------------------------------\npublic interface Wizard {}\n\n@ConversationSubGroup(of = MyGroup.class, subGroup = Wizard.class)\npublic class ImplicitSubGroup\n{\n}\n\n@Named(\"myWizard\")\n@GroupedConversationScoped\n@ConversationGroup(MyGroup.class)\npublic class WizardController implements Serializable, Wizard\n{\n    //...\n}\n\nthis.conversationManager.closeConversationGroup(ImplicitSubGroup.class);\n------------------------------------------------------------------------\n\nIn the listing above all beans which implement the Wizard interface will\nbe closed as soon as you close the ImplicitSubGroup.\n\n\n== Injection in JSF Artifacts\n\n=== Converter and Validator\n\nPer default the JSF module of DeltaSpike handles JSF converters and validators as std. CDI beans and\ntherefore it's possible to use injection, lifecycle-callbacks, scope-annotations,...\nthe same way as with any other CDI bean.\nThe usage is the same as for `PhaseListener` s.\n\n=== PhaseListener\n\nOnce a std. JSF-`PhaseListener` is annotated with `@org.apache.deltaspike.jsf.api.listener.phase.JsfPhaseListener`,\nthat `PhaseListener` gets active without additional config in `faces-config.xml`.\nSince such `PhaseListener` s are std. CDI beans,\nit's possible to use injection, lifecycle-callbacks as well as scope-annotations\nthe same way as with any other CDI bean.\nFurthermore, it's possible to order `PhaseListener` s via `ordinal`.\nDeltaSpike itself uses it internally e.g. in case of `DoubleSubmitAwarePhaseListener` which looks like:\n\n.Example\n[source,java]\n------------------------------------------------------------------------\n@JsfPhaseListener(ordinal = 9000)\npublic class DoubleSubmitAwarePhaseListener implements PhaseListener, Deactivatable\n{\n    @Inject\n    private PostRequestTokenManager postRequestTokenManager;\n\n    @Override\n    public void beforePhase(PhaseEvent event)\n    {\n        //...\n    }\n\n    @Override\n    public void afterPhase(PhaseEvent event)\n    {\n        //...\n    }\n\n    @Override\n    public PhaseId getPhaseId()\n    {\n        return PhaseId.RESTORE_VIEW;\n    }\n}\n------------------------------------------------------------------------\n\n\n== Event broadcasting\n\n=== Observe Faces-Requests\n\nIt is possible to observe JSF-Requests via `@Observes` in combination with\n`@org.apache.deltaspike.core.api.lifecycle.Initialized` or\n`@org.apache.deltaspike.core.api.lifecycle.Destroyed` as qualifier for `javax.faces.context.FacesContext`.\n\nSuch observer-methods look e.g. like:\n\n.Example\n[source,java]\n------------------------------------------------------------------------\npublic void onBeforeFacesRequest(@Observes @Initialized FacesContext facesContext) {\n    //...\n}\n\npublic void onAfterFacesRequest(@Observes @Destroyed FacesContext facesContext) {\n    //...\n}\n------------------------------------------------------------------------\n\n=== BeforePhase / AfterPhase\n\nIt is possible to observe JSF request-lifecycle phase-events via `@Observes` in combination with\n`@org.apache.deltaspike.jsf.api.listener.phase.BeforePhase` or\n`@org.apache.deltaspike.jsf.api.listener.phase.AfterPhase` as qualifier for `javax.faces.event.PhaseEvent`.\n\nSuch observer-methods look e.g. like:\n\n.Example\n[source,java]\n------------------------------------------------------------------------\npublic void onPhaseStart(@Observes @BeforePhase(JsfPhaseId.ANY_PHASE) PhaseEvent event) {\n    //...\n}\n\npublic void onPhaseEnd(@Observes @AfterPhase(JsfPhaseId.ANY_PHASE) PhaseEvent event) {\n    //...\n}\n------------------------------------------------------------------------\n\n=== JSF SystemEvents\n\nFollowing JSF SystemEvents can be observed via CDI:\n\n* javax.faces.event.PostConstructApplicationEvent\n* javax.faces.event.PreDestroyApplicationEvent\n* javax.faces.event.ExceptionQueuedEvent\n\n.Example\n[source,java]\n-------------------------------------------------------------------\n@ApplicationScoped\npublic class ApplicationConfig\n{\n    public void init(@Observes PostConstructApplicationEvent event)\n    {\n        // ...\n    }\n}\n-------------------------------------------------------------------\n\n== Integration with Exception Control\n\nWhenever a unhandled exception occurs within the JSF lifecycle, our JSF\nExceptionHandler provides a integration to the DeltaSpike Exception\nControl.\n\n=== Examples\n\n==== Basic\n\n-----------------------------------------------------------------------------\n@ExceptionHandler\npublic class ApplicationExceptionHandler\n{\n    public void handleELException(@Handles ExceptionEvent<ELException> event)\n    {\n        // ...\n\n        // no other JSF ExceptionHandler should handle this exception...\n        event.handled();\n    }\n}\n-----------------------------------------------------------------------------\n\n==== Redirect\n\n[source,java]\n-----------------------------------------------------------------------------------------------------------------------------------\n@ExceptionHandler\npublic class ApplicationExceptionHandler\n{\n    public void handleELException(@Handles ExceptionEvent<ELException> event)\n    {\n        FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(...); // or ExternalContext etc.\n\n        // required - \"stops\" the JSF lifecycle\n        FacesContext.getCurrentInstance().responseComplete();\n\n        // no other JSF ExceptionHandler should handle this exception...\n        event.handled();\n    }\n}\n-----------------------------------------------------------------------------------------------------------------------------------\n\n=== Using a Custom Qualifier for JSF Exceptions\n\nIn some cases, it is required to differentiate exceptions from JSF and\nnormal exceptions. This is possible via a CDI qualifier:\n\n[source,java]\n-----------------------------------------------------------------------------------------------------------------------------------\n@Target({ ElementType.TYPE, ElementType.PARAMETER })\n@Retention(RetentionPolicy.RUNTIME)\n@Documented\n@Qualifier\npublic @interface Jsf\n{\n}\n\n@Specializes\npublic class MyJsfModuleConfig extends JsfModuleConfig\n{\n    public Class<? extends Annotation> getExceptionQualifier()\n    {\n        return Jsf.class;\n    }\n}\n\n@ExceptionHandler\npublic class ApplicationExceptionHandler\n{\n    public void handleELException(@Handles @Jsf ExceptionEvent<ELException> event)\n    {\n        FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(...); // or ExternalContext etc.\n\n        // required - \"stops\" the JSF lifecycle\n        FacesContext.getCurrentInstance().responseComplete();\n\n        // no other JSF ExceptionHandler should handle this exception...\n        event.handled();\n    }\n}\n-----------------------------------------------------------------------------------------------------------------------------------\n\n== Double-Submit Prevention\n\nTo avoid that the same content of a form gets submitted and therefore\nprocessed multiple times, it is possible to use the tag\n`<ds:preventDoubleSubmit/>`. As usual for DeltaSpike JSF-tags, the `ds`\nnamespace is `http://deltaspike.apache.org/jsf`. Just add this tag\nwithin every JSF form-tag, you would like to safeguard.\n\n[source,xml]\n--------------------------------------------------\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:h=\"http://java.sun.com/jsf/html\"\n      xmlns:ds=\"http://deltaspike.apache.org/jsf\">\n    <h:head>\n        <!-- head content -->\n    </h:head>\n    <h:body>\n        <h:form>\n            <!-- form content -->\n            <ds:preventDoubleSubmit/>\n        </h:form>\n    </h:body>\n</html>\n--------------------------------------------------\n\n== Tips\n\nUsing errorView, DefaultErrorView or ViewNavigationHandler will fail\nwith Weld versions older than 1.1.10 due to\nhttps://issues.jboss.org/browse/WELD-1178[WELD-1178].\n"
  },
  {
    "path": "documentation/src/main/asciidoc/modules.adoc",
    "content": ":notoc:\n\n= Overview of DeltaSpike Modules\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nDeltaSpike consists of ready-to-use modules. These include a core module and a number of optional modules for providing additional enterprise functionality to your applications. An overview of each module is provided here and for more information see the linked individual module pages.\n\n[cols=\"1,3a\"]\n|===\n|<<core#,Core>> |  For fundamental and defining DeltaSpike API and utility classes\n|<<bean-validation#,Bean Validation>> | For adding CDI support in Bean Validation, enabling creation of CDI aware `ConstraintValidator` methods that can use business objects (EJBs, ManagedBeans) to support validation needs\n|<<container-control#,Container Control>> | For CDI container booting and shutdown and associated context lifecycle management\n|<<data#,Data>> | For an enhanced JPA experience with declarative queries, reducing boilerplate to a minimum\n|<<jpa#,JPA>> | For transactional context and scope\n|<<jsf#,JSF>> | For CDI integration with JSF, with type-safe view config, multi-window handling, new scopes (WindowScoped, ViewScope, ViewAccessScoped, GroupedConversationScoped) and integration with DeltaSpike “core” messages and exception handling\n|<<partial-bean#,Partial-Bean>> | For implementing a generic handler to replace manual implementations of interfaces (or abstract classes)\n|<<scheduler#,Scheduler>> | For simple integration with Quartz v2 (default) or any other scheduler that supports cron-expressions for job-classes\n|<<security#,Security>> | For intercept and security checking on method calls\n|<<servlet#,Servlet>> | For integration with the Java Servlet API, enabling injection of common servlet objects and propagation of servlet events to the CDI event bus\n|<<test-control#,Test-Control>> | For writing CDI-based tests easily\n|==="
  },
  {
    "path": "documentation/src/main/asciidoc/overview.adoc",
    "content": "= Overview of DeltaSpike\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nApache DeltaSpike is a collection of portable CDI extensions. These ready-to-use modules enable you to integrate tested API extensions into your Java projects.\n\nDeltaSpike consists of a core module and a number of <<modules.adoc#, optional modules>> for providing additional\nenterprise functionality to your applications. The modules include features for enhanced security with type-safe\ncontrol over method invocations, integration with schedulers, injection of CDI objects into validators, a\ntransactional context and scope, and much more. DeltaSpike also provides boot and shutdown control over CDI containers\nin Java SE applications.\n\nAs a CDI extension, DeltaSpike must be used in conjunction with a CDI implementation and supports both JBoss Weld\nand Apache OpenWebBeans. DeltaSpike is tested on a range of application servers and CDI-enabled containers\nincluding Apache TomEE, JBoss AS, WildFly, Oracle GlassFish, and Jetty.\n\nDeltaSpike provides a number of link:http://deltaspike.apache.org/examples.html[examples] to show you how to use and get\nthe most from this technology.\n\n== Features\n\n=== Java EE 7 without Java EE 7!\n\n*Transactional support for non-EJB beans:* The Transactional Interceptor in DeltaSpike paved the way for\n`@Transactional` in Java EE 7.\nAlthough we not only support JTA transactions but also resource local transactions and use a slightly different Exception handling.\n\n*Injectable resources:* Configuration, resource bundles,... are easy to inject when using CDI and Apache DeltaSpike.\n\n*@Exclude annotation:* Lets you prevent classes from being treated as CDI beans even if they are in a CDI-enabled\narchive in a Jakarta EE project.\nYou can even exclude classes based on ProjectStages or configuration expressions.\n\n*Scheduling tasks*: handle Async processes in a non-JakartaEE environment.\n\n*BeanProvider:* Easy Access to the BeanManager and CDI beans even in non-managed classes like JPA 2.0 EntityListeners or\nSpring Beans.\n\n\n=== JSF Improvements\n\n*Multi-window handling:* Management of logical windows for batch jobs, browser tab separation in JSF and more.\n\n*Type-safe view-config:* Lets you bind metadata (e.g. for security) to views with a flexible type-safe approach. It\nprovides a more solid navigation in case of JSF and helps a lot in the maintenance phase.\n\n*View-Controller:* Based on type-safe view-configs, view-controller annotations provide a type-safe alternative to\nstandard tags.\n\n*JSF event broadcasting to CDI:* Allows CDI to be notified about JSF events\n\n=== Productivity Improvements\n\n*Security based on annotations:* The foundation for building a robust, capable and non-invasive security solution.\n\n*New CDI scopes:* TransactionScoped, WindowScoped, ViewScoped, ViewAccess scope, Grouped conversation scope.\n\n*Container Control and Test Control:* Java SE with CDI, all with a unifying API. Start, stop, add classes to a running CDI container.\n\n*Data Module:* An out of the box entity framework solution complete with support for container or application managed persistence contexts, as well as JDBC.\n\n*JMX integration:* Any CDI bean can be exposed via JMX easily with a single annotation.\n\n*Type-safe i18n messages:* Localized messages are easy to use with an interface and a resource bundle, no more boilerplate and your messages now have context within the code.\n\n*Type-safe ProjectStages:* Compared to ProjectStages in JSF, DeltaSpike provides a type-safe, but still extensible\napproach which can be used in CDI-based applications.\n\n== Background\n\n=== CDI\nJava Contexts and Dependency Injection for the Java EE platform (link:https://jcp.org/en/jsr/detail?id=299[JSR 299]),\n abbreviated _CDI_ was introduced as part of Java EE 6 and is now part of Jakarta Enterprise.\nThe core features of CDI are as follows:\n\n* improved stateful object lifecycles with an additional context named _Conversation_ that encompasses a series of requests within one session and lifecycle management by the container according to well-defined contexts\n* dependency injection conducted in a type-safe manner, with type checking conducted at compilation time so errors are exposed earlier and debugging is easier\n* event notification facility for object interaction\n* a better approach for interceptors with annotations binding interceptors to objects and with a new interceptor\nnamed _decorator_ that knows about individual bean attributes through inheritance and is more appropriate for use in\n solving business problems\n* a Service Provider Interface (SPI) for developing portable extensions to the CDI container\n\nCDI is a link:https://jcp.org/en/home/index[Java Community Process (JCP)] standard. All Java EE 6 compliant\napplication servers must provide support for CDI. link:http://weld.cdi-spec.org/[JBoss Weld] is a reference\nimplementation of the CDI specification and other spec-compliant implementations exist such as link:http://openwebbeans.apache.org/[Apache OpenWebBeans (OWB)]. While CDI is a Java EE 6 essential, CDI can also be used in Java SE environments with the aid of standalone CDI implementations.\n\n=== Portable CDI Extensions\nThe CDI Service Provider Interface (SPI) is exposed to enable extension of the CDI feature set by third parties.\nPortable CDI extensions extend CDI implementations and improve existing Java EE APIs by enabling integration of different technologies.\n\nAs set out in the CDI specification, a portable CDI extension may integrate with a CDI container as follows:\n\n* providing its own beans, interceptors and decorators to the container\n* injecting dependencies into its own objects using the dependency injection service\n* providing a context implementation for a custom scope\n* augmenting or overriding the annotation-based metadata with metadata from some other source\n\nAs indicated by the name, _portable_ CDI extensions can be used with any spec-compliant CDI implementation.\n\n== Next\nFor instructions on how to start using DeltaSpike, see <<configure#,Configure DeltaSpike in Your Projects>> and <<cdiimp#,Enable CDI For Your Java Environment>>.\n"
  },
  {
    "path": "documentation/src/main/asciidoc/partial-bean.adoc",
    "content": ":moduledeps: core, proxy\r\n\r\n= Partial-Bean Module\r\n\r\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\r\n\r\n== Overview\r\nThe Partial-Bean module provides means for implementing a generic handler to replace manual implementations of interfaces (or abstract classes).\r\n\r\n== Project Setup\r\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\r\n\r\n=== Declare Partial-Bean Module Dependencies\r\nAdd the Partial-Bean module to the list of dependencies in the project `pom.xml` file using this code snippet:\r\n\r\n[source,xml]\r\n----\r\n<dependency>\r\n    <groupId>org.apache.deltaspike.modules</groupId>\r\n    <artifactId>deltaspike-partial-bean-module-api</artifactId>\r\n    <version>${deltaspike.version}</version>\r\n    <scope>compile</scope>\r\n</dependency>\r\n\r\n<dependency>\r\n    <groupId>org.apache.deltaspike.modules</groupId>\r\n    <artifactId>deltaspike-partial-bean-module-impl</artifactId>\r\n    <version>${deltaspike.version}</version>\r\n    <scope>runtime</scope>\r\n</dependency>\r\n----\r\n\r\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\r\n\r\n[source]\r\n----\r\n     runtime 'org.apache.deltaspike.modules:deltaspike-partial-bean-module-impl'\r\n     compile 'org.apache.deltaspike.modules:deltaspike-partial-bean-module-api'\r\n----\r\n\r\nIMPORTANT: Currently CDI Interceptors applied via @Interceptors, @Intercepted and @Decorator are not supported by our proxies!\r\n\r\n\r\n== @PartialBeanBinding\r\n\r\nPartial beans allow you to implement a generic handler to replace manual\r\nimplementations of interfaces (or abstract classes).\r\n\r\n`@PartialBeanBinding` is the binding-annotation for creating a custom\r\ninterface (/abstract class) to generic handler binding.\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\n@PartialBeanBinding\r\n@Retention(RUNTIME)\r\n@Target(TYPE)\r\npublic @interface MyPartialBeanBinding {}\r\n-------------------------------------------------------------------------------------\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\n//scope is optional\r\n@MyPartialBeanBinding\r\npublic interface PartialBean\r\n{\r\n    String getValue();\r\n}\r\n-------------------------------------------------------------------------------------\r\n\r\n[source,java]\r\n-------------------------------------------------------------------------------------\r\n//scope is optional\r\n@MyPartialBeanBinding\r\npublic class MyPartialBeanHandler implements java.lang.reflect.InvocationHandler\r\n{\r\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable\r\n    {\r\n        //generic handler logic\r\n    }\r\n}\r\n-------------------------------------------------------------------------------------\r\n"
  },
  {
    "path": "documentation/src/main/asciidoc/projectstage.adoc",
    "content": "= DeltaSpike ProjectStage\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Introduction\n\nProject stages allow to use implementations depending on the current\nenvironment. For example, you can implement a bean which creates sample-data for\nsystem tests which gets activated only in case of ProjectStage\n`SystemTest`.\n\n_Besides custom ProjectStages_ it is possible to use the following\npre-defined ProjectStages:\n\n* UnitTest\n* Development\n* SystemTest\n* IntegrationTest\n* Staging\n* Production\n\nThe core provides a pluggable and type-safe approach for using project\nstages in a project (it is also used within the framework). Furthermore,\n`@Exclude` allows use of, for example, implementations annotated with\n`jakarta.enterprise.inject.Alternative` for specific ProjectStages.\nBesides the out-of-the-box ProjectStages it is possible to implement\n_custom but type-safe_ ProjectStages which will be exposed by\nDeltaSpike.\n\nResolving and using the ProjectStage:\n\n[source,java]\n-------------------------------------------------------------------------------\n@Inject\nprivate ProjectStage projectStage;\n\n//...\n\nboolean isDevProjectStage = ProjectStage.Development.equals(this.projectStage);\n-------------------------------------------------------------------------------\n\n\n== Custom Project Stages\n\nIt is possible to provide custom project stage implementations.\nTherefore, you have to provide an implementation of the\n`ProjectStageHolder` interface. In this class you nest the custom\nProjectStage implementations which have to be\n`public static final class` and it is required to extend `ProjectStage`.\nIt is required to provide a `public static final` instance even though,\nyou will not use it directly.\n\nProjectStageHolder for custom project stage implementations:\n\n[source,java]\n-----------------------------------------------------------------------------------------\npublic class CustomProjectStageHolder implements ProjectStageHolder\n{\n    public static final class CustomProjectStage extends ProjectStage\n    {\n        private static final long serialVersionUID = 1029094387976167179L;\n    }\n\n    public static final CustomProjectStage CustomProjectStage = new CustomProjectStage();\n}\n-----------------------------------------------------------------------------------------\n\nConfigure your custom `ProjectStageHolder` in\n`META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder`.\n\nNOTE: The file has to provide the _fully qualified_ class name of the custom\nimplementation of the `ProjectStageHolder` interface.\n\nUsage of a custom project stage:\n\n[source,java]\n----------------------------------------------------------------------------\nProjectStage customProjectStage;\ncustomProjectStage = ProjectStage.valueOf(\"CustomProjectStage\");\n//or\ncustomProjectStage = CustomProjectStageHolder.CustomProjectStage;\n//or\n@Exclude(ifProjectStage = CustomProjectStageHolder.CustomProjectStage.class)\n----------------------------------------------------------------------------\n\n\n== Setting the active ProjectStage\n\nFor setting the ProjectStage which shall get used in your application\nyou can specify it in a few ways. The underlying mechanism used to\ndetermine the string is the ConfigResolver.\n\n.Example\n------------------------------------------------\n-Dorg.apache.deltaspike.ProjectStage=Development\n------------------------------------------------\n\n== ProjectStageProducer (for Third-party Portable Extensions)\n\n`ProjectStageProducer` provides the producer method which allows to\ninject the current ProjectStage. However, in some cases it is needed to\nuse ProjectStages also during the bootstrapping process of the CDI\ncontainer and you can not use injection. In such cases you can use\n`ProjectStageProducer.getInstance().getProjectStage()` to resolve the\ncurrent ProjectStage. This helper also contains helpers for unit-tests\n- e.g. `#setProjectStage`. However, those methods should not be needed\nfor users (we just need them for testing different ProjectStage\nscenarios).\n"
  },
  {
    "path": "documentation/src/main/asciidoc/proxy.adoc",
    "content": ":moduledeps: core\n\n= Proxy Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe Proxy Module provides a simple CDI based wrapper for creating dynamic proxies that can be used within other extensions. +\nThe benefit of the DeltaSpike Proxy Module (compared to Javassist or any library) is that the DeltaSpike proxies will execute CDI interceptors. +\nThe Proxy Module also provides the 'DeltaSpikeProxyContextualLifecycle', which enables you to dynamically register a proxy as CDI bean via the DeltaSpike 'BeanBuilder'.\n\nIMPORTANT: Currently CDI Interceptors applied via @Interceptors, @Intercepted and @Decorator are not supported by our proxies!\n\n=== 1. Declare Proxy Module Dependencies\n\nAdd the Proxy module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-proxy-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-proxy-module-impl-asm</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-proxy-module-impl'\n     compile 'org.apache.deltaspike.modules:deltaspike-proxy-module-api'\n----\n\nThe currently provided implementation is a wrapper for ASM 5, which gets shaded into the implementation JAR.\n\n=== 2. Extend `DeltaSpikeProxyFactory`\n\nThe key to making the proxy module work is to provide an implementation of `DeltaSpikeProxyFactory` which will do your proxy work for you. +\nDeltaSpike ships 3 implementations which demonstrates how its meant to work: +\n\n- org.apache.deltaspike.partialbean.impl.PartialBeanProxyFactory\n- org.apache.deltaspike.proxy.util.EnableInterceptorsProxyFactory\n- org.apache.deltaspike.jsf.impl.injection.proxy.ConverterAndValidatorProxyFactory\n\n=== 3. Using `@EnableInterceptors`\n\n`@EnableInterceptors` allows you to enable your bean interceptors for @Produces, which is not supported via the CDI API. +\nBoth interceptors on method and class level are supported.\n\n[source,java]\n--------------------------------------\n@MyCustomInterceptor\npublic SomeServiceImpl implements SomeService\n{\n    @Transactional\n    public void doSomething()\n    {\n        ....\n    }\n}\n--------------------------------------\n\n[source,java]\n--------------------------------------\n@Produces\n@EnableInterceptors\npublic SomeService produce()\n{\n    return new SomeServiceImpl();\n}\n--------------------------------------\n\n=== 4. Using `EnableInterceptorsProxyFactory`\n\n`@EnableInterceptors` is just a API for producers which is built on `EnableInterceptorsProxyFactory`. +\nWith `EnableInterceptorsProxyFactory` you can just proxy an existing object and let it execute CDI interceptors, if they are defined on the given object class.\n\n[source,java]\n--------------------------------------\n@MyCustomInterceptor\npublic SomeServiceImpl implements SomeService\n{\n    @Transactional\n    public void doSomething()\n    {\n        ....\n    }\n}\n--------------------------------------\n\n[source,java]\n--------------------------------------\npublic void init()\n{\n    SomeServiceImpl myService = new SomeServiceImpl();\n    myService = EnableInterceptorsProxyFactory.wrap(myService, BeanManagerProvider.getInstance().getBeanManager());\n    myService.doSomething(); // will execute the interceptors\n}\n--------------------------------------\n"
  },
  {
    "path": "documentation/src/main/asciidoc/scheduler.adoc",
    "content": ":moduledeps: core, container-control\n:moduleconf: impl:org.apache.deltaspike.scheduler.impl.SchedulerBaseConfig\n\n= Scheduler Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe Scheduler module provides simple integration with Quartz v2 (default) or any other scheduler that supports cron-expressions for job-classes.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== 1. Declare Scheduler Module Dependencies\nAdd the Scheduler module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-scheduler-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-scheduler-module-impl</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-scheduler-module-impl'\n     compile 'org.apache.deltaspike.modules:deltaspike-scheduler-module-api'\n----\n\n=== 2. Declare External Dependencies\n\nBy default, the Scheduler module looks to integrate with Quartz. If this is the scheduler you would like to use, add Quartz 2.x to the list of project dependencies using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.quartz-scheduler</groupId>\n    <artifactId>quartz</artifactId>\n    <version>2.3.0</version>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     compile 'org.quartz-scheduler:quartz'\n----\n\n=== 3. Declare Container Control dependency\n\nScheduled jobs can have built-in CDI contexts started for the duration of their execution using `@Scheduled#startScopes` which internally uses the <<container-control#, Container Control module>>. The dependency on the API and the appropriate implementation needs to be declared manually even if the feature is not used. An example for the Weld implementation:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-weld</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOf ir you're using Gradle:\n\n[source]\n[source]\n----\ndependencies {\n    runtime 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-weld'\n    compile 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api'\n}\n----\n\n== @Scheduled with org.quartz.Job or java.lang.Runnable\n\nJust annotate your Quartz-Jobs with `@Scheduled` and they will get\npicked up and passed to the scheduler automatically (during the\nbootstrapping process).\n\n.Scheduled task based on org.quartz.Job\n[source,java]\n---------------------------------------------------------------------------------\n@Scheduled(cronExpression = \"0 0/10 * * * ?\")\npublic class CdiAwareQuartzJob implements org.quartz.Job\n{\n    @Inject\n    private MyService service;\n\n    @Override\n    public void execute(JobExecutionContext context) throws JobExecutionException\n    {\n        //...\n    }\n}\n---------------------------------------------------------------------------------\n\nAs an alternative it's possible to annotate an implementation of `java.lang.Runnable` (since DeltaSpike v1.5.3):\n\n.Scheduled task based on java.lang.Runnable\n[source,java]\n---------------------------------------------------------------------------------\n@Scheduled(cronExpression = \"0 0/10 * * * ?\")\npublic class CdiAwareRunnableJob implements java.lang.Runnable\n{\n    @Inject\n    private MyService service;\n\n    @Override\n    public void run()\n    {\n        //...\n    }\n}\n---------------------------------------------------------------------------------\n\nBehind the scenes DeltaSpike registers an adapter for Quartz which just delegates to the `run`-method once the adapter gets called by Quartz.\nTechnically you end up with almost the same, just with a reduced API for implementing (all) your scheduled jobs.\nTherefore the main difference is that your code is independent of Quartz-classes.\nHowever, you need to select `org.quartz.Job` or `java.lang.Runnable` for all your scheduled-tasks, bot not both!\n\nIn such scheduled-tasks CDI based dependency-injection is enabled.\nFurthermore, the request- and session-scope get started (and stopped)\nper job-execution. Therefore, the container-control module (of\nDeltaSpike) is required. That can be controlled via\n`@Scheduled#startScopes` (possible values: all scopes supported by the\ncontainer-control module as well as `{}` for 'no scopes').\n\nWith 'false' for `@Scheduled#onStartup`, it is even possible to\nschedule/install jobs dynamically.\n\nThe following example shows how to use it, if you are using `org.quartz.Job` (and not `java.lang.Runnable`).\n\n.Example\n[source,java]\n-------------------------------------------------------------------------------------\n@ApplicationScoped\npublic class ProjectStageAwareSchedulerController\n{\n    @Inject\n    private Scheduler<Job> jobScheduler;\n\n    @Inject\n    private ProjectStage projectStage; \n\n    public void registerJobs()\n    {\n        if (ProjectStage.Production.equals(this.projectStage))\n        {\n            //see 'false' for @Scheduled#onStartup\n            this.jobScheduler.registerNewJob(ManualCdiAwareQuartzJob.class);\n        }\n    }\n\n    @Scheduled(cronExpression = \"0 0/10 * * * ?\", onStartup = false)\n    public class ManualCdiAwareQuartzJob implements org.quartz.Job\n    {\n        @Inject\n        private MyService service;\n \n        @Override\n        public void execute(JobExecutionContext context) throws JobExecutionException\n        {\n            //...\n        }\n    }\n}\n-------------------------------------------------------------------------------------\n\n== Configurable CRON expressions\n\nIn some cases it might be useful to configure a cron-expression e.g. per Project-Stage.\nTherefore, DeltaSpike (v1.6.0+) allows to use keys instead of hardcoded expressions.\n\nIn the previous examples we had e.g. `@Scheduled(cronExpression = \"0 0/10 * * * ?\")`.\nInstead of hardcoding it that way, it's possible to use e.g. `@Scheduled(cronExpression = \"{myCronExpression}\")` and\nin one of the active config-sources used by DeltaSpike a concrete expression can be defined e.g. via `myCronExpression=0 0/10 * * * ?`.\nUsing e.g. `myCronExpression.Development=0 0/5 * * * ?` would allow to change the configured expression for Project-Stage development.\n\n== Manual Scheduler Control\n\nThe SPI allows to control the scheduler (or integrate any other\ncompatible scheduler as an alternative to Quartz2)\n\nVia standard injection like\n\n[source,java]\n------------------------------------\n@Inject\nprivate Scheduler<Job> jobScheduler;\n------------------------------------\n\nit is possible to manually start/stop the scheduler,\npause/resume/interrupt/check scheduled jobs, register jobs manually or\nstart a job once (without registering it permanently).\n\n**Attention**: To use a typed injection-point and avoid deployment failure with some versions of Weld, you must use\n\n[source,java]\n------------------------------------------------------------------\npublic class QuartzSchedulerProducer\n{\n    @Produces\n    @ApplicationScoped\n    protected Scheduler<Job> produceScheduler(Scheduler scheduler)\n    {\n        return scheduler;\n    }\n}\n------------------------------------------------------------------\n\nor\n\n[source,xml]\n-----------------------------------------------------------------------------\n<alternatives>\n  <class>org.apache.deltaspike.scheduler.impl.QuartzSchedulerProducer</class>\n</alternatives>\n-----------------------------------------------------------------------------\n\n== Manual scheduling\n\nIf the SPI provided by `org.apache.deltaspike.scheduler.spi.Scheduler` doesn't provide a method you are looking for,\nyou can use `#unwrap` to access the underlying scheduler.\nPer default DeltaSpike uses an implementation of `org.quartz.Scheduler`.\nTherefore, it's possible to inject `org.apache.deltaspike.scheduler.spi.Scheduler` and use it like in the following example:\n\n[source,java]\n----------------------------------------------------------------------------------------------\npublic class ManualJobScheduler\n{\n    @Inject\n    private Scheduler<Job> scheduler;\n\n    @Override\n    public void scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException\n    {\n        this.scheduler.unwrap(org.quartz.Scheduler.class).scheduleJob(jobDetail, trigger);\n    }\n}\n----------------------------------------------------------------------------------------------\n\nWith that it's e.g. possible to schedule quartz-jobs based on the same quartz-job(-class), but with different triggers,...\nAlso manually scheduled jobs benefit from DeltaSpike features like the support of `@Inject` in the job-instances.\n\n== Execute java.lang.Runnable with ManagedExecutorService\n\nIf you would like to use e.g. the `ManagedExecutorService` (with EE7+) to run the jobs,\nyou can provide a custom adapter by adding e.g.\n`deltaspike.scheduler.runnable-adapter-class=mypackage.DelegatingJobRunnableAdapter` to `META-INF/apache-deltaspike.properties`.\nSuch an adapter just needs to implement `org.quartz.Job` and in case of EE7+ inject e.g. `ManagedExecutorService` as shown in the following example:\n\n[source,java]\n---------------------------------------------------------------------------------\npublic class DelegatingJobRunnableAdapter implements java.lang.Runnable\n{\n    @Resource\n    private ManagedExecutorService managedExecutorService;\n\n    @Override\n    public void run()\n    {\n        Class<? extends Runnable> jobClass =\n            ClassUtils.tryToLoadClassForName(context.getJobDetail().getKey().getName(), Runnable.class);\n\n        Runnable runnableBean = BeanProvider.getContextualReference(jobClass);\n        managedExecutorService.execute(runnableBean);\n    }\n}\n---------------------------------------------------------------------------------\n\n== Custom Scheduler\n\nIt is possible to replace the default integration with Quartz. Any scheduler that supports cron-expressions for job-classes can be used.\nFor more information, see link:https://deltaspike.apache.org/javadoc/{latestStable}/org/apache/deltaspike/scheduler/spi/Scheduler.html[Scheduler javadoc].\n"
  },
  {
    "path": "documentation/src/main/asciidoc/security.adoc",
    "content": ":moduledeps: core\n\n= Security Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\n\nThe Security module provides APIs for authorization of method invocations.\n\nThere are two different APIs provided for two different approaches -- one simple interceptor-style API and another for more complex scenarios.\n\n* *<<_simple_interceptor_style_authorization, Simple interceptor-style API>>:* the method that is to be secured is loosely coupled to a predicate method\n(called _authorizer_ method) which decides whether the secured method invocation should proceed. Similarly to CDI\ninterceptors, the secured method and the authorizer are tied together using a binding annotation --\n`@SecurityBindingType` in this case.\n\n* *<<_advanced_authorization, Advanced API>>:* this API offers fine-grained control over the authorization process. Multiple independent _voters_ can participate in making the authorization decision and possibly return _security violations_ and thus prevent the method invocation. The voters share a common context. This API is suitable for integration with third-party security frameworks. Also, this API can be used to <<jsf.adoc#_security_integration_via_secured, secure JSF view access>> when using the DeltaSpike JSF module.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== 1. Declare Security Module Dependencies\nAdd the Security module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-security-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-security-module-impl</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-security-module-impl'\n     compile 'org.apache.deltaspike.modules:deltaspike-security-module-api'\n----\n\n=== 2. Enable the SecurityInterceptor\nFor CDI 1.0 (or DeltaSpike v1.1.0 and earlier together with CDI 1.1+), you must enable the security interceptor in the project `beans.xml` file:\n\n[source,xml]\n----\n<beans>\n    <!-- Not needed with CDI 1.1+ and DeltaSpike v1.1.1+ -->\n    <interceptors>\n        <class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>\n    </interceptors>\n</beans>\n----\n\n== Simple interceptor-style authorization\nThis feature of the Security module intercepts method calls and performs a security check before invocation is allowed to proceed.\n\nThe first piece of code required to use this API is a _security binding_ annotation. This is what we will use to add security behavior to our business classes and methods.\n\n.Create the security binding annotation\n[source,java]\n----\n@Retention(value = RUNTIME)\n@Target({TYPE, METHOD})\n@Documented\n@SecurityBindingType\npublic @interface UserLoggedIn {}\n----\n\nNext, we must define an _authorizer_ class to implement behavior for our\ncustom security binding type. This class is simply a CDI bean which\ndeclares a method annotated `@Secures`, qualified with the security binding\nannotation we created in the first step.\n\nThis method has access to the `InvocationContext` of the method call, so\nif we need to access parameter arguments, we can do so using the given\ncontext. Note that we may also inject other beans into the parameter\nlist of our authorizer method.\n\n.Create the authorizer\n[source,java]\n---------------------------------------------------------------------------------------------------------------------------------\n@ApplicationScoped\npublic class LoggedInAuthorizer\n{\n    @Secures\n    @UserLoggedIn\n    public boolean doSecuredCheck(InvocationContext invocationContext, BeanManager manager, Identity identity) throws Exception\n    {\n        return identity.isLoggedIn(); // perform security check\n    }\n}\n---------------------------------------------------------------------------------------------------------------------------------\n\nWe can then use our new annotation to secure business or bean methods.\nThis binding annotation may be placed on the entire class (securing all\nmethods) or on individual methods that you wish to secure.\n\n.Secure a bean method\n[source,java]\n----------------------------------------\n@ApplicationScoped\npublic class SecuredBean1\n{\n    @UserLoggedIn\n    public void doSomething(Thing thing)\n    {\n        thing.doSomething();\n    }\n}\n----------------------------------------\n\nNext, we may access parameter values from the method invocation directly\nin our authorizer bean by creating custom `@SecurityParameterBinding`\ntypes; this is a simple step once we have completed the work above:\n\n.Create a parameter binding annotation\n[source,java]\n--------------------------------\n@Retention(value = RUNTIME)\n@Target({PARAMETER})\n@Documented\n@SecurityParameterBinding\npublic @interface CurrentThing {\n}\n--------------------------------\n\nNow, when a secured method is invoked, we can inject actual parameter\nvalues as arguments into our authorizer method, providing domain-level\nsecurity in our applications:\n\n.Update the authorizer to use parameter binding\n[source,java]\n------------------------------------------------------------------------------------------------------------------------------------------------------------\n@ApplicationScoped\npublic class CustomAuthorizer\n{\n    @Secures\n    @UserLoggedIn\n    public boolean doSecuredCheck(InvocationContext invocationContext, BeanManager manager, Identity identity, @CurrentThing Thing thing) throws Exception\n    {\n        return thing.hasMember(identity); // perform security check against our method parameter\n    }\n}\n------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nNote that our business method must also be annotated.\n\n.Complete the Parameter Binding\n[source,java]\n------------------------------------------------------\n@ApplicationScoped\npublic class SecuredBean1\n{\n    @UserLoggedIn\n    public void doSomething(@CurrentThing Thing thing)\n    {\n        thing.doSomething();\n    }\n}\n------------------------------------------------------\n\nOur method is now secured, and we are able to use given parameter values\nas part of our security authorizer!\n\nThere may be cases where you may want to base your authorization logic\non the result of the secured method and do the security check after the\nmethod invocation. Just use the same security binding type for that\ncase:\n\n[source,java]\n----------------------------------\n@ApplicationScoped\npublic class SecuredBean1\n{\n    @UserLoggedIn\n    public Thing loadSomething()\n    {\n        return thingLoader.load();\n    }\n}\n----------------------------------\n\nNow you need to access the return value in the authorizer method. You\ncan inject it using the `@SecuredReturn` annotation. Update the authorizer\nto use a secured return value:\n\n[source,java]\n---------------------------------------------------------------------------------------------------\n@ApplicationScoped\npublic class CustomAuthorizer\n{\n    @Secures\n    @UserLoggedIn\n    public boolean doSecuredCheck(@SecuredReturn Thing thing, Identity identity) throws Exception\n    {\n        return thing.hasMember(identity); // perform security check against the return value\n}\n---------------------------------------------------------------------------------------------------\n\nNow the authorization will take place after the method invocation using\nthe return value of the business method.\n\n== Advanced authorization\n\nThis is an alternative to the simple annotation-based interceptor-style API. This API uses the annotation `@Secured` and is mainly a hook for integration of custom security concepts and third-party frameworks. The DeltaSpike Security module is _not_ a full application security solution, but some of the other DeltaSpike modules are security-enabled and use this API (e.g. correct behaviour within custom scope implementations,...). Internally, this `@Secured` API uses the `@Secures`/`@SecurityBindingType` API.\n\n(In MyFaces CODI it was originally a CDI interceptor. This part changed\na bit, because between the interceptor and `@Secured` is the\n`@SecurityBindingType` concept which triggers `@Secured` as on possible\napproach. Therefore the basic behaviour remains the same and you can\nthink about it like an interceptor.)\n\nThe entry point to this API is the `@Secured` annotation placed either on the whole class -- enabling security for all methods -- or on individual methods. The only other prerequisite is at least one `AccessDecisionVoter` implementation, explained in the next section.\n\n.Securing All Intercepted Methods of a CDI Bean\n[source,java]\n-----------------------------------------\n//...\n@Secured(CustomAccessDecisionVoter.class)\npublic class SecuredBean\n{\n    //...\n}\n-----------------------------------------\n\n.Securing Specific Methods\n[source,java]\n---------------------------------------------\n//...\npublic class SecuredBean\n{\n    @Secured(CustomAccessDecisionVoter.class)\n    public String getResult()\n    {\n        //...\n    }\n}\n---------------------------------------------\n\n=== AccessDecisionVoter\n\nThis interface is (besides the `@Secured` annotation) the most important\npart of the concept. Both artifact types are also the only required\nparts:\n\n[source,java]\n--------------------------------------------------------------------------------------------------------\npublic class CustomAccessDecisionVoter implements AccessDecisionVoter\n{\n    @Override\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)\n    {\n        Method method = accessDecisionVoterContext.<InvocationContext>getSource().getMethod();\n\n        //...\n    }\n}\n--------------------------------------------------------------------------------------------------------\n\n////\n[TODO] tip about the changed parameter/s\n////\n\n=== SecurityViolation\n\nIn case of a detected violation a `SecurityViolation` has to be added to\nthe result returned by the `AccessDecisionVoter`.\n\n=== AbstractAccessDecisionVoter\n\nYou can also implement the abstract class `AbstractAccessDecisionVoter`.\nThis is a convenience class which allows an easier usage:\n\n[source,java]\n-----------------------------------------------------------------------------------------\npublic class CustomAccessDecisionVoter extends AbstractAccessDecisionVoter\n{\n\n    @Override\n    protected void checkPermission(AccessDecisionVoterContext accessDecisionVoterContext,\n            Set<SecurityViolation> violations)\n    {\n        // check for violations\n        violations.add(newSecurityViolation(\"access not allowed due to ...\"));\n    }\n}\n-----------------------------------------------------------------------------------------\n\n\n=== @Secured and stereotypes with custom metadata\n\nIf there are multiple `AccessDecisionVoter` and maybe in different\nconstellations, it is easier to provide an expressive CDI stereotypes for\nit. Later on that also allows to change the behaviour in a central\nplace.\n\n.Stereotype Support of @Secured\n[source,java]\n-------------------------------------------\n@Named\n@Admin\npublic class MyBean implements Serializable\n{\n  //...\n}\n\n//...\n@Stereotype\n@Secured(RoleAccessDecisionVoter.class)\npublic @interface Admin\n{\n}\n-------------------------------------------\n\nFurthermore, it is possible to provide custom metadata easily.\n\n.Stereotype of @Secured with custom metadata\n[source,java]\n------------------------------------------------------------------------------------------\n@Named\n@Admin(securityLevel=3)\npublic class MyBean implements Serializable\n{\n  //...\n}\n\n//...\n@Stereotype\n@Secured(RoleAccessDecisionVoter.class)\npublic @interface Admin\n{\n  int securityLevel();\n}\n\n@ApplicationScoped\npublic class RoleAccessDecisionVoter implements AccessDecisionVoter\n{\n    private static final long serialVersionUID = -8007511215776345835L;\n\n    public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext voterContext)\n    {\n        Admin admin = voterContext.getMetaDataFor(Admin.class.getName(), Admin.class);\n        int level = admin.securityLevel();\n        //...\n    }\n}\n------------------------------------------------------------------------------------------\n\n=== AccessDecisionVoterContext\n\nBecause the `AccessDecisionVoter` can be chained,\n`AccessDecisionVoterContext` allows to get the current state as well as\nthe results of the security check.\n\nThere are several methods that can be useful\n\n* `getState()` - Exposes the current state : INITIAL, VOTE_IN_PROGRESS, VIOLATION_FOUND, NO_VIOLATION_FOUND\n* `getViolations()` - Exposes the found violations\n* `getSource()` - Exposes, for example, the current instance of `javax.interceptor.InvocationContext` in combination with `@Secured` used as interceptor.\n* `getMetaData()` - Exposes the found meta-data, for example the view-config-class if `@Secured` is used in combination with type-safe view-configs\n* `getMetaDataFor(String, Class<T>)` - Exposes meta-data for the given key\n\n=== SecurityStrategy SPI\n\nThe `SecurityStrategy` interface allows to provide a custom\nimplementation which should be used for `@Secured`. Provide a custom\nimplementation as bean-class in combination with `@Alternative` or\n`@Specializes` (or as global-alternative).\n\nIn case of global-alternatives an additional configuration needs to be added to\n`/META-INF/apache-deltaspike.properties`.\n\n.Example\n----\nglobalAlternatives.org.apache.deltaspike.security.spi.authorization.SecurityStrategy=mypackage.CustomSecurityStrategy\n----\n\nTIP: The configuration for global alternatives is following the pattern:\n`globalAlternatives._<interface-name>_=_<implementation-class-name>_`\n\n\n=== Examples\n\n==== Redirect to requested page after login\nDeltaSpike can be combined with pure CDI or with any other security\nframeworks (like PicketLink) to track the denied page and make it\navailable after user logs in.\n\nAn example of this use case is available in the examples module in the DeltaSpike repository:\n\n* link:https://github.com/apache/deltaspike/tree/master/deltaspike/examples/security-requested-page-after-login-cdi[Making initially requested secured page available for redirect after login with CDI]\n\n* link:https://github.com/apache/deltaspike/tree/master/deltaspike/examples/security-requested-page-after-login-picketlink[Making initially requested secured page available for redirect after login with PicketLink]\n\nThe relevant classes are `AuthenticationListener` and `LoggedInAccessDecisionVoter`.\n"
  },
  {
    "path": "documentation/src/main/asciidoc/servlet.adoc",
    "content": ":moduledeps: core\n\n= Servlet Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe Servlet module provides CDI integration with the Java Servlet API. It enables injection of common servlet objects and propagation of servlet events to the CDI event bus.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== 1. Declare Servlet Module Dependencies\nAdd the Servlet module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-servlet-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>compile</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-servlet-module-impl</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>runtime</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     runtime 'org.apache.deltaspike.modules:deltaspike-servlet-module-impl'\n     compile 'org.apache.deltaspike.modules:deltaspike-servlet-module-api'\n----\n\n=== 2. Configure Listeners and Filters\n\nIn most cases there is no need for any additional configuration beside\nadding the required dependencies to your project, because all required\nlisteners and filters are automatically registered in the container.\n\nHowever there are certain situations in which you will have to manually\nregister the listeners and filters in your `web.xml`:\n\n* Your container does not support Servlet 3.0 or newer.\n* You have set `metadata-complete=true` in your `web.xml`.\n* You packaged the servlet module in the `lib` directory of an EAR archive.\n\nIn these cases you will have to add the following section manually to the project `web.xml`:\n\n[source,xml]\n-------------------------------------------------------------------------------------------------------------\n<listener>\n    <display-name>EventBridgeContextListener</display-name>\n    <listener-class>org.apache.deltaspike.servlet.impl.event.EventBridgeContextListener</listener-class>\n</listener>\n\n<listener>\n    <display-name>EventBridgeSessionListener</display-name>\n    <listener-class>org.apache.deltaspike.servlet.impl.event.EventBridgeSessionListener</listener-class>\n</listener>\n\n<listener>\n    <display-name>ServletContextHolderListener</display-name>\n    <listener-class>org.apache.deltaspike.servlet.impl.produce.ServletContextHolderListener</listener-class>\n</listener>\n\n<listener>\n    <display-name>RequestResponseHolderListener</display-name>\n    <listener-class>org.apache.deltaspike.servlet.impl.produce.RequestResponseHolderListener</listener-class>\n</listener>\n\n<filter>\n    <display-name>RequestResponseHolderFilter</display-name>\n    <filter-name>RequestResponseHolderFilter</filter-name>\n    <filter-class>org.apache.deltaspike.servlet.impl.produce.RequestResponseHolderFilter</filter-class>\n</filter>\n<filter-mapping>\n    <filter-name>RequestResponseHolderFilter</filter-name>\n    <url-pattern>/*</url-pattern>\n</filter-mapping>\n\n<filter>\n    <display-name>EventBridgeFilter</display-name>\n    <filter-name>EventBridgeFilter</filter-name>\n    <filter-class>org.apache.deltaspike.servlet.impl.event.EventBridgeFilter</filter-class>\n</filter>\n<filter-mapping>\n    <filter-name>EventBridgeFilter</filter-name>\n    <url-pattern>/*</url-pattern>\n</filter-mapping>\n-------------------------------------------------------------------------------------------------------------\n\n== Injectable Servlet Objects\n\nThe DeltaSpike Servlet module contains producers for many objects of a\nServlet environment. All produces are using the special qualifier\n`@DeltaSpike` for compatibility with CDI 1.1, which supports the\ninjection of some Servlet objects out of the box.\n\nThe following code shows the general injection pattern to use for all objects.\n\n[source,java]\n------------------------------------\n@Inject @DeltaSpike\nprivate ServletObject servletObject;\n------------------------------------\n\n=== ServletContext\n\nThe `ServletContext` is made available in the application scope. It can\nbe injected into any CDI bean like this:\n\n[source,java]\n--------------------------------------\n@Inject @DeltaSpike\nprivate ServletContext servletContext;\n--------------------------------------\n\n=== ServletRequest / HttpServletRequest\n\nThe `ServletRequest` is made available in the request scope. The current\nrequest can be injected into a CDI bean like this:\n\n[source,java]\n-------------------------------\n@Inject @DeltaSpike\nprivate ServletRequest request;\n-------------------------------\n\nIn case of HTTP requests you can also inject the `HttpServletRequest`:\n\n[source,java]\n-----------------------------------\n@Inject @DeltaSpike\nprivate HttpServletRequest request;\n-----------------------------------\n\n\n=== ServletResponse / HttpServletResponse\n\nThe `ServletResponse` is made available in the request scope. The\ncurrent response can be injected into a CDI bean like this:\n\n[source,java]\n---------------------------------\n@Inject @DeltaSpike\nprivate ServletResponse response;\n---------------------------------\n\nIn case of HTTP requests you can also inject the `HttpServletResponse`:\n\n[source,java]\n-------------------------------------\n@Inject @DeltaSpike\nprivate HttpServletResponse response;\n-------------------------------------\n\n=== HttpSession\n\nThe `HttpSession` is made available in the session scope. You can inject\nthe current session of a user into a CDI bean like this:\n\n[source,java]\n----------------------------\n@Inject @DeltaSpike\nprivate HttpSession session;\n----------------------------\n\nPlease note that injecting the session this way will force the creation\nof a session.\n\n=== Principal\n\nThe `Principal` is made available in the request scope. The current\nprincipal can be injected into a CDI bean like this:\n\n[source,java]\n----------------------------\n@Inject @DeltaSpike\nprivate Principal principal;\n----------------------------\n\nThe `Principal` is obtained by calling `getUserPrincipal()` on the\n`HttpServletRequest`.\n\n== Servlet Event Propagation\n\nThe DeltaSpike Servlet module propagates a number of Servlet object\nlifecycle events to the CDI event bus. This allows regular CDI beans to\nobserve these events and react accordingly.\n\nIn most cases the event type is the object whose lifecycle is observed.\nTo distinguish between construction and destruction of the corresponding\nobject, DeltaSpike uses the qualifiers `@Initialized` and `@Destroyed`.\n\nThe following sections shows which concrete Servlet objects are\nsupported and how their lifecycle can be observed.\n\n=== Servlet Context Lifecycle Events\n\nThe Servlet module supports initialization and destruction events for\nthe `ServletContext`. These events can for example be used to detect\napplication startup or shutdown. The following code shows how these\nevents can be observed:\n\n[source,java]\n-----------------------------------------------------------------------------------------\npublic void onCreate(@Observes @Initialized ServletContext context) {\n    System.out.println(\"Initialized ServletContext: \" + context.getServletContextName());\n}\n\npublic void onDestroy(@Observes @Destroyed ServletContext context) {\n    System.out.println(\"Destroyed ServletContext: \" + context.getServletContextName());\n}\n-----------------------------------------------------------------------------------------\n\nThe events are emitted from a `ServletContextListener` called\n`EventBridgeContextListener`. You can disable lifecycle events for the\n`ServletContext` by deactivating the following class:\n\n[source,java]\n-------------------------------------------------------------------\norg.apache.deltaspike.servlet.impl.event.EventBridgeContextListener\n-------------------------------------------------------------------\n\nIf you manually registered the required filters and listeners, you can\nalso simply remove the entry for the `EventBridgeContextListener` from\nyour `web.xml` to disable the events.\n\n=== Request and Response Lifecycle Events\n\nThe Servlet module also supports initialization and destruction events\nfor the `HttpServletRequest` and `HttpServletResponse`. These events can\nfor example be used for initialization work like invoking\n`setCharacterEncoding` on the request.\n\nThe following example shows how to observe lifecycle events for the\nrequest:\n\n[source,java]\n--------------------------------------------------------------------------------------\npublic void onCreate(@Observes @Initialized HttpServletRequest request) {\n    System.out.println(\"Starting to process request for: \" + request.getRequestURI());\n}\n\npublic void onDestroy(@Observes @Destroyed HttpServletRequest request) {\n    System.out.println(\"Finished processing request for: \" + request.getRequestURI());\n}\n--------------------------------------------------------------------------------------\n\nObserving lifecycle events for the response works the same way:\n\n[source,java]\n---------------------------------------------------------------------------\npublic void onCreate(@Observes @Initialized HttpServletResponse response) {\n    System.out.println(\"HttpServletResponse created\");\n}\n\npublic void onDestroy(@Observes @Destroyed HttpServletResponse response) {\n    System.out.println(\"HttpServletResponse destroyed\");\n}\n---------------------------------------------------------------------------\n\nAll events of this category are emitted from a servlet filter called\n`EventBridgeFilter`. If you want to disable events for this category,\njust use DeltaSpike's deactivation mechanism to deactivate the following\nclass:\n\n[source,java]\n----------------------------------------------------------\norg.apache.deltaspike.servlet.impl.event.EventBridgeFilter\n----------------------------------------------------------\n\nIf you manually registered the required filters and listeners you can\nalso simply remove the entry for the `EventBridgeFilter` from your\n`web.xml` to disable the events.\n\n=== Session Lifecycle Events\n\nThe last category of events supported by the DeltaSpike Servlet module\nare the lifecycle events for the user's HTTP session. The following\nexample shows how these events can be observed from a regular CDI bean.\n\n[source,java]\n------------------------------------------------------------------\npublic void onCreate(@Observes @Initialized HttpSession session) {\n    System.out.println(\"Session created: \" + session.getId());\n}\n\npublic void onDestroy(@Observes @Destroyed HttpSession session) {\n    System.out.println(\"Session destroyed: \" + session.getId());\n}\n------------------------------------------------------------------\n\nThe lifecycle events for the HTTP session are sent from a\n`HttpSessionListener` called `EventBridgeSessionListener`. To disable\nthis event category, deactivate the following class:\n\n[source,java]\n-------------------------------------------------------------------\norg.apache.deltaspike.servlet.impl.event.EventBridgeSessionListener\n-------------------------------------------------------------------\n\nIf you manually registered the required filters and listeners you can\nalso simply remove the entry for the `EventBridgeSessionListener` from\nyour `web.xml` to disable the events.\n"
  },
  {
    "path": "documentation/src/main/asciidoc/snapshots.adoc",
    "content": "= Use DeltaSpike Snapshots\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nIf you want to be at the bleeding edge, you can work with DeltaSpike snapshots. These are available from the Apache Snapshot Repository for use in Maven-based projects. To begin using them, you must configure Maven with the repository location and your projects with the snapshot version.\n\nWARNING: Snapshots provide previews of DeltaSpike during development. Snapshots are subject to change and may not yet include all expected features of the final release. Snapshots should not be used in production environments.\n\n== 1. Configure Maven to Use the Apache Snapshot Repository\nYou must add the Apache Snapshot Repository to your Maven configuration `settings.xml` file. This ensures Maven can find the repository when it searches for your project DeltaSpike dependencies.\n\n. Open your Maven configuration `settings.xml` file for editing\n. Add the Apache Snapshot Repository to the list of repositories\n+\n[source,xml]\n----\n<repositories>\n    <repository>\n        <id>apache-snapshot-repository</id>\n        <url>http://repository.apache.org/snapshots/</url>\n        <releases>\n            <enabled>false</enabled>\n        </releases>\n        <snapshots>\n            <enabled>true</enabled>\n        </snapshots>\n    </repository>\n</repositories>\n----\n+\n. Save the `settings.xml` file changes\n\n\n== 2. Configure Your Project with the Snapshot Version\n\nWith Maven configured for the Apache Snapshot Repository, you can specify DeltaSpike snapshot versions in your Maven-based projects.\n\n. Open the project `pom.xml` file for editing\n. Add the DeltaSpike snapshot version to the list of properties\n+\n[source,xml,subs=\"+attributes\"]\n----\n<properties>\n    <deltaspike.version>{latestSnapshot}</deltaspike.version>\n</properties>\n----\n+\n. Save the `pom.xml` file changes"
  },
  {
    "path": "documentation/src/main/asciidoc/spi.adoc",
    "content": "= DeltaSpike Service Provider Interface (SPI)\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nDeltaSpike provides an Service Provider Interface (SPI) to enable you to extend it.\n\n== Deactivatable\n\nThis mechanism is only used for artifacts *like* implementations of (`jakarta.enterprise.inject.spi.Extension`) which\n*can not* be deactivated with standard CDI mechanisms.\n\nThis interface is just a marker interface which is implemented by all pre-configured DeltaSpike artifacts which can be deactivated manually (e.g. to improve the performance if a part isis not needed, to provide a custom implementation if the default implementation isis not pluggable by default or to bypass an implementation which causes an issue (in this case please also *contact us* and we will fix it)).\n\nTo deactivate a class it is required to implement `ClassDeactivator`. Returning 'false' or 'true' allows to\nde-/activate the class in question. Retuning null means that the current class-deactivator does not have\ninformation about the class in question and can not provide a result. Since `ClassDeactivator` implementations are\nconfigured with the low-level configuration of DeltaSpike, the class-deactivator with the highest ordinal has the final decision. DeltaSpike itself does not deactivate an implementation, however, an add-on or a third-party portable CDI extension based on DeltaSpike (Core+) can use the concept to deactivate a default implementation of DeltaSpike in favour of its own implementation.\n\nIMPORTANT: Due to the ordinal feature of the low-level configuration approach it is possible that a class-deactivator with a higher ordinal, for example used in a concrete project, can re-activate a deactivated implementation.\n\n*Please note* that you might have to deactivate the parts of the add-on or third-party CDI extension which relies on its own implementation. Therefore, you should **be really careful with re-activation**.) The implementation should be stateless because the result will be cached and\nas soon as everything is initialized the class-deactivators will not be used any longer.\n\n=== ClassDeactivator\n\nA class-deactivator allows to specify deactivated classes.\n\n[source,java]\n----------------------------------------------------------------------------\n//This class needs to be configured via one of the supported configuration sources!\npublic class CustomClassDeactivator implements ClassDeactivator\n{\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass)\n    {\n        if (targetClass.equals(MyClass.class))\n        {\n            return Boolean.FALSE;\n        }\n        return null; //no result for the given class\n    }\n}\n----------------------------------------------------------------------------\n\nA class-deactivator will be resolved from the environment via the default resolvers or via a custom resolver which allows to use any type of configuration-format. (see `org.apache.deltaspike.core.api.config.ConfigResolver`). The key is the fully qualified name of the interface (`org.apache.deltaspike.core.spi.activation.ClassDeactivator`).\n\nStarting with (TBD v1.5.1), Apache DeltaSpike ships a default Class Deactivator.  It is designed mostly for testing purposes, but is meant to reduce code overhead\nand allow configuration to drive classes to deactivate.  It is built upon the `ConfigSource` paradigm, which allows for configuration based keys to deactivate your\nclasses.  If you're not using any other ConfigSource, you can simply add entries to `META-INF/apache-deltaspike.properties` to disable classes at runtime.  Here's an\nexample configuration\n\n[source]\n----------------------------------------------------------------------------\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.core.impl.activation.DefaultClassDeactivator\ndeactivate.org.apache.deltaspike.test.core.impl.activation.DeactivatedClass=true\n----------------------------------------------------------------------------\n\nBy listing the class in the properties file and setting the value to `true`, the class will be deactivated.  This is valid for anything where `Boolean.valueOf` returns true.\n\n== ConfigSource\n\n[TODO]\n\n=== ConfigSourceProvider\n\n[TODO]\n\n=== BaseConfigPropertyProducer\n\n[TODO]\n\n\n== InterceptorStrategy\n\n\n[TODO]\n\n== Global Alternative\n\nThere are several application servers (using CDI 1.0) which can not handle alternative CDI beans correctly (e.g. due to\na too strict interpretation or a broken implementation). Therefore, DeltaSpike allows to use the standard `@Alternative` annotation and an additional configuration entry for DeltaSpike which allows to use the alternative implementation as a global alternative.\n\n.Standard CDI alternative implementation (without the required XML config)\n[source,java]\n----\npublic class CustomBean\n{\n}\n\n@Alternative\n//...\npublic class AlternativeCustomBean extends CustomBean\n{\n}\n----\n\nInstead of configuring the alternative in the beans.xml, a global alternative needs to be configured in /META-INF/apache-deltaspike.properties. CDI 1.1 should fix this issue and migrating to it means to remove the configuration entry for DeltaSpike again and move to the standard CDI configuration approach.\n\n[source]\n----\ncustom.CustomBean=custom.AlternativeCustomBean\n----\n"
  },
  {
    "path": "documentation/src/main/asciidoc/test-control.adoc",
    "content": ":moduledeps: core, container-control\n:moduleconf: api:org.apache.deltaspike.testcontrol.api.junit.TestBaseConfig, impl:org.apache.deltaspike.testcontrol.impl.jsf.MyFacesTestBaseConfig\n\n= Test-Control Module\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Overview\nThe Test-Control module enables you to write CDI-based tests easily. Calls to stop and start the CDI container are built into the Test-Control API, with simplified commands for customizing the management of contexts and other aspects during testing.\n\n== Project Setup\nThe configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.\n\n=== 1. Declare Test-Control Module Dependencies\nAdd the Test-Control module to the list of dependencies in the project `pom.xml` file using this code snippet:\n\n[source,xml]\n----\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-test-control-module-api</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>test</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.deltaspike.modules</groupId>\n    <artifactId>deltaspike-test-control-module-impl</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>test</scope>\n</dependency>\n----\n\nOr if you're using Gradle, add these dependencies to your `build.gradle`:\n\n[source]\n----\n     testCompile 'org.apache.deltaspike.modules:deltaspike-test-control-module-impl'\n     testRuntime 'org.apache.deltaspike.modules:deltaspike-test-control-module-api'\n----\n\n=== 2. Declare CDI-implementation-specific dependencies\n\nThe Test-Control module depends on the Container-Control module, which provides adapters for several major CDI implementations. Therefore, to use Test-Control, declare dependency on a CDI implementation and a corresponding Container Control implementation in the `pom.xml`.\n\n==== OpenWebBeans\n\nIf you are using OpenWebBeans, add an OpenWebBeans implementation and the OpenWebBeans-specific Container Control module to the list of dependencies:\n\n[source,xml]\n-----------------------------------------------------\n <dependency>\n     <groupId>org.apache.deltaspike.cdictrl</groupId>\n     <artifactId>deltaspike-cdictrl-owb</artifactId>\n     <version>${deltaspike.version}</version>\n     <scope>test</scope>\n </dependency>\n\n<dependency>\n    <groupId>org.apache.openwebbeans</groupId>\n    <artifactId>openwebbeans-impl</artifactId>\n    <version>${owb.version}</version>\n    <scope>test</scope>\n</dependency>\n-----------------------------------------------------\n\n==== Weld\n\nIf you are using Weld, add a Weld implementation and the Weld-specific Container Control module to the list of dependencies:\n\n[source,xml]\n----------------------------------------------------\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-weld</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>test</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.jboss.weld.se</groupId>\n    <artifactId>weld-se-core</artifactId>\n    <version>${weld.version}</version>\n    <scope>test</scope>\n</dependency>\n----------------------------------------------------\n\n==== OpenEJB\n\nIf you are using OpenWebBeans as the CDI implementation and you need to test\nEJBs as well, add the OpenEJB-specific Container Control module to the list \nof dependencies instead of the OpenWebBeans-specific Container Control module:\n\n[source,xml]\n----------------------------------------------------\n<dependency>\n    <groupId>org.apache.deltaspike.cdictrl</groupId>\n    <artifactId>deltaspike-cdictrl-openejb</artifactId>\n    <version>${deltaspike.version}</version>\n    <scope>test</scope>\n</dependency>\n\n<dependency>\n    <groupId>org.apache.openejb</groupId>\n    <artifactId>openejb-core</artifactId>\n    <version>${openejb.version}</version>\n    <scope>test</scope>\n</dependency>\n----------------------------------------------------\n\n=== 3. Complete Additional Project Configuration\n\nAdd a `beans.xml` file in the project test module (e.g. src/test/resources/META-INF/beans.xml).\n\n== Automated Container Booting and Shutdown\n\n=== CdiTestRunner\n\nStart and stop the CDI container automatically per test class with CdiTestRunner, a JUnit Test-Runner. \nThis also starts and stops one request and session per test-method.\n\n.Example of CdiTestRunner Usage\n[source,java]\n--------------------------------------------------------\n@RunWith(CdiTestRunner.class)\npublic class ContainerAndInjectionControl\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @Inject\n    private SessionScopedBean sessionScopedBean;\n\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    //test the injected beans\n}\n--------------------------------------------------------\n\n=== CdiTestSuiteRunner\n\nExtend automated CDI container start and stop actions to whole test suites with CdiTestSuiteRunner, a JUnit Test-Suite-Runner.\n\n.Example of CdiTestSuiteRunner Usage\n[source,java]\n---------------------------------------\n@RunWith(CdiTestSuiteRunner.class)\n@Suite.SuiteClasses({\n    TestX.class,\n    TestY.class\n})\npublic class SuiteLevelContainerControl\n{\n}\n---------------------------------------\n\n=== Optional Shutdown Configuration\n\nYou can set `deltaspike.testcontrol.stop_container` to `false` (via the standard DeltaSpike config), resulting in the CDI Container being started just once for all tests.\n\n== Test Customization\n\n=== @TestControl\n\nCustomize the default behavior of CdiTestRunner with @TestControl. In the following\ncase only one session for all test-methods (of the test-class) will be\ncreated.\n\n.Example of @TestControl Usage\n[source,java]\n-----------------------------------------------\n@RunWith(CdiTestRunner.class)\n@TestControl(startScopes = SessionScoped.class)\npublic class CustomizedScopeHandling\n{\n    //inject beans and test them\n}\n-----------------------------------------------\n\n=== ProjectStage Control\n\nOverride the default ProjectStage for unit tests with `ProjectStage.UnitTest.class`.\n\n.Example of projectStage Usage\n[source,java]\n---------------------------------------------------------------\n@RunWith(CdiTestRunner.class)\n@TestControl(projectStage = CustomTestStage.class)\npublic class TestStageControl\n{\n    //tests here will see ProjectStage CustomTestStage.class\n\n    @Test\n    @TestControl(projectStage = ProjectStage.Development.class)\n    public void checkDevEnv()\n    {\n    }\n\n    //tests here will see ProjectStage CustomTestStage.class\n}\n---------------------------------------------------------------\n\n== Optional Configuration\n\nFrom DeltaSpike 1.2, it is possible to provide a configuration for the underlying test-container.\nHowever, currently only the adapter for OpenEJB embedded (available in CDI-Control) supports it out-of-the-box.\nTo pass properties to the underlying test-container,\nyou have to add `/META-INF/apache-deltaspike_test-container.properties`\nto the resources-directory of your test-classpath.\nThe content of the file are key/value pairs which get passed to the container.\nTherefore, it is a configuration which is not used by DeltaSpike itself\n(it is just forwarded (as it is) to the underlying test-container).\n\n=== Reconfigure the config-file Name or Location\n\nIf you would like to point to an existing config-file, you have to add for example:\n\n[source,Properties]\n---------------------------------------------------------------\ndeltaspike.testcontrol.test-container.config-file=META-INF/existingConfig.properties\n---------------------------------------------------------------\n\nto `/META-INF/apache-deltaspike.properties`.\n\nIf you would like to do it per ProjectStage, you can use for example:\n\n[source,Properties]\n---------------------------------------------------------------\ndeltaspike.testcontrol.test-container.config-file.UnitTest=META-INF/unit-test/existingConfig.properties\n---------------------------------------------------------------\n\n\n== Optional Integrations\n\n=== Mock Frameworks\n\nFrom DeltaSpike 1.0, it is possible to mock CDI-Beans. Usually @Exclude (+\nProjectStage) is enough, however, for some cases mocked beans might be\neasier. Therefore it is possible to create (mock-)instances manually or\nvia a mocking framework and add them, for example, via `DynamicMockManager`.\n\n**Attention:** Mocking CDI beans is not supported for every feature of CDI and/or\nevery implementation version. For example, we can not mock intercepted CDI beans and\nwith some implementations mocking specialized beans fails.\nUsually all features are active by default, however,\ndue to those reasons we deactivated this feature by default.\nYou can enable it by adding\n\n`deltaspike.testcontrol.mock-support.allow_mocked_beans=true`\nand/or\n`deltaspike.testcontrol.mock-support.allow_mocked_producers=true`\n\nto `/META-INF/apache-deltaspike.properties` in your test-folder.\n\nIf you need dependency-injection in the mocked instances, you can use\n`BeanProvider.injectFields(myMockedBean);`.\n\n[source,java]\n-------------------------------------------------------------\n@RunWith(CdiTestRunner.class)\npublic class MockedRequestScopedBeanTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMock()\n    {\n        mockManager.addMock(new RequestScopedBean() {\n            @Override\n            public int getCount()\n            {\n                return 7;\n            }\n        });\n\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(7, requestScopedBean.getCount());\n    }\n}\n\n@RequestScoped\npublic class RequestScopedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n-------------------------------------------------------------\n\nUsing a mocking framework makes no difference for adding the mock.\n\n.Example via Mockito\n[source,java]\n----------------------------------------------------------------------------------\n@RunWith(CdiTestRunner.class)\npublic class MockitoMockedRequestScopedBeanTest\n{\n    @Inject\n    private RequestScopedBean requestScopedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void mockitoMockAsCdiBean()\n    {\n        RequestScopedBean mockedRequestScopedBean = mock(RequestScopedBean.class);\n        when(mockedRequestScopedBean.getCount()).thenReturn(7);\n        mockManager.addMock(mockedRequestScopedBean);\n\n        Assert.assertEquals(7, requestScopedBean.getCount());\n        requestScopedBean.increaseCount();\n        Assert.assertEquals(7, requestScopedBean.getCount());\n    }\n}\n----------------------------------------------------------------------------------\n\nSince CDI implementations like OpenWebBeans use a lot of optimizations,\nit is required to handle mocks for application-scoped beans differently, for example:\n\n[source,java]\n--------------------------------------------------------------------------------------------------------------------------\n@RunWith(CdiTestRunner.class)\npublic class MockedApplicationScopedBeanTest\n{\n    @Inject\n    private ApplicationScopedBean applicationScopedBean;\n\n    @BeforeClass\n    public static void init()\n    {\n        ApplicationMockManager applicationMockManager = BeanProvider.getContextualReference(ApplicationMockManager.class);\n        applicationMockManager.addMock(new MockedApplicationScopedBean());\n    }\n\n    @Test\n    public void manualMock()\n    {\n        Assert.assertEquals(14, applicationScopedBean.getCount());\n        applicationScopedBean.increaseCount();\n        Assert.assertEquals(14, applicationScopedBean.getCount());\n    }\n}\n\n@ApplicationScoped\npublic class ApplicationScopedBean\n{\n    private int count = 0;\n\n    public int getCount()\n    {\n        return count;\n    }\n\n    public void increaseCount()\n    {\n        this.count++;\n    }\n}\n\n@Typed() //exclude it for the cdi type-check\npublic class MockedApplicationScopedBean extends ApplicationScopedBean\n{\n    @Override\n    public int getCount()\n    {\n        return 14;\n    }\n}\n--------------------------------------------------------------------------------------------------------------------------\n\nHowever, `ApplicationMockManager` can be used for adding all mocks, if\nthey should be active for the lifetime of the CDI-container.\n\nIt is also possible to mock qualified beans. Just add the\nliteral-instance(s) as additional parameter(s), for example:\n\n[source,java]\n-------------------------------------------------------------\n@RunWith(CdiTestRunner.class)\npublic class MockedQualifiedBeanTest\n{\n    @Inject\n    @MyQualifier\n    private QualifiedBean qualifiedBean;\n\n    @Inject\n    private DynamicMockManager mockManager;\n\n    @Test\n    public void manualMockWithQualifier()\n    {\n        mockManager.addMock(new QualifiedBean() {\n            @Override\n            public int getCount()\n            {\n                return 21;\n            }\n        }, AnnotationInstanceProvider.of(MyQualifier.class));\n\n        Assert.assertEquals(21, qualifiedBean.getCount());\n        qualifiedBean.increaseCount();\n        Assert.assertEquals(21, qualifiedBean.getCount());\n    }\n}\n-------------------------------------------------------------\n\nIn some cases it is necessary to use `@jakarta.enterprise.inject.Typed`.\nMocking such typed beans can result in an\n`AmbiguousResolutionException`. Therefore it is necessary to exclude the\nmocked implementation via `@Exclude` or `@Typed()` (or a parametrized\nconstructor) and specify the target-type via `@TypedMock`.\n\n=== JSF (via MyFaces-Test)\n\nadd one of\n\n* org.apache.deltaspike.testcontrol.impl.jsf.MockedJsf2TestContainer\n* org.apache.deltaspike.testcontrol.impl.jsf.MockedJsfTestContainerAdapter\n* org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerAdapter\n* org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerPerTestMethodAdapter\n\nas content to\n\n`/META-INF/services/org.apache.deltaspike.testcontrol.spi.ExternalContainer`\n\n(in your config-folder for tests, e.g. test/resources)\n\n== Using jersey-test with test-control\n\nJersey-test starts jetty which answers requests in a separated thread. Since ds test-control just handles the thread of the test itself, it's needed to integrate jetty and jersey with the cdi-container. Usually that's done via a ServletRequestListener - the following part describes an alternative approach for jersey-test:\n\n[source,java]\n-------------------------------------------------------------------------------------------\n//use: -Djersey.config.test.container.factory=custom.CdiAwareJettyTestContainerFactory\n\n@RunWith(CdiTestRunner.class)\npublic class SimpleCdiAndJaxRsTest extends JerseyTest\n{\n  //...\n}\n-------------------------------------------------------------------------------------------\nor\n[source,java]\n-------------------------------------------------------------------------------------------\npublic class CdiAwareJerseyTest extends JerseyTest\n{\n    static\n    {\n        System.setProperty(\"jersey.config.test.container.factory\", CdiAwareJettyTestContainerFactory.class.getName());\n    }\n}\n\n@RunWith(CdiTestRunner.class)\npublic class SimpleCdiAndJaxRsTest extends CdiAwareJerseyTest\n{\n    //...\n}\n-------------------------------------------------------------------------------------------\n[source,java]\n-------------------------------------------------------------------------------------------\npublic class CdiAwareJettyTestContainerFactory implements TestContainerFactory\n{\n    @Override\n    public TestContainer create(final URI baseUri, final DeploymentContext context) throws IllegalArgumentException\n    {\n        return new CdiAwareJettyTestContainer(baseUri, context);\n    }\n}\n-------------------------------------------------------------------------------------------\n\nCdiAwareJettyTestContainer is a copy of JettyTestContainerFactory.JettyTestContainer but with\n\n[source,java]\n-------------------------------------------------------------------------------------------\nHandlerWrapper cdiHandlerWrapper = new CdiAwareHandlerWrapper();\ncdiHandlerWrapper.setHandler(this.server.getHandler());\nthis.server.setHandler(cdiHandlerWrapper);\n-------------------------------------------------------------------------------------------\nafter the line with JettyHttpContainerFactory#createServer\n[source,java]\n-------------------------------------------------------------------------------------------\n//activate the request-context e.g. via:\npublic class CdiAwareHandlerWrapper extends HandlerWrapper\n{\n    @Override\n    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException\n    {\n        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();\n\n        try\n        {\n            cdiContainer.getContextControl().startContext(RequestScoped.class);\n            super.handle(target, baseRequest, request, response);\n        }\n        finally\n        {\n            cdiContainer.getContextControl().stopContext(RequestScoped.class);\n        }\n    }\n}\n-------------------------------------------------------------------------------------------\n\n== Mixed Tests\n\nUsually you should have one kind of tests per test-module. However, if\nyou need to add, for example, a test without an external-container to your\ntest-module which uses external-containers, you can annotate your test\nwith:\n\n[source,java]\n---------------------------------------------\n@RunWith(CdiTestRunner.class)\n@TestControl(startExternalContainers = false)\npublic class JsfContainerTest\n{\n    //...\n}\n---------------------------------------------\n\n\n== Known Restrictions\n\n=== Liquibase\n\nLiquibase invokes `#toString` in a `AfterDeploymentValidation` observer.\n*that is not portable* and therefore you have to deactivate the\nmocking-support via:\n\n[source,java]\n----------------------------------------------------------------------------------------------------------\npublic class LiquibaseAwareClassDeactivator implements ClassDeactivator {\n    @Override\n    public Boolean isActivated(Class<? extends Deactivatable> targetClass) {\n        return !\"org.apache.deltaspike.testcontrol.impl.mock.MockExtension\".equals(targetClass.getName());\n    }\n}\n----------------------------------------------------------------------------------------------------------\n\nand add `LiquibaseAwareClassDeactivator` to `/META-INF/apache-deltaspike.properties`, for example:\n\n---------------------------------------------------------------------------------------------------\norg.apache.deltaspike.core.spi.activation.ClassDeactivator=myPackage.LiquibaseAwareClassDeactivator\n---------------------------------------------------------------------------------------------------\n\nFurther details are available at deactivatable.\n\n=== Gradle\n\nGradle by default does not put resources and compiled sources in to the same directory.\nWhen running a test using Gradle, this means your classes will not be in bean archives as\ndefined by the CDI spec.  To work around this, you need to set your main and test directories\nfor resources to point to where the compiled code lives.  This is an example of how to do that:\n\n[source,groovy]\n----------------------------------------------------------------------------------------------------------\nsourceSets {\n    main {\n        output.resourcesDir = output.classesDir\n    }\n    test {\n        output.resourcesDir = output.classesDir\n    }\n}\n\n// ensure you're excluding duplicates\n\njar {\n    duplicatesStrategy = 'exclude'\n}\n----------------------------------------------------------------------------------------------------------\n\n== SPI\n\n=== MockFilter\n\nPlease make sure that you are aware of <<__MockFrameworks, Integration of Mock Frameworks>> before you continue with this section.\n\nIf you would like to exclude some parts of your application- and/or test-code\nso that they aren’t eligible for the mocking mechanism,\nyou can provide an own implementation of `org.apache.deltaspike.testcontrol.spi.mock.MockFilter` and\nregister it in `/META-INF/services/org.apache.deltaspike.testcontrol.spi.mock.MockFilter`.\n\nThat's quite special and you need to know the CDI-SPI a bit.\nTo get an idea about the required steps, you can have a look at the default implementation used by DeltaSpike-Test itself.\n\nSuch a filter is also needed in case you would like to customize DeltaSpike-Test.\nFor example to provide an `@Alternative` implementation for DynamicMockManager,\nyou need to implement `org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager`, annotate it with `@Alternative`,\nensure that you keep the type-information with `@Typed`,\nconfigure the alternative bean in `/META-INF/beans.xml` (in the test-classpath) and\nprovide a custom `MockFilter` (as described above) which excludes the custom mock-manager.\n(Otherwise DeltaSpike-Test will try to mock the custom mock-manager.)\n\n=== ExternalContainer\n\norg.apache.deltaspike.testcontrol.spi.ExternalContainer allows to\nintegrate containers which get started after the CDI container.\nCurrently DeltaSpike provides:\n\n* MockedJsf2TestContainer (integration with MyFaces-Test)\n\n[TODO]\n"
  },
  {
    "path": "keys/KEYS",
    "content": "Gerhard Petracek <gpetracek@apache.org>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.9 (GNU/Linux)\n\nmQGiBEkxsLERBACCYmhzgYx9Sp9ZrVWFl8kvFO9kitMltQGMzrpuYHSlW23hyzZa\nDSDvSqcML2cDeghtN9aFbRtSTrioOywsf7Egsykxjs1zV4HrUzwHsKdw2bFvdpLx\nDwthrml8dNCezRe2HM2OSjatWhfHWbKwNFR2ueGSdNFematpktzD4W//EwCggSl6\nP1o95XZod+ZsaLGY+wm+GesD/R/OQQ55ODTDjXwiHH+473WIUy56gC2zw9N3lLFL\nygFkGpZX1RV65InEt1oecShae2gD6LrDbmrb8baZPc0dKwzc1zt+urHzhTxKEpDp\np6WxE/SXJdh4tj3Zr2JU6Qmf98Q0TTupCdRNgn37pGZyWcgrdsMWoVasM/gF9Ofv\nImfDA/93Lz07Jx0tam4GGXJWcNOjyq0ir4ACZ4GztMqNPIXgaPwwml5anoAS8QoN\n+EVWm//rVbnZSgPEVdWE/GKIsR2bI28IB7/Qh6ZqDWvVzomxh5bki5SeXFoDBP1g\nZ074iIK6aDNDIINVWTa+9a4a7ie13nj3yKshcZw+B0ys1fhwTLQnR2VyaGFyZCBQ\nZXRyYWNlayA8Z3BldHJhY2VrQGFwYWNoZS5vcmc+iGAEExECACAFAkkxsLECGwMG\nCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRASw1tHbjtaJmQjAJ9qbQTWtGIgovks\nQNc71ast1utlcgCfXrCwDRj/nojmkodu9DNGBS2nwWS5Ag0ESTGwsRAIAJc8UzwN\nu1rAIgbGZhehqtnIiU1Rd4Xy0I4rp9/CieiAR8EUyQ1vUU+aiXJWkDaR0Epjmo8G\nZg/B8T3dCfUBsFsRCR1ineawldsblb7BEjpy1DRByXBBIRke3z5LdvC22jP4HGw5\nYnrLZp26KBp22UDLPaqh4/a90KofwaVeNRfONQrHhusZQkoqCwohOlbHMVL7cYbZ\nj44T+DKeufq1a4qBC89uSW266WH7yHS0EPIOQf9GK0TfL17Y2JfMVzyjbSm4ueCO\nYp5Ot9dNlnJD8EeAzF/9xSDbG8s8EAQVt+cqpp9eK0z5d2Dv49pQHDMVmXgpMWOF\n7Rk2CEEWFyJAaWMAAwYIAJGog3bEz63LG2wnyi44r7RPuhg7SgmcTcjY42r8cS2N\ndgC0mmnd1fePnwJ+G8QBHsmrMH63JbaDYZsrGyh5CZetCWkzvpMF39l/Kou60X+a\nUCqxPb4tXd27zpf7h3D0NHEjI4V0W5fnwOjM6x0lmi0QWR8RBUVgdYC5K0/MSqKk\nZ75K0SLGb8V40DUD0v0hWCvdac0jVfnfuiZBh5VOQNKKTdibnbCX3sxYfrT9DRpN\n5SP9LZwTn8ELqGD4ETeO7wxS8LKyhOhEIeww66faj4Q8kb/4pPZeNH2CqI/aDbIU\nHLVML1V3+/RVrVbYEqRQex+pRH4ODmxvAsrq8leMZbeISQQYEQIACQUCSTGwsQIb\nDAAKCRASw1tHbjtaJrCtAJ9ea/IEAqj/baD493ZBSHaIZyra2gCfcRfH73p3rT9r\ntfGU4oK1mYYUs9M=\n=Q7EV\n-----END PGP PUBLIC KEY BLOCK-----\n\nAntoine Sabot-Durand <antoinesd@apache.org>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.11 (Darwin)\nComment: GPGTools - http://gpgtools.org\n\nmQINBE70fBIBEAC6guBx2XpxRR5mafxpaVcz7+KXDNtJoHay7t4tOR1NrMq2iEQR\ntccXQ4t+9ALD7TSMJDKQaE0L567nHhPs8+gRz5W6lj/zjYyEnMqNJoV7E7Ej7ynI\no+9IC7ixGMqHKjMr3bh1nGLARv+2XB2q9/GN3yvdQ/bmmVZDcP6nffo3RaHQxoGv\nj2eryQCcvUKDigtgFvepa9SysY3BDQcWkR9p8F3k7eUGy667Nl2TBE6B2PUuywra\nlhymMKHDbg7xHu1VLAkNBUmBUy2l0jQJ8jw4I6GKqG6zO//gmbVPcMgzqKAzkWGk\nPGUpNtL4Z/tLDuxHdB1PH86EYeIJdT5QDq+STBDJamRLFoaXIMiHFYA1iMf+vDC7\npgtSqQgeMNM4VJpyudmQzX9N8ZDB9q+IfFhTMlLbAR+I3lMIeNsLvmyBQsBACBSJ\nLVyR2UefVPV8rDoMcKU1Pzz2pDyCzo+H2ES81WxKZyxXGny35SxOj6FGeR8/aUj6\ntwYbXn5RNvdQ/Zi/yaoCq9bAVMvfZK/qIJ5RhOcujs4OamoygKumENxi5REjxy9E\nnJysNVB/YXUYNZK8u36wJKRjSjNTIXG6JIC6Wi8xEutrDOjZ4JqhImfZJLtAth9j\n55y6IGwaZ3I64uM3upJffsl9uDcDUqEimuxm7TEGbxqZ/+Cr8EPCtSTvJQARAQAB\ntCtBbnRvaW5lIFNhYm90LUR1cmFuZCA8YW50b2luZXNkQGFwYWNoZS5vcmc+iQI4\nBBMBAgAiBQJO9HwSAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDw4T/Q\nPFZg4kDYEACfx74r+fu4GJIx8lmcbiAjBEUPlaYyOOTj7vnz1IgaNUMi+69SJdsp\n4RUqaMPDNQW+zwXZ/ZtjN0kAxZUxbEhJBbLKhDteY7k0dfc6Y5IsnnXnfov6F//x\nLNx4NuOpyO7kuka781o0FiHuiD6Ja8Xu2Jd7MH2y+0P+Y8uIMJdXz4BTx1U2MdKq\nWBjBV9dzoTkQ6W1Iejk+jbS4lp8mXbMNxaz7M+Cp/5tc2eKjJIhziU0nDDsPzBh5\nuR2CbgMUPUERc49CyZUGftKGffsuo+e7dyCHOaH12B6/uy0ww60yxpPUR2jdTofx\ntBTXZcVa2UV9mX7AJm6IdkJwBFmzHQGbNzVQgY8A7XYyrK0+NXdM/B6zKjlER2xQ\nrA/McfH5ci0AWV1FFqmnSTStuau6v7RvHarH2xYsgN+5Dl2eqwXJtTGzd6uICa87\ntOqyfERbmrEVKldQjhSX8ky7k+6QcP7dKhn8+cSWimwN2H+Ofkd/NBTBVHIVx0Gv\n56X/yhLr4e+HJfyYZz+s5UbFXbTBTm3yPbX6jzFvBCHhfJS3ol97gsBDKjAOo/Nc\n4UFYbNMPLQ2uNWpVPEyMXETpftX75J7n8bhpdQH65an4jhRjVopr+gDpy+CDt6dE\nF3YevWmphfPtZju/Gy5JVqSOIo3Ilz7X6EF/JQSUDDMYaQvKlkyr7bkCDQRO9HwS\nARAAoPcAaS7speOOfFl06+MHkWRS8Os7LvIl/BcwZujQLVPwwlEFUIwSLdJ+qH1L\n8dhljQsDsyFA6rhZDivdg1R7P+kIkCemVzA6zeOi7U/x0i8L9+Abrpo9+qGEi7ip\nMqJ8GknCEmij3eVY9iBqHIQ7kHrNmUcqSSXizMkEAS5JFgq6bB7pbHe8bF6aOobq\n2aYyWkYD6QVY1sAAT8+jOlum/LjGLTFOrvmrun6WAPyk55S7qWuaq07biTDyVO9X\nf0qVwc3czO8ad5YJfhFt6QMPCdkjcDcLvURpkNYNZrbGT1Zgul+EKFPYH1Fzj0o7\nzQ+XwAANgNUMZD2vrfneQiUSW5NoC0Cx3EFZ2vWBtoE190D6DyaM3F2tekaAk8cy\nCquHhNZuWAg9Bu+qJxS+AeOjB2F02L7rA6+qr6QZzySCDFPZ6TOwPqocp3Xq+VhS\nNmCxLbaMyzN8JVPzODo1ZjzcVL0xKwdnQkjfiZTDBbyoMpK+NNKQQUmituB/cSsz\n3d3+prR4SKlyuRLRTZqN5In5SrmI++tpyBVA0KjW+LWGwj+zY3EFszCpGs/PkG/9\nks9icSXPmGRVfjGlK43bTouweHxT/PY1DBgfXSA/oT/WbEjXDurNaioKPKpo5vml\nOLNJVlnxhMcOo7PfAS80Zwr+84bqGEoaNvKza39pEiRalskAEQEAAYkCHwQYAQIA\nCQUCTvR8EgIbDAAKCRDw4T/QPFZg4pfOD/93xVhBSMZZ92nsZyhcrsK4/pKmkJFT\nVg2YN5SVsgI1fq8olSwZJgtYjc7/aj3nfDncctZ823OqlznpKm59Fm6C2i0xBEqQ\n/y3dxQq0G4VPP7DBA3nF4yvD4dewIRX5LOGM75Ec3m3e11BSTB3ldsJrBNxP370f\nC2ZL0nG+lcBxaBq/WwsmFiLNXrIS0abg7er6zMpyObte42IEkWOc1J3xgFm9Jall\n/6g9+A/b9ZWalE9oUnfzzR534g1/D2iZjQUkRFBE5GxXnhDS8AJdnHP8i5rOMl/W\nnwAe8OGBwV5kEYZ4dJM31Fe8rxuqFN+5DFttXdh5jYrRfXbfXvHYGPmxbU5iLVBv\neowcyhIOLHPiZ1jaWcUNwETspwlg2F0HeYY8gQHX5A7ongk9WtCIPBFOreCen3S/\nDrOgJo+LxhYTWgrjzrLcvHezg5+Ya7Mv8RGbinovgZiEuOYHMIsaQhV8HAif87Y0\n/eM4BjpNcabpFRFM4rYMvwcnAQLuPpzdrGv6wXXGW/hUsQ2nR0zdM6W7v0L0AxLg\nP3L01I087Y+HTq+UZeQnkdbptK27D3yD4laq5te8B0PBwQd0UuCHFm22WMymcuHo\nw3Yq+kSWaqHqTHJmSEO/drQgj1vuJyfYRZ4AR/meq/8IOHhIWkVd6a7G8uSm0QAr\nm+khrP/HMmvTjw==\n=PkH4\n-----END PGP PUBLIC KEY BLOCK-----\n\nJakob Korherr <jakobk@apache.org>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG/MacGPG2 v2.0.12 (Darwin)\n\nmQENBEx/uP4BCADc013HRON8aGS5nix4KbkyRGQejP/VAHSQ1sh6ooVcWMxJSL1G\n4c/lFhTNXZeFHmKbmPLJZ6tByvQJ+VLfUiRVZTyoMHYl/js6QFDDtUNZw8STZ1Kv\nW2BODUiqIUy8Z8rQfQFJg3Aj7Nnk7PMZlJwKjG3OiPwFn9bKTgwze/LanN8FuB4w\n7LNQNiaUZ7897sPntCkWoRt1/WoKiygrJwZQRFMw4Sbpa36j7yT4J/CzrDtmse+E\ncaITVFDppFuyiULyCIQ7jhztw3ZHQ3y0RgCFXSI0WPy8/gwqzu89ATtyYUm9aQne\n0gZdO/NmKo0BLd3G617N2bFQ5+UmLCxarBD/ABEBAAG0IUpha29iIEtvcmhlcnIg\nPGpha29ia0BhcGFjaGUub3JnPokBNgQTAQIAIAUCTH+4/gIbAwYLCQgHAwIEFQII\nAwQWAgMBAh4BAheAAAoJEJ3NMsPsezNww5sH/166RxHA3NirQyKCiCPprBcYaMV2\nAZ1tVMTM0TZIIM5Cxrd7jVHZjZkBU8wFP7Gk/Z5qkZifm3RxKMb/SR1CLyKwsdgg\ncAKsKszn6eh4XgtFgQQ+mTvIpuq3Cr6zSfPQNWpOQMocH/3Z8rcHsUfjH999add2\nI6UGH8G02EzWcolv2EugV4GvfhGMvqcuHrjL75n41522DQkrN98pa8SaYJYD4fle\nx/HGStzb2pBDnRSx02xu28t1jC+6Tei5vtJ/7qLKlhNGXNVy7N41uDvIbLuDMZIN\nEaJJ1nm+sdrbc4CT968u1b3tB1xUO1AvxRoLZrSKRGL5dWPvL/Oj6BXdrCG5AQ0E\nTH+4/gEIAJQ5QdSqM/Mp0lH/xGG57yAyuqAOb2uy+anZwfoJv1H4wl+hCy8/HmMa\nWeEFBYDjSPU/QlAwMQU2qIgALQCj8LPOpsJN9b9qwgM4aaFCT694Vepo4S2QPQLq\nR198crk3dj0XkvdS4Gu3o6CKbNA6OEk6MTi50Z01hE+04eU9x8Rci+h7lWcFUEvA\nVwIIUlgxCtj/6qqf6af1N43TOYX7NvM29qjRwMVndvy7cO1mMZSbD6HOZ/6sy+wC\nDLdEaVgFAaQjt5dXA4Kg0lkYMKkxw1gfwLKIkF8rZ+6JjFoMDJsjptkuujoKiG/F\nkt/cFjK9bvc7VW7p6FeFHU3ybe5puHcAEQEAAYkBHwQYAQIACQUCTH+4/gIbDAAK\nCRCdzTLD7HszcDRCCACbKxdhS60DntVTzHYNfrtnVRGlGPYCiCzgNE2udTG6TN13\nU0A1k2q/Z/xU3TpF7FrooYKIOYDMlBwXwYNOY/chQ++NPphTw0+tbzLgpKVooPYN\nmoAe8ayIDO3AzloM1q2lewAKzpzNW/e+Z/p6SYYhyIEGVvFare9fqJ0lDbpbyfrO\nPiMVkaH90xQatYcW0Xo9LaTb0s0akyTK/k+llCc1QPcpEGYC/LPK52R5mTor5gqi\nV2TbyonLUBvMv5pgT8ZouNs2tRRH1CMe7aE+SiiT4SyVfBlNaQcGqpWspIb6TWlO\nb4YGjoC1yob1dwdT3CQ3Gkf6kgI6xXaxBfcD0llb\n=VXV2\n-----END PGP PUBLIC KEY BLOCK-----\n\nJason Porter <lightguardjp@apache.org>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.13 (GNU/Linux)\n\nmQINBFFQxyUBEADb7PTRa43AUSqgZW9CPJ4FFJQ4C4PYOgHxba61+m+Rm/HtGZWI\npszDjyrhU/r4fmjTqg/LpwoyME0SjWFgLY5558RW3mJ5anB08MkSCId9nIhvzBqn\n7+CN1714iYwNu9gvJgfwmG+YelNseT1yxh5vMcyPxZjHRLxnXdWlZ6PzJLc77CEb\nQi6TM3CpPIEOSepjwicGuUzaQa0bEKt9GnQklWpgX3baRpY9ZQKC3es0S1mkCVHV\nIX7q/6cys2QChT2vZX7ROUh+P/4cQnvVTFEbJcn5uT0NHEtCbF/Ljh3Vkrcetkp8\n22QjAYNfugq2Jzsj5QQsFAzZWzvjqgwwCgoRNxkFbijPw8sa0itFiq0kOCK+Yewg\n6YgVyaHyrmB+eNxmS6smr3eEul6wQsh+wu2GZMLRJZqLDhN05qg4x6WLVgpm/P1F\nf7t+bmk1fkMzILAlDKR40qr6HBcAC+JcHPeyX9O/G97O0/NiCmUO8PRvv3ofLbLQ\nIC7Q8UOLw8NiPJhSQyxvv/RMsBgmzWu4750myTq3NwZJoOQsKZBHB4ydBjur8D4O\nMLojY7ag7LDxR3PfXa7Y1GmUrkwO84piU9N/3hS3nJm25IPPgW6QXSCTMwu6FQd8\neVgUEC9wi9jfry8G2e+4apz+wD15feThK4L4pPQeXcsjaWhPiqKt7nxGTwARAQAB\ntDdKYXNvbiBSb2JlcnQgUG9ydGVyIChuZXcga2V5KSA8bGlnaHRndWFyZC5qcEBn\nbWFpbC5jb20+iQI+BBMBAgAoBQJRUMclAhsDBQk4ZAkABgsJCAcDAgYVCAIJCgsE\nFgIDAQIeAQIXgAAKCRC+38+zD7ctEYHXEAC/2hz6twVDJvCLWOfIIQH52JbQky5k\nW2XdAZmVGoMO7lCJqOCdxvGXix5PPEJ8pm+gvYpCwg7+TnUjYx6g+DB5F5DUUnMp\njTnOPYApLxpfAFmBzkoi536w6PcbOkWZkg+JYXPLRyul4M9NuNLi5VwuuBe7QG09\nS7mEak2MK042fNucMc/oxlAvZ5A4WSrXbKKLMfBou3Y6xaHhmiAuftlJwr2SpsfJ\ntajvcM9o6dnoFg7T0UJ/9A2NC5AJghu7OY16dKpkN9nA7jDxY0O6KvaXkn436y7J\n9rcuae+zW/ouhRIRuH4scLbFkRTOmqDCxu5vft4PMeWTgkyyxbsMmws6deETKvxA\n0SAXrOZhi5OeJ+H+raZAFFUnOYs3GVklBW25SeL+jSsI851uH5WKrKVgq6NQd2HW\nTGe0ujUrU2Re1hJHw1zi2K0QpAYJHE8akpmkhLUoX6uwhkgrXyg5XllN/WMBjodj\nxlnK/J4yocyGBd6+gUgRFA3vqD1yIRPKkz9K2HStEw1vbWG2ndVj4QneCbOD8nBy\nzk29/bFLgb+wSomK1II9JMAGX7gjkzwhC86HS62oJ+do494/tdELbxwS66/2XRHB\n0NLpo4qYxF9S8vwI8BYMILLDYUoJTIoM3bt2mjIySjnUjXQ3T5YD6ZmG3OZv5rTV\nJxNXikxVUH9PwLkCDQRRUMclARAA2LTWvRtZ8NAWlKqSCCu7XbNJ7avyaJXOxMjc\ndu0BpbWyrbqHe7T/iO3fAmHqNJs/y+ENekXZq7B3qWiy9S52Ki13I/gZgUrWy+kD\n5SXZuEdB18Js+XKkxU5UWXE7L8nxeMmRWvUyv97nFp4TQCxKq8Kmy2qOYTmWLJWz\n13KaZ40Sij6bFY5X2zuXcRFLWP5fpzkY6yT6kBsXd54SL5+14fhSd3RkmPTT9E02\nNeRD5dv77+Rhp+XKE9IfM5+mtHTIPHeAWWNXLRXWYi4GeJbron8vThhe0r1lajTk\n5d1kBl30bUkPIS5ndE5YxmeDWgG6qFXyyMyfxejScNsV8ifEa0RcgzacBs7UcOeV\nZG1UUtbyUSZ8hdiJX6m6vrxgyyH8ldbfRVY6AosW/T4lmqFQ7IN8Z0AVsq6kiZFp\nmMJosTqZk4cQHHC4dUViVcbnO30PwKi/GL0gHat5IFvI32fyWjZWqr2rxcillMDI\nsiAC2J0PbKLJ0su6jPAd3mXf5SWOv9dfuQ1tu90deaISG2JQuqznx6Vp/HPNveXU\nzUySSR9l7Af01IOSmwFTFkr5coRbxv4aXP1uX5ZxFn7SXgBsl0zZO73E7NDbunzQ\nW8bJYsmu1SKumyasEkIyEejSAG6SiUXfWjYhEC/gG6xdBVyxsdihEx/+43JfRf8O\nyhbQwjEAEQEAAYkCJQQYAQIADwUCUVDHJQIbDAUJOGQJAAAKCRC+38+zD7ctEd+7\nEACXXkIHBACuLgnMTRdmZlOaJom7wfSAD5IGYYvU1THPXwJoHq/aDn/Uz0XAydxD\n32iPCjEI7MU9LJB0Aln96l4QhMuF0e0xfyPIpzR+anrFVwLH1dS2q8rAwleifWc/\nmhHrJI/8P526WOB0PJ/QLMYYT/kHk78CbBWbz1RHJ+FQZog83mf8I48C2P5hRDdN\nTpbMxQbmQYaTqsKTcf6Q3h2tGdBo0wyPI92FUEyM3XGgKLIBxGg7CLg+Q4mPizDR\n2hJQGAQLEJuxjGbpP5wZ/M4e+H9jqyoFSqP/e0l0vSuLymkA2mh2Lyp6LMRwXbj1\ny3Rl6dv77CgD3KbGCVopUIpBim+TJfRv/ey2z0lRl/UKQkXidGxroDkwm8sdbWS6\nuB/p318KzZWoVoJbFQn2XXkAwHoKAOZSoUhczpnB4ey/I9lr19jUn78x8K5O1nHe\nNCTyUB5kLKKsVAZm0m0SU4F9kTM+3fANy38d7vvpEOppPES6HWbrEIXNcwXqtek8\nCcjcMh5KnTus/rpx+SAjIngBpv5arNU/3QOQbYjx5h598d6Qa4kQix8QZ254t+ih\n9/5HXJbXSrbQ+X/4nJ6rfkKcZnXumlXpbeZrMTAc3I5BDoyVvJKVtOqqXWs4FN64\njv6Rzo6UXrIys5E5i/CcWOXtq49sYoBoRUu9yLcGVXM++Q==\n=l605\n-----END PGP PUBLIC KEY BLOCK-----\n\n\npub   1024D/1CE17EDC 2007-06-07\n      Key fingerprint = 0FEA 0B9C 3F6E D9EC 6A39  0AE8 40C2 AB1C 1CE1 7EDC\nuid                  Matthias Wessendorf <matzew@apache.org>\nsig 3        1CE17EDC 2007-06-07  Matthias Wessendorf <matzew@apache.org>\nsub   2048g/0E09593E 2007-06-07\nsig          1CE17EDC 2007-06-07  Matthias Wessendorf <matzew@apache.org>\n\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.5 (Cygwin)\n\nmQGiBEZoWa4RBADmTZh/tUjTdLfsP+u6VJ6hCU4/+YSXTJlLjjK4mm3l1OIS1rrW\nnp0yHZpcuHZztZeV/+vnBM9eL6DIIwPlzcO3ZoBP1HKkrnEr1wtrzFl94MccYdR9\nuO00scj/NIzF1Bi4spsk+xnfX+cRwSdmkdiM7C2+vE8VEBa+ux8ybLkSCwCgmhlY\nBStl6k5HKb6x2pVaGr9xDv8D/jO5sM4KoXuDDwzJmJf7sJlJX51crljXk9BYSEsZ\nKGpRVC6wnr8G4/irXZiXESf5jSBJ0G7upH9oTUn4PgXHZQfeIvwcEfNyXtbKUpa6\nPyn/qg4E25YEdhy086S4WPVjXF9+Ltiw4NnN78Jpqy4rmk55Ic1WEex1Rr4YW2um\nIDlHBADiF+d6Cs0ypu/bvWB8LyiyhmTsmgXs62RszkFq2xGhsZwVZbujcIxRkg68\ncYloFkbsAlu1LMOOSkLL0xfMqV6hCoDCOqdq49GUbhBlS9kjeZm5bady4P6Wg7UW\n2l6SsOp6lOzQ1slrCJEYFIMDssRuU7bSIsAt7/oXQDYDEoHJMLQnTWF0dGhpYXMg\nV2Vzc2VuZG9yZiA8bWF0emV3QGFwYWNoZS5vcmc+iGAEExECACAFAkZoWa4CGwMG\nCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRBAwqscHOF+3Ed6AJ4z6GgPy5RKfFU5\n9nz1TLiQAD8yHQCeK5iXWgMM7wJNRUNypPd0MgfuKf25Ag0ERmhZ0xAIAJgiGyU6\n6pXbAQGHUcRpBr/+InpOcLGuMJ8ZA0jhVvXquWK0drqZsxcWqIkjyJRyJpGeosik\nABOfypI6GDBhn4R1u8ek0WZQw69oIfXTsNCMGyzyUEnQzvgDMlxyzGY9Q7YVlM6A\nSlSvIKR7A/1ZQDLXlPgy4yK2LYx1iQoV4xlP0hJzXdM6yPc7v0BUgygrdK2xw7PM\nuU2egFWpXyVe/yTAOH6mF1ED0cDhRi+CyjeH67QpbRDBLb73hsOeME3f4353YQlk\n7/4AG7hMDsiOP+V8hxoACMDDtdNqPMJx6vSRg2yVdZ5zp51Svh53WUNkGjq+pg7U\nyAOFHbfrtejzHj8ABRcH/21C5wkGRsqBp4BA4saLgFFhSfKFpucyFUV8MNvaUWPw\nXcXQsVR9GGUFe3T+LH3SchFOLU4zQLCKKTRRk9ZZPR8T7YMyray1KJF3JjzsyLQW\nZrm4IN5DtTnFeoeirO4S+usQxDfEDv9g7l4etApcaBotUB8ZVu38RB0qsxtoFHi4\nK08oCBQDXJQD5qksIXn+KMfBaVC0ILl0T7/O6eo4GdAlCQL61FMFnM2aeSUb5lZ3\nlla4qeQwrVdATlCjaiDYlaywE1ClLwgXjf19tvmlwBbn+f7OjHrGyekA0T5BGyTu\nQ3UAOU3WYDDXSrFM7h0DdfVm/BjUa9G1fSjLHEBNc/WISQQYEQIACQUCRmhZ0wIb\nDAAKCRBAwqscHOF+3JVBAJ4nujxaQlT+QRA2hv3ACiOm9sfocwCfWMlcRX5WECOl\nVg5GvJOlq5rVKKQ=\n=DKW+\n-----END PGP PUBLIC KEY BLOCK-----\n\nJohn D. Ament (johndament) <john.d.ament@gmail.com>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.12 (GNU/Linux)\n\nmQINBE9ThxEBEADb7OdA4C0b5vnMEAxRgi46MEslWGCIp7aY3Wce9tE1rm0xd9uW\ndGja/CI5Zt1eTjVd8sf5YtkGmEqH1f0dNObNekXhqLrzox9HxCLID3jU4jAW349p\nWxeryrAQcWArHROzck3sSvluu85WfTHjVeVimpUSI4K7VjrUCh06KFy99KDntTNf\nJxZxr0dey3WSWxlpaSSyS2vv2s4WNlJkVpOVBDruf7Ylyi42Sq/UQvGPmUbP1brO\nDBm9Re2i9oQOxg4M3eAXvc9dSk99Bqe7OAuYi+KQgo6oQiIk5lvhtfRG8PQUq5T4\n/fkXWdVvdwrqszl0uCcFBahL8pU41C3BOSBU8eXILqm34irVz65QhrgbdgxU5jX9\nSVVflZmax3gtxj9NjDTU7bS3aWN/Jbvz2gZts5Pk9ylzm1TLNpYAlS7ivcXU7M+C\nKzfDLpgQ7HMtEM9yXIUGisYsBS6P9sM2fsPhhBnwJE+S8rzqOdVRYLk4nkqmLSQs\n4f7Pf+Ifdfe9Fc0rYotzCllHjlbu0xXv0i7qSJrLZpoGEK1l7sgcIrCKwJEhZZAN\nf6PIln5jZsN5LZDIYVqncls/ZFQorEXedtX1oH6zd04KSb76jnsr1J5yZB2elnlw\nXHdnesW5HalAf6WAri4vgA7mONBYly6rIJnTFNtDB25xecwpMd1V2qaJVwARAQAB\ntDNKb2huIEQuIEFtZW50IChqb2huZGFtZW50KSA8am9obi5kLmFtZW50QGdtYWls\nLmNvbT6JAjgEEwECACIFAk9ThxECGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheA\nAAoJEF+XRWEINt6h02EQAM4ddj/UalT7eJdMgALLkO6XqXABJlSt1L/lWgCnNL9u\nGVMXpqXhGDdpoLQAFDedrpeutJD1NHAzH2Pe6e7c6lMi7HvJVIKVFUh57bjk/n5L\nM8gJsRp6hcmPmy5Dru4kiUM9fi6xSp2drjTbZkasnGNL3CbRyeMkwO8x6EF6dXgs\ny8oqG2kCkTyEceRmhImz98/MSR5YhbsN9DQ+7ceLTB8A1KHD3tv+rDSvgORUwj0r\nviY4nE6CH10RLu07PyTGF7PfN9MCDvkAl7fsia7hXL7cKKDhB8gr9buJFMRHsq6+\nYajwZvYcUgOVCRmIwnCN6x1AJ5VffjzV35vy+nEe64jycS6VCaw+P8KIFR5r6d32\nVXrmUcYHBOFP7wpAoU3iN+RSQv8QaSv6uy8Q75/X7ayqPhNf5LgvdICjSWbAYLwZ\nmQoHc0XLKU2DnoxVia5P6HaBGs6+b1Yk1KlUGkRgp/ZswQ/Rxo1t6/7ZYAhSCDLD\ns0icjWMchOsAlpGJzZO6gzWKO9ke5f1XRGO1vcMA1W9QL4gyGKR0rbVt/nt4i8VY\n8TvXEIGvztP2aVkV1DR23jldDpy4mHRZAB9ba1l5RURYiIpOn74ftO0TaDH0keCJ\nTgKfkOemQhx3vxmOXhmeNeKU1bTDy9rhPKOMjNDShLDWExcCSLeml+ob1KqL0Xes\nuQINBE9ThxEBEADzZlphjr32vjZ34FG7OL7+tSwyCQg5j78lcUj/0M/lONHtfkL7\n6HL7sUFvRNeD8tXi4Q5P5InWG/tb1lahC0MQ7rpLZDAhRf9CvZ4cA1vNXK86xily\nkvvQdACGzITPFJQodn0GowxwUirmRu2NrwPATYbaMc9gHMBSFb+fSfM/ZIjJpyha\n1rZEvgGNzlypHtYFx54UQoyby2FO/btJdoLsKOktJMl+JNP4F+mRiwzSFiNm5ksW\ncttiu0thtkGy8jJ/2FcjmETb2M9eN+QReeulLT6HCSGFV/vles5i0pr44iEJF3mp\nF4+y6eR566RiXj2fR7U/FbhyaTH1+jsTYVaUO9h0Uzup+4oXJNEXJAdnyiSzZJ6z\ndxvh1L0+O9Zp+1mqEkP4X5oYoK9LrP44tU6pq7gQYq5pxBG1WXEENH9q+i6AYc+u\n2TqQLDazPHTpYW7UYmzwvEsUazzdAed/UFl9Ma3xherEgTvlX0awC5HRTwX6Ff9z\n0l25kV2rBsYsZp0WKNWIOG4SFO5uq337QvLw+k5gS20S3oDy2QddYLxL7bNMcL4e\njBUQkvvWSpay3z5n2PqPmtDbWXP44IaZLH5vPqH0bFjomU09B7y030h5fiUgnd7o\n/oQ96jmTcZutoSRfDMtJk/+Q9NdDged/qQtLL+8gIrxMe0caTboyOAD+uwARAQAB\niQIfBBgBAgAJBQJPU4cRAhsMAAoJEF+XRWEINt6ho2QP/io6+uas/sC2ay7NjuFH\nQdJ2YmYakglW7IPkyUdnqlcdH9X7O/QBCSFBtQGj6nylZmLIp4CI5HSecOouj+MA\nsLpZ12nz7pDw+IgjrDjOHACXDrOhi8mGmtFFyklYBXmZPGHN4ZQSyVfSHZaOQVwa\nq+sO0fwWDF6MEle68du5M7VqFEfKU03QDSQ3ByZlbm+oBLBMPw1D4A7M39UuaBZ+\nFe9aJSv3E6pV8xaWySMHL5Jl94UK/yahxZXXj94Udym0jmhXoS2n/bN2h5uLolmt\nSuN4bIqLTF4FfY588zyp214SYbyuIl8YOpN3yq1OmZ0wsKvwrpCTCGo2UtAjypwC\nkOM1dwLgg3PkCvHO23+L3MRkDwVc0hz16darkLmtO9kyFl3R3QqLlE9iirQrYfnT\nG6FT7w/y0TRQPZsfNliQbo+nl8VcqBCsdoKKLze9LaZ3Nso9gUIg+sqU4UIbaEg9\nr0o4OyKRH8QmYb4F0ywuqmMFVb0B2ljUtsSFlCi3NVy/zWdrbapALy4BaDXEBMg+\nwBIu1kYuPCnL8jQjOvsj84zPLgnznPAZx6l6+U2dzXfNYzi49oibBOXaCkdetxjt\n98EzHGhF0dg24gSVeAMpU1AYuXEaUy3H8SQDwtPjd155Dq0wAst0i0okFr7NHJu9\nasmE9bmSLBc/emgt4+DoJSfm\n=Q2Zq\n-----END PGP PUBLIC KEY BLOCK-----\n\n\n----------------------------\npub   4096R/2FDB81B1 2010-02-01\nuid                  Mark Struberg (Apache) <struberg@apache.org>\nsub   4096R/F24C5214 2010-02-01\n\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.9 (GNU/Linux)\n\nmQINBEtnVXUBEACz2CXck8rFZsqlmtZrwySHkCKdKQ3dO5fyya3ScYRofIS0OVi0\nBwpWyVfzezq2jl4AkjEFGS/ja0shnr4hg6tWU6w3obZ4S8dQMyPm8x5kSTxj28mn\nlkNnR1mBr7S13n33ZtA6f5c1cPu4zMqzKEFvsqVoBwD/ru5WOB0buwGi9mG173Vi\ntkTi1MtzQ4aaIo8XiJyLsm/StTq1ylU1vfqtyFDZJUzoakdYSiA4NVfVFUL2LMTl\ngPq3hpWNZjVm41+YKWuzjIJ/lidH2Y2TmjivgtQToVbHMV3sHn/PtDKw91S6Ls2q\nkSLUm/Bs19H4ZGPMhWI1MnQnQiuMMPYvqIddIh2SIog2bSowPZz2FkZxrw04ej/t\ntYrSIfiR3sRegmWoeo/FCLYVWZ32mw5L8Tw0npHg3BSi0v5FoNd/GiD1Y6//Usy3\ntQVFUI1zkh/PSWVImAgmgoE3qhcIjzlkVutsFY4NGr6LH2sUpIJBi/ECy0R38rLg\nsg5pjUPhs7QexH5M9FxshI+yDsvPOTeUjvpHysvemHhVJyPQSmpOa16ONFmx5xvz\nd90FmxKfaJJvmVMvNmGMdhdAzaAJ3XomFEJZDKfyBJoOJSoNvdOQRNBUt7aKEEKb\n3BGypY2bzr0C3WxggpywPmlD1xDohurx/b3dLFoK39hmFiTek4db0tin1QARAQAB\ntCxNYXJrIFN0cnViZXJnIChBcGFjaGUpIDxzdHJ1YmVyZ0BhcGFjaGUub3JnPokC\nNwQTAQoAIQUCS2dVdQIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRDpEoeC\nL9uBsTzGD/41kZMlyyzg6gsrQgDZPxzxVbsFWGqareqElLZ8MVTo8mEt9cKwS71T\ndHaEXO1BBukqPWpRjWp1TepRZ1i4PNscDwtDcGkv2lpaQICwo43MNW9GFFRJaGCr\nRy4Tpov5yYwdbP1cdqNS+Q1TtwZcCTFiEL1xAAnR3nY2BzfdpL/fTXzHggmuLtRD\nOeiIPQrp+NaVzhk994t1MQ5wjevoZYGvH6oV6hQ3Nr4t0rA93F5fKb9vJiz3SnJU\na97uPANCYzhYSb6IzNICLfSQCKi5AoK7fjENCTaq2Uqsvkl2hVZWmGYmJLRAZDFE\n5RNE2OGU+x7hVCQnD1r/a0rnWpdODqM2EkqDpxkKkH5pJvzPepLeSYv4KmRu3+89\nljFtBM01pt9TPoBYRE2/sODZUFs+ct+AaxatHjs46U1Ks6g0ah7YmUnolENqsuF+\ngrpLtrCwgKrwfY3N4KHIMUnmq4Wmh0ooiL2o/DN0EciA2JDm+3xgK1giAXvzCbDS\noHgJ/SJ6DAUtSb+t74Gd4GRvpDMoo7u82A7tZj/3h5cjmyuwms1uJc40D6v4/Ljp\nsbltrrWcJ/E1TokJlFT2QpRBJkMixHO4aaS7olOMJqI6/wrrzq7KjZOUfD3KwhDL\nDolhmshiFw1tx1sloa7RlibHAxxLKkcc+DVGVr1MBf4xus38QZT9R7kCDQRLZ1V1\nARAAstCgZH1oA9RwRaBJ21qKeOzOaB3iOQynBdjeDJGiaKuMQWgv+NpLCh+fqe8t\nQSj0j40fphOJq0dTNSqNExLd4P5hEhUXALkFWGmc8vki5InXkeUc8eMvvAILa8qX\njXsR5Y13TES1hZGhAUQ9KPirJubrnIWOexoBndW6gEAS6N1awoQEFsTcB7wrV+Ae\n7pBQHH2CrtvFYXePNjiWAHdV63uOTXkM8elozBMa0cIVznv4sgKzs9sdJlg9Q+5E\niU6zLmEL+zsVgtUczAx5x9nIMRZsqgxlysalqj9GQHlnv49JcR4wyjHSLvuxUVgy\nYOOsRzpbizjyBZe3w+bo/J4K9covXmLIIHEaNm127Xq/pT/aB79cmRmyzXgD4EQ2\nAhP82+c/UVr5GO8PBqPG8pydwMXpT1jzgTmMOwvEhj2hOtqA/HE5cEIpiwgcJOrB\ng2C1irnApXFTmA6xtPGAZjCAaHHouelNepA9T8x2LvzoOdfXIf6dOX218Y99VLRc\nUwj37uyYTaEwbWvyEX7u+nHuKWXN7SaML/IYTv/rGu+TUVAQGlWTg2lJkY6vh/07\n1EUmavR/BBUOP4NqmisNS0Xtx8OHwQ92x8+ayRixO3Kh6OC1nJH5Jylr/lqpVxXw\nHgA/hn/jX4/TWFpmv9JTvxXlYfnRr9UccEncK9/28eUz+CcAEQEAAYkCHwQYAQoA\nCQUCS2dVdQIbDAAKCRDpEoeCL9uBsRwVD/4ogReEt1w2ODA3SsypnrCettQtnV4J\nVn7zjvDK0v0U+xZ+tB7VvUqkY7dQ4RmzhxETnORUZNgCWLZ6fs5Us2RB/yoOyYSJ\nc+SBN3YEpbFBwLBLoGlZTGsJPktYNo+nQ9KEIZ+OHFnhXGJLqBknMn0vu6T+pQv5\n8hJzrfOh98TCtFLmKfZGGwoQfKeDAMEo71T69Yoz1NSSFHr5o39iHff8+mhp1WL1\nhsiJI6MOlaUZAwNI1CRebZPQofvydTH+LWsBna1oAiFrO4KcorBJI/gUfGO1mmBq\nl5qjtoxhq5Tr2oBQtFoqbUaXJcwbDVxLSQhk6omNjNlolsRXj6TBy1eTFgd4Ww0Q\nB5mYo8cc8Et0wlzZ3UyhD2ix6EnKxWUqj0oFPIVzFfuQ/whmWuqBiMZcAN9RhCGP\naovv1v0jP1i983QWptUwpr0m2UjxblFUz2GiQ9sXPCi1Cko978LKCiVseCKVEmbG\nfWdpq/h+sM4GokoYwa6ak5B5Dyu9/JywTAex/DgUvkuGQuBjtipmS84lb+Ah8wkj\nlxiWgAoxUUnVFRJb9bpH7sRNc8SXfy6dYcCDWURq73JYzPtmCVAE6stD5lSU+YvQ\nf+QZZLa4u84eh0skgAakDgkeL2cbOg4tzkUo4EmbXR5M0VRk/946s78/JtchwdNB\nzxrmkygs1IMB6Q==\n=8P8F\n-----END PGP PUBLIC KEY BLOCK-----\n\nRon Smeral <rsmeral@apache.org>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBFQlQpsBEADzhLFSQSDlMeW9k8pKy85P0FehiDYE+Dezyq41Ay1i6lAk5OZJ\nBhI5FVDUQ8SC0pEsKwS77NAXVwV9PF2M0oH0NPFBXbMXlGdJxJasaMHOP52NE8IQ\n6narUH8bAD6BONxxSdXonkjHjTIV3SlPmKlM7ub4FvX5snvrmUb39urlvF8Fpr0u\nQmykxwUk1Eg/n6l9pWMbRNhyc3caSEz7ASVwuLcHLLrhNYYQxTXePGMhxgwOnz+W\nAsI0UfJFqMOXDEWjT5XJ2oMcXUaG26ubn2J/SMPud/NzK3TbqpAbf48IL+lRpzGr\nCgWQRejwwOTha0bbLl+Yjl5lFgOPsY/Oz3pNpXSIrwvwIyWtiBmmKqaD6K8H3rTd\nkLkH3qWGNh6DBm9fLy2xL3sWRFuYLsQkP2ngF55QviuXWxt9Unsi2PL8BYD9QNLO\n4eWvWoymkNXniGhZg5wMu6hzzpY51DWs1JoCZ3pc9kN4zjBrRlxS2t+NcGC4K4h4\nStAvkNUZphgStvdwkrs7IQDZoUHJ2JPUWBI9HQT15urN6DK+ENPfDRnSJ1fxenKd\nC+4OOhd49N0u02CY6yR3lAmm8VlHDmF2uSq5EMJD6dAgDN3Egf+H8LOZGqd1498e\nF7nB//uZKUQ00jMf/Tk6YWuQo1Ty/SCJYpaXFAfftMbYoP8WMCFXokodNwARAQAB\ntB9Sb24gU21lcmFsIDxyc21lcmFsQHJlZGhhdC5jb20+iQI3BBMBCAAhBQJVLZas\nAhsDBQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAAAoJEFEj7Ky6sLYRoocP/2YJ+orF\n/wrhxKOxGMdnPy553mZS/ZuU9Tfy0JgMf2q5pIuM9sTKopPrT/Fhi4Ja22z7IJTa\nWT8p5MeNkui8gNgfJ44Mvy7IJfAn8IvdlaAFxY4S8jd6jIvfWonpeDLg81Tv7iyE\nyg4L/MtKqdC2/bdeyyPtw0QaRbiikOiQ1vdutTSBJrM0OY4kJcuc5Ca4pKSIaSUt\n2v3t8kpoNdIjricBOgK9wYCi/hb2996mdn0hZG0/E7B0S+KiDChmcNyaTB4Cxwzr\nmlkXs2OunjL8Zm5elT3iXnHeJOuklHHQnJ4OdC8bUwJMCkup7UwtE02E6/GGVccO\nbtJWYaqx6PVuW8BVSjnxMPbYq5+cZtTdaB3c+7izzVoXVsUlPpX4sJK5Xxdn32Sp\nD8HUwd0pp+sZi0Rrpk1ttvEr8PVXZRi5PALSffMuPGwrYzxaGJyhc6cEZDBmDtGa\nPPcMOc7tM6krTGtgbXwGZHuINuFw9i5Ul+qFRLmIneThOPXqc1bZZy+AxiaC8unv\n3KxfZb4KGOjhv8NScSTp+p+cyrEC9T55L8a6r6a/+ASqQn3+31iswcqd0nbvFlXj\nm17pG2AzE+PVfUNYUvppr9LECFI25Wr5mPf2Umq1KcFsnUMBvXuW3DVWVdj1kYCj\n/rsIPEFndIp5bHa/GjloWmxN4bjn9ta1QL75tCFSb24gU21lcmFsIDxyb24uc21l\ncmFsQGdtYWlsLmNvbT6JAjkEEwECACMFAlQlQpsCGwMHCwkIBwMCAQYVCAIJCgsE\nFgIDAQIeAQIXgAAKCRBRI+ysurC2EVgpD/95ZWYbB7Am+ta5vjewWyvIl/6+cLs+\niGCQzY9QaYPMTCoa4vCeoO5qJ7/duoT3iffDaQ3npS5eafNOFY9Lw1yvoDaEePZa\nc27w3razXfZaX4ZWyKTceVlmCd9MiQTPHuOrWTLBUNoFB54aZ1+8TlUD9bn5N4KD\nZZ5H4Htlg5Ni5CJAlEC9zFznqFoMsLUaf0J8WsL9Kvt+uI+/97/mAQIdE/F0dlsk\npCe/Gu10ebvRGSjPclN0bagkG4s93TwTAgS/pntvLFmn9TySfmFKPyIyOWIyWz2L\nr5AvJhHjA1w/8/LWaV5FVPQkHt9Ls7MpVrzvIEGJnHE3sJZea0/D7gPvpjC1EomA\nA6D3SjCObUyB3imRkiPGhkZRe9Gh1durDziUen4aAW8TjYGPXysEnjxJUs61iDXx\nBgvBlNdyvlS1EXfCVVh3N9FgauZ1QFr9KqoRR+2qLI1+kze3OuStMsAiJ+zSvPbC\ntqov0QtPTaQqVjKyrfl/+yxkxGW6wkIk/NunptUOFr0FZgklD2vz2cKNJvP4WKsL\nNSEEjTnZXX5KiC+Xi0G9H+ONoZ9r+fFFq7K9IPeTZS68AW4qH7cgUqSV4D927rV0\nxRfisfw6M6E1Cc1UOd8n+3+BNER+m+/wGmFuOts3C6jw70tYLB5d+iJdQSWDk80X\n9tMJ0TMwIxjrhbQfUm9uIFNtZXJhbCA8cnNtZXJhbEBhcGFjaGUub3JnPokCNwQT\nAQgAIQUCVTYOpgIbAwULCQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRBRI+ysurC2\nEXNKEADvGy5PDTF7XeRgcGY5eo7NVdWHwmUVURlY8uuRBR1PULC97S4CgI7Kxra8\nhZ+BzHUrfWEU0ILisPsBK6C8XFFBPpqqhw5DEdnSKI5fh27MtsNrMaNX4dp9+hDY\nnyxlpj0gdXbNtOy8Cehot9ZDHE/OIfE+QbazML6ObC/TM0hETOjLK4P48HbYiWYO\nZs0uVyZ1L4K993O/iIsuFWQPbWDTH6lXfaXmE/omqVtodhme3ORqp6WK3+knd1yk\nstPzVzhyrdigDeL+AsS2GiZTC2u7sNH8ZvgFpDZP9q5FU/nIfyMnlcQzFkunqGdI\nM+L0CCzZ6wKOs5j9T2PbwI5iPX4YMnoqPgem0dEYuxM8SrZGjpBAxAc+JlDrEwEX\n+OZndhB9Ap/DNNaMsWxKI5bzbuvT8hvB7sbBn8JhX77JfI0pMLwegWU56HpRE+fX\nzIQzwu5sKXwzXTRSYMRktnkynjf4bybZ+rg24fmZ5DiIMYEjxMuFa8mcK0AQWqf7\nH4r51n47tu4VtHy612pWxCEW3V5V7qya+Pu9dze1hBDREBryB+6EPAI/7fu3BIon\nJAXMisby8OdmI77Nd09wyBn3j/OodW8khIKbvWNguq+jCalnzhHQGBXEUoiG0N0a\nAbOZqcP+dbROensiguEy7c8kyc8pTQypxzG4Kwtz8uLzQelw6rkCDQRUJUKbARAA\npDvgTDKmLaIxhXqHbNWlsy34MvsLbdlGw71IF/0+rVpe2Z/eDAu5xMtnvUREVjnk\nfen4S7G8JlpixrZHz/PTrjN0CUnKiZuPeD6Yx5T2de8eDbV5Gs84ia5pgGQL/dJk\nrBnwhtt2Ayk7XgEGtHYG+OVObf7lLDvhESzBIvqE0/KNyQWJU8q+MCAUOwl4wO5g\nDvgG0dPx4PnkqU/F8YYw1sSiAryo5PTMEsZ3vEGUhbxdEWgnjcwuFbJq/O2U+lkv\nFgCYq7Py93JiInRAN8muly+HI/jEpEq0u6mYIeWxDK0iR9LNvcB2o74rYNk7d8S8\n4OQkDdWriH0NzrzX4NuxpZoTwxZj6T7lqa5zB3tyR/CvIlL8QYdk0tq5c0P4/yUX\n7q70duHwkBTuwCIrsjW5sriv85x7ErOJ1AUg/GZVU/DNWvEUq+PEygGcaWPcAqZ5\ny3khuu0lLdVOzRXuomGPzyihW2mbP4TjuKny6eOfR0uAxuDRC1d0NZ/Hl6fMxasA\nn5beJB2WaIGm1fFMNt1BkicVjohcMZ/yPkEtK5uHTQREHBXvTc5DPm+mr3d1sglx\nsRpAriPE454bVWpEQYfg6LbKLPSHVg1hHivZCvlL/Q4I+23ao3n++pCg9pMytTNc\nC1+bd+ZeFaohgmlQ6XE1yx4PtQFQGA01cD6wVh9N2jMAEQEAAYkCHwQYAQIACQUC\nVCVCmwIbDAAKCRBRI+ysurC2ESZ3EADPYWDdoGQliTLeOtH6Kgxx0gOVizr44yvn\nA1Duj4AByCOLRffpHbltDFg4mpTIcpF1OsiPRl2Cz/FTUEKfLoJ0J/B92szLwlqf\nm2NMOFblqGCzeQ5BBR6oWzxfNkmr5gGTZqHzRDRLbv5CV4ZsT1Yb76nYy7l6JIOw\nOOeGoTAjIbxhQr3MzvQ6a2A3vydQGkBlPfMFE6fjZw71U3pwMniNh+QwT6vh6h03\ns4UhrjTezw9ZBjhUuuXtERyXX+LSpdqANw1kGAkZS8uDXdQD2UmYO7x511S8zSL4\nFng8rE2TlgIHRv4GEnOujTo128BN3Ml+y+/M3pcUTnvasd+DlT/vILWLt2xrAh9V\naVZedGC60n/ft80yhwO55FThl66XAIjYA8MRLbLNfgBlBi4oFLIqJ2QkVPn1uAeP\n5pgDd6rmvHsPXH99UcIuA4pKU2vFsA7YMBkDlunHYtyoyy5r7r3TWMvAuV5SWvsk\nrHAKB+hVbNdhPo1BMbXoqHKcrdz8UV4THSyvcGJpqph2wtWcywigP4n9/cC+nd7b\n3WthIWfJ0JrhnrSBn+SzJBlHOEBsG77jXd07hjcWVLpZsiMaEsevLCStHAogwBvY\nZ2iU24ZKLRKYA0/sO2Z7QCtnfT6yNwSsEvIM35fe4C5UK960SSRkJja8cpwjmrp9\nK65CLoYVmbkCDQRVLZsKARAAu8ELHJVwC5C1oCbiaF+pef56mvaqqahWo5ld1sMh\nlLqHeQZ+nhnNe/6MP4bSR9qe66yKrn9sAeClvZgh7A9g1dEASVedWAyIUK9v0t3U\newRUAOknRkmpfjKbFLtTpzKwRdJvD899yk4f8TiurdUOim4PgSvEfcZ6q8OSB+5K\nHSZIGoM6+GtXJZYDsaQuOCF7pbu0VJaNRxkExPf3w8c40IYgtaahfJZ0QfbOWfOk\nvst33kh6TXZL/0vO2rDe4YLH1v0qHbf3rZqe3uMksVN3J/6JBIc2/sjaW8dcxPdn\nT3ouCq8501rJrUYIMENGtJesRaCqkGFet53bu+GGanTscxXWH2vOKhnmxqIZMOq/\nxth/x0r4gdd1wxXdYT8PAVdnISkspKtHk8y4CXGwqVjZxuGFrgjKa0EhBbxloBCm\nNo/ueVNvIE0Mp1wrl4dO+aEMZzXyPOrc+LSfH/BhuSo0uaA5FNrNdiuh7vbJNtzD\nVLjT1nKn1Ug1pV7o6Ir5SCYbpTkZg4ho2b1K4uN7u8RINclps5Ry0E6VMSm7fohi\nlyiCefWKz8zlPvcJ5pgiFqGe2F7elpLHOPMIldPYFRr4WKATS20548TlkltNRuVI\nYCvH6YBDOyISQWgTfYnphtcv4wtF9J+dWv/I0EF6JsK8296cvdj5ovolhof04MEp\n9mMAEQEAAYkEPgQYAQgACQUCVS2bCgIbAgIpCRBRI+ysurC2EcFdIAQZAQgABgUC\nVS2bCgAKCRCa9YNvIENXIQrpEACBYKEE0VOCYP08Q5JzM0BOhH9vgc5tx59tE4Hz\niTYWiPxd39q/5Wvftu4sXlKm7Jf0khTba6vToxalJmLqXGf9nf2L28CxkSJLccL0\nnUKQP22Sk9MP/O6UHzev6WafommQk/ix+hFhLkOzuT6WxHBVpEh0PUzTZoxrO3uR\ntz7OrQpNAR+3l0RLsb0W5cg/ykuV2d9h41HefPYvqoL8UIYBvLO2F+HZ2UCtDQRs\nk/thJbROw5GZJgjSCUkJfsWkJMgk8Pm0muwk3LuC8tzhEDEYSVUeYnHcRWr8sVZj\nnyBwlEITjiyxiCnS75HfTnaVv3ZTL5YkZlNybQJnDglscHSQh26l3OeUywLzA9Tb\nymUrJdkEPP9rf6MSF3THVkR7RTqpLN26hUX+HcYVy3yL8C6RuBwR2xnKaHxTXFD2\n7NHXpl7vaM3odQ7ltL6BhpYEcprgADcqRZNOoAtd/3hd2Ts7CgTs39kwmSil7LSd\nL8+5N8KmTxK4nIeWEyS0F4Y9vOEAh87kBTh68aI4smbPJFbf/BCLGy95gdTgp0zA\nzHIdCu3AvRsFNn/uKJLK05xkJ9jJL3TOJM3jDS7iod6/MHCBUdW4z6vB7zPgm3sy\n+g8itI+S8RgGwrr1tVbWGstPRQbDFC6jvsiREYBS1c1KDr1Vh+wsgqjSst64pjlR\nQydni4V6EACEHjP2u8WrY8BfssjLProtHBI64Ce2q9At3KAcT79H0npuBfX/GEpc\nl4LTvXjH2tAQym8enqUotXsXa57hmOVvqYYUeDrbNL80g5c0THalvbzmqwcrUvag\nTtqxKhi2Wqgr5nPK4/uoqgPQQ+qKuwTpImIpxgwAEpANaBPMWf/frnz82nBbmJFd\n1xcI057kUm3fUz5AaGmciPHzPmj/oTprSGMIbjXDupuBwQjB2YpLydrNtZ5lE9JK\nQZ/HBboeC0QGSQHuKyB+5X4gbZuYR3CWcXdw7SOdnsg/Stm9X54XGB0+YtnORo3t\nX11MPOE3wyAIO+f7VFpZZEsf+5Y2iHwVSPhi1KZL8WDiRKZWuQy7DoZh9z8xGDRt\nfrxiVNS0bPPfyepxxkrXO4OFRz+r63z5DbqCQBj13oDpo6ZOMb+ki67RARQMdqlW\nUyehzUrMXWHnjkwWWlDfl6kkJQT4aQB0J0nycb+sLnX3nK85ntuQF4XKOF1qc7S/\n1TLLedj4oSVkR6lsAm614U7JqCyQCTvRjhRB2RkWjbJEqYKi2Vh/8/m/Z9LWiZVc\nigD2l3a2liQPyFsXevVT5IJUUm9xUeuTnEw3TC5KsRkxLLBD4/9cqwNEeiw3299L\nNeHfSttzBO+0HisGUdYEoWP5HrIJc4BEUPzceOGe6BeX6l0PmT3Uvg==\n=CfmT\n-----END PGP PUBLIC KEY BLOCK-----\n\nDaniel Cunha <danielsoro@apache.org>\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1\n\nmQENBFVu6bMBCAC1epJGKU7YAb6wz8JahM/X9pmyVEDA/YYdQF+YM/XQsKi4CuL+\ngnoou+9hDGN5OCHu+bp/VUjk19YgAuSWcpLYIdMzv1gyF3LRDTUcyY4gHGxsQ+Kj\n3dQcJS3AhRrrXGzJlujx+mp+HqsFpy6eBWYpzn7k2aWtOUUb/z8FaNOnIYzdsK8O\nj1ndY1T2s3tqdYR6ZPU7pTE2uV78O2sqo5S3xmecF9HTE/ocAOAGmKDVOO7SrArJ\n4Gn7ElVbP7hPF1sp3f335BCJVnLEZ0Hh4Hwt8fwag2xVxt6l7RfR6nskGokt5u8+\nF1GQ9SHCpZiAnLYpsGAxmROKDcSl56kNehBhABEBAAG0JERhbmllbCBDdW5oYSA8\nZGFuaWVsc29yb0BhcGFjaGUub3JnPokBOAQTAQIAIgUCVW7pswIbAwYLCQgHAwIG\nFQgCCQoLBBYCAwECHgECF4AACgkQi5zCuRk2g+TnzggAoTsal2mWB5KXLjQfm6qW\nBsKqj0QFvTsNUHzYbc5MtTlrkHFubcx+GW77M1I1kdzJnZPvHbqQslUTyKNz7WLO\nger/oF1AVOvkl5SuX1ecF50TuSd8quMEHGtECWZr21T9rBSdVfzKoy24S9R0oF2u\n8V5IPpY1jbMCjbITclY3rjXArv34gT59ALqr3h3C++zsyqwhZTC8x2eC8Qwmn3M7\ndKW1lodIbT4OE+/XzkKpE/WFlNhT5lmtKawhnsK+lnEoxlCoOD0Kchh2RO9R2K01\ntH1r8Ul/BaS7eTg/UARclX0Cp8CmC4rdk6ZvvmBn2OmYLWuspaxJ1gcTc4he/PXf\n97kBDQRVbumzAQgAzvz0N1xFgfyyH7tqe1WIMOftNIWV+3NtpckRZYN6fFgt8XMM\nExgZMR7Q5V4o9akRS9EWmIoAEIqb0JZ5lLC2w0Fzc7FBHjTaa5zat2JIBfChoMw4\nazut7qwKvUk8RwkTrl2mn6nQLxkVVu5iJoZZomHbju0u7uVOXuChv6mmDqyKg6Zz\ngVJRv662rk9/bRH+A6dLwe+Kskvu2CR0FqeFw+UgBCx01wZ8pxATzgW2BxM+YYki\ndgPHb9hwsBlLBXFlOzNUozxsEIvbUSS7XLXIfaZh6JXxdJsqIT9kscVCfUcHsD20\nSY4XQPgB9HOMHTVdY3JvFy3yLQP1U6CLRvmahwARAQABiQEfBBgBAgAJBQJVbumz\nAhsMAAoJEIucwrkZNoPkjTwH/0HZHkzSWIDdyCUFctUmbFW5qTnsN4qofpj2m4IV\nCKqB9OZcYK9TlK958mBEo2tmalzmuLcmTf93Hw1z5bMR7QETI1dcH25xxQrzuJm5\nhf8Np8C2xfhHa3N9eoxjICt3+BsUZOu5bAahDcRa89A0KS7UMPx5Ue6cYu1EZTB0\nkXjhUqyw+zc6k8Ca4tWzzPLqOQOcXZuv2x0tOprm8tyEJ89g+ddaUA4rvz9Q2uLW\nbahaZr/WJ9nmLWFm2nG1BPzszF/AWKImSbg9HkGA0Ye1CjTaViAqoYrVbUT/Q81r\n36ERRFbtxEUCunGG5F9EcIvZaazqxmdXz8I2SDymz6yO3JI=\n=vfLb\n-----END PGP PUBLIC KEY BLOCK-----"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache</groupId>\n        <artifactId>apache</artifactId>\n        <version>38</version>\n    </parent>\n\n    <!-- \n     * Please do not use this pom for other deltaspike modules.\n     * Instead use the one from deltaspike/parent/pom.xml!\n     *\n     * This very pom.xml contains only the basic build layout \n     * and no build-rules at all. See parent/pom.xml for all\n     * the dependencyManagement and plugin configuration stuff. \n    -->\n    <groupId>org.apache.deltaspike</groupId>\n    <artifactId>deltaspike</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike</name>\n    <description>\n        Apache DeltaSpike CDI Extensions.\n    </description>\n    <url>http://deltaspike.apache.org</url>\n\n    <properties>\n        <asciidoctor.version>2.2.6</asciidoctor.version>\n        <version.deltaspike.latest.stable>2.0.1</version.deltaspike.latest.stable>\n        <version.deltaspike.latest.snapshot>2.0.2-SNAPSHOT</version.deltaspike.latest.snapshot>\n        <svn.scmPubCheckoutDirectory>${project.build.directory}/co-site</svn.scmPubCheckoutDirectory>\n\n        <maven.compiler.source>11</maven.compiler.source>\n        <maven.compiler.target>11</maven.compiler.target>\n    </properties>\n\n    <scm>\n        <connection>scm:git:https://git-wip-us.apache.org/repos/asf/deltaspike.git</connection>\n        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/deltaspike.git</developerConnection>\n        <url>https://git-wip-us.apache.org/repos/asf/deltaspike.git</url>\n    </scm>\n\n    <modules>\n        <module>deltaspike</module>\n        <module>documentation</module>\n        <module>site</module>\n    </modules>\n\n    <build>\n        <pluginManagement>\n            <plugins>\n                <!-- this is a hack to make mvn site not really run. -->\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-site-plugin</artifactId>\n                    <configuration>\n                        <skip>true</skip>\n                        <skipDeploy>true</skipDeploy>\n                    </configuration>\n                </plugin>\n\n\n                <!-- SCM Publish plugin to publish documentation and site -->\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-scm-publish-plugin</artifactId>\n                    <configuration>\n                        <content>${project.reporting.outputDirectory}</content>\n                        <pubScmUrl>scm:svn:${svn.scmPubUrl}</pubScmUrl>\n                        <tryUpdate>true</tryUpdate>\n                        <skipDeletedFiles>true</skipDeletedFiles>\n                        <checkoutDirectory>${svn.scmPubCheckoutDirectory}</checkoutDirectory>\n                        <serverId>deltaspike-site</serverId>\n                    </configuration>\n                </plugin>\n\n                <!-- Configure ASCIIDOC plugin -->\n                <plugin>\n                    <groupId>org.asciidoctor</groupId>\n                    <artifactId>asciidoctor-maven-plugin</artifactId>\n                    <version>${asciidoctor.version}</version>\n                    <configuration>\n                        <sourceDirectory>src/main/asciidoc</sourceDirectory>\n                        <outputDirectory>${project.reporting.outputDirectory}</outputDirectory>\n                        <backend>html5</backend>\n                        <eruby>erb</eruby>\n                        <preserveDirectories>true</preserveDirectories>\n                        <templateDirs>\n                            <templateDir>../template</templateDir>\n                        </templateDirs>\n                        <relativeBaseDir>true</relativeBaseDir>\n                        <attributes>\n                            <toc>true</toc>\n                            <icons>font</icons>\n                            <latestStable>${version.deltaspike.latest.stable}</latestStable>\n                            <latestSnapshot>${version.deltaspike.latest.snapshot}</latestSnapshot>\n                            <sourceHighlighter>coderay</sourceHighlighter>\n                            <imagesdir>./images</imagesdir>\n                        </attributes>\n                    </configuration>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-release-plugin</artifactId>\n                <configuration>\n                    <pushChanges>false</pushChanges>\n                    <localCheckout>true</localCheckout>\n                    <autoVersionSubmodules>true</autoVersionSubmodules>\n\n                    <preparationGoals>clean install</preparationGoals>\n                </configuration>\n            </plugin>\n\n        </plugins>\n    </build>\n\n</project>\n"
  },
  {
    "path": "site/README.md",
    "content": "title: Apache DeltaSpike\n\nNotice:    Licensed to the Apache Software Foundation (ASF) under one\n           or more contributor license agreements.  See the NOTICE file\n           distributed with this work for additional information\n           regarding copyright ownership.  The ASF licenses this file\n           to you under the Apache License, Version 2.0 (the\n           \"License\"); you may not use this file except in compliance\n           with the License.  You may obtain a copy of the License at\n           .\n             http://www.apache.org/licenses/LICENSE-2.0\n           .\n           Unless required by applicable law or agreed to in writing,\n           software distributed under the License is distributed on an\n           \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n           KIND, either express or implied.  See the License for the\n           specific language governing permissions and limitations\n           under the License.\n\nDeltaSpike site\n---------------\n\nDeltaSpike site uses [Asciidoc](http://www.methods.co.nz/asciidoc/). You're welcome to contribute.\n\nLicense\n-------\nApache DeltaSpike is licensed under ALv2.\nSee the LICENSE file for the full license text.\n\nPublish procedure\n-----------------\n\nTo publish the site content at [DeltaSpike Site](http://deltaspike.apache.org/) you have do the following steps:\n\nPut the following information in your ~/.m2/settings.xml file\n\n    <server>\n      <id>deltaspike-site</id>\n      <username><YOUR_USERNAME></username>\n      <password><YOUR_PASSWORD></password>\n    </server>\n\nTo publish to [staging area](http://deltaspike.apache.org/staging/), run:\n\n    mvn clean site-deploy -Pstaging\n\nTo publish to [production area](http://deltaspike.apache.org/), run:\n\n    mvn clean site-deploy\n\nAfter log in to <https://cms.apache.org/deltaspike/publish> and click on the `Submit` button.\n"
  },
  {
    "path": "site/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Licensed to the Apache Software Foundation (ASF) under one\n  ~ or more contributor license agreements. See the NOTICE file\n  ~ distributed with this work for additional information\n  ~ regarding copyright ownership. The ASF licenses this file\n  ~ to you under the Apache License, Version 2.0 (the\n  ~ \"License\"); you may not use this file except in compliance\n  ~ with the License. You may obtain a copy of the License at\n  ~\n  ~ http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing,\n  ~ software distributed under the License is distributed on an\n  ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  ~ KIND, either express or implied. See the License for the\n  ~ specific language governing permissions and limitations\n  ~ under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.apache.deltaspike</groupId>\n        <artifactId>deltaspike</artifactId>\n        <version>2.0.2-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <groupId>org.apache.deltaspike</groupId>\n    <artifactId>deltaspike-site</artifactId>\n    <version>2.0.2-SNAPSHOT</version>\n    <packaging>pom</packaging>\n\n    <name>Apache DeltaSpike Site</name>\n    <description>Website content of DeltaSpike project.</description>\n    <url>http://deltaspike.apache.org</url>\n\n    <properties>\n        <svn.scmPubUrl>https://svn.apache.org/repos/infra/sites/deltaspike/</svn.scmPubUrl>\n    </properties>\n\n    <build>\n        <plugins>\n            <!-- Configure ASCIIDOC plugin -->\n            <plugin>\n                <groupId>org.asciidoctor</groupId>\n                <artifactId>asciidoctor-maven-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <id>output-html</id>\n                        <phase>site</phase>\n                        <goals>\n                            <goal>process-asciidoc</goal>\n                        </goals>\n                    </execution>\n                </executions>\n                <configuration>\n                    <attributes>\n                        <!-- Site Base Dir relative path -->\n                        <sitebasedir>.</sitebasedir>\n                    </attributes>\n                </configuration>\n            </plugin>\n\n            <!-- Publish site content -->\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-scm-publish-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <id>scm-publish</id>\n                        <phase>site-deploy</phase>\n                        <!-- deploy site with maven-scm-publish-plugin -->\n                        <goals>\n                            <goal>publish-scm</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "site/src/main/asciidoc/addons.adoc",
    "content": ":notoc:\n\n= Add-ons\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nAdd-ons extend the functionality of DeltaSpike and several have been developed external to the DeltaSpike project. Brief information is given here about each of the add-ons, with details of where they can be obtained from.\n\n== lbitonti@github\nThis GitHub account contains e.g. a DBUnit Add-on for the Test-Control-Module of DeltaSpike.\n\n**Source code:** https://github.com/lbitonti/deltaspike-dbunit\n\n== os890@github\nThis GitHub account contains several DeltaSpike Add-ons e.g. to integrate CDI with other frameworks.\n\n**Source code:** https://github.com/os890/\n\n== rmannibucau@github\nThis GitHub account contains several DeltaSpike Add-ons e.g. an integration with the TomEE PasswordCipher API.\n\n**Source code:** https://github.com/rmannibucau/\n\n== Monitoring\n`ds-monitoring-addon` provides simple monitoring for several common use-cases (exceptions, performance, audits), collecting information about the monitored method-invocations during a request and enabling you to process the entries based on your requirements. For more information about its use and implementation, see http://os890.blogspot.com.au/2014/04/add-on-monitoring-lite-with-deltaspike.html[os890: [add-on\\] monitoring lite with deltaspike].\n\n**Source code:** https://github.com/os890/ds-monitoring-addon\n\n== Spring Bridge\n`ds-spring-bridge-addon` is a two-way cdi-spring bridge that allows spring-beans to be injected into cdi-beans and vice versa provided the concepts, for example qualifiers, are compatible. For more information about its use and implementation, see http://os890.blogspot.com.au/2013/12/add-on-spring-bridge-with-deltaspike.html[os890: [add-on\\] spring-bridge with deltaspike].\n\n**Source code:** https://github.com/os890/ds-spring-bridge-addon.\n\n== Disruptor\n`ds-disruptor-addon` improves CDI synchronous event-processing performance by creating a disruptor process for every observer method, enabling CDI synchronous events in conjunction with asynchronous observers. This add-on currently works with Apache TomEE and JBoss AS 7. For more information about its use and implementation, see http://os890.blogspot.com.au/2014/05/faster-cdi-like-events.html[os890: [add-on\\] fast event processing with disruptor + deltaspike].\n\n**Source code:** https://github.com/os890/ds-disruptor-addon\n"
  },
  {
    "path": "site/src/main/asciidoc/articles.adoc",
    "content": ":notoc:\n\n= Articles and Blogs\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nYou can find lots of content related to DeltaSpike with a quick internet search. But here is a list of some useful articles and blogs to get you started.\n\nIf you know of useful DeltaSpike articles or blogs that are not listed, link:https://deltaspike.apache.org/community.html[let us know]. \n\n== Ongoing\n\n* https://twitter.com/DeltaSpikeTeam[@DeltaSpikeTeam on Twitter]\n* https://twitter.com/hashtag/deltaspike[#deltaspike on Twitter]\n* http://os890.blogspot.com.au/search/label/deltaspike[os890 DeltaSpike posts]\n* http://rafabene.com/?s=deltaspike&submit=Search[Rafael Benevides DeltaSpike posts]\n* http://rmannibucau.wordpress.com/?s=deltaspike[RManiiBucau DeltaSpike posts]\n* https://struberg.wordpress.com/?s=deltaspike[Struberg DeltaSpike posts]\n\n\n== One-offs\n\n* https://blogs.oracle.com/theaquarium/entry/introducing_deltaspike_1_0[The Aquarium: Introducing DeltaSpike 1.0]\n* http://blog.arungupta.me/2014/06/deltaspike-1-0-extend-javaee-techtip32/[DeltaSpike 1.0 – Extend #JavaEE beyond #JavaEE]\n* http://www.tearsofaunicorn.com/articles/2014/06/10/configuring-deltaspike-through-environment-variables.html[Configuring Apache Deltaspike through environment variables]\n* http://blog.ctp.com/2013/11/27/bye-bye-cdi-query-hello-deltaspike-data/[Bye Bye CDI Query, Hello DeltaSpike Data]\n* http://rmannibucau.wordpress.com/2013/11/20/deltaspike-data-repositories-with-dtos/[DeltaSpike Data: repositories with DTOs!]\n* http://jaxenter.com/introducing-apache-deltaspike-42925.html[Closing the Gaps: Introducing Apache Deltaspike]\n* http://jsfcorner.blogspot.com.au/2013/01/deltaspike-jsf-message-system.html[DeltaSpike JSF message system]\n* https://medium.com/danieldiasjava/simplificando-persistencia-de-dados-com-apache-deltaspike-data-6fd27bb2d821[Simplificando persistência de Dados com Apache DeltaSpike Data - PT-BR]\n* https://medium.com/danieldiasjava/conhecendo-apache-deltaspike-configuration-a24516468a9b[Conhecendo Apache DeltaSpike: Configuration - PT-BR]\n* https://medium.com/danieldiasjava/conhecendo-apache-deltaspike-injecting-resources-fa4e5585c2ea[Conhecendo Apache DeltaSpike: Injecting Resources - PT-BR]"
  },
  {
    "path": "site/src/main/asciidoc/community.adoc",
    "content": "= Community\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Users\n\n\nIf you are a new user and you would like to start using DeltaSpike, you\ncan have a look at the link:documentation/[Documentation] and \nmailto:users-subscribe@deltaspike.apache.org[subscribe] our\nmailto:users@deltaspike.apache.org[mailing list for users]. If you have\ntroubles to find the information you are looking for, you can also ask\nin our link:#_irc[IRC-Channel].\n\nFurthermore, you can check our link:#_mailing_lists[mail-archives].\n\nBefore you file a ticket in our\nhttps://issues.apache.org/jira/browse/DELTASPIKE[Jira], please ask on\nthe mailing list if it's a known issue in case of a bug or if there is\nan ongoing discussion in case of a feature.\n\nYou are very welcome to follow our twitter account\nhttp://twitter.com/DeltaSpikeTeam[@DeltaSpikeTeam] and spread the\nword of DeltaSpike with Tweets, Blog-Entries,...\n\n\n== Getting Involved\n\n\nEverybody is welcome to get involved with our community. You can find\ngeneral information at http://apache.org/foundation/getinvolved.html and\nhttp://apache.org/foundation/how-it-works.html. The following sections\nprovides some details about the different levels of getting involved.\n\nIf you want to contribute with link:/documentation/[DeltaSpike\nDocumentation], please read the <<documentation#,instructions\nabout the Documentation>> that adresses how to contribute, render and\npublish it.\n\n\n=== Contributors\n\n\nBefore you get a committer you have to contribute to our effort. E.g.\nyou can help users, participate in discussions on the dev list, submit\npatches,... .\nFor bigger contributions, it's essential to file a/n\nhttp://www.apache.org/licenses/icla.pdf[ICLA] or\nhttp://www.apache.org/licenses/cla-corporate.txt[CCLA] and send it to\nsecretary at apache dot org (or fax it) as early as possible.\n\nIf you would like to submit a patch through Jira, you can have a look at\nthe link:suggested-git-workflows.html[suggested approach].\n\n\n=== Committers\n\n\nBefore you read this section, please ensure that you have read the\ncontributor section. All of you are welcome to join our development\neffort. mailto:dev-subscribe@deltaspike.apache.org[Subscribe] our\nmailto:dev@deltaspike.apache.org[mailing list for developers] and start\ncontributing and help users.\n\nOptionally mailto:commits-subscribe@deltaspike.apache.org[subscribe] our\nmailto:commits@deltaspike.apache.org[mailing list for commits].\n\nFurthermore, you can check our\nlink:#_mailing_lists[mail-archives].\n\nFurther details are available at http://www.apache.org/dev/.\n\n\n== Mailing lists\n\n[.table]\n[cols=\"6*<\", options=\"header\"] \n|===\n|List (Address) \n|Subscribe \n|Unsubscribe \n|Archive \n|Mirrors\n|\n\n|mailto:users@deltaspike.apache.org[User List]\n|mailto:users-subscribe@deltaspike.apache.org[Subscribe]\n|mailto:users-unsubscribe@deltaspike.apache.org[Unsubscribe]\n|link:++https://lists.apache.org/list.html?users@deltaspike.apache.org++[Archive]\n|\n|\n\n|mailto:dev@deltaspike.apache.org[Developer List]\n|mailto:dev-subscribe@deltaspike.apache.org[Subscribe]\n|mailto:dev-unsubscribe@deltaspike.apache.org[Unsubscribe]\n|link:++https://lists.apache.org/list.html?dev@deltaspike.apache.org++[Archive]\n|\n|\n\n|mailto:commits@deltaspike.apache.org[Committer List]\n|mailto:commits-subscribe@deltaspike.apache.org[Subscribe]\n|mailto:commits-unsubscribe@deltaspike.apache.org[Unsubscribe]\n|link:++https://lists.apache.org/list.html?commits@deltaspike.apache.org++[Archive]\n|\n|\n|\n\n|===\n\n== JIRA\n\nAny kind of issue has to be filed in our\nhttps://issues.apache.org/jira/browse/DELTASPIKE[issue-tracker]. If you\nhave any question, you can ask us (e.g. via the mailing list for users).\n\n\n== Spread the word\n\n\nYou are very welcome e.g. to write blog entries, tweet (#DeltaSpike)\nabout the project or just follow our twitter account\nhttp://twitter.com/DeltaSpikeTeam[@DeltaSpikeTeam], ...\n\n\n== IRC\n\n\nUsually discussions happen on the mailing list. Some informal\ndiscussions take place in our IRC-Channel\nirc://irc.freenode.net/deltaspike\n\n-------------------------------------\n//with the irssi command-line client:\n$ irssi\n\n> /connect irc.freenode.net\n> /join #deltaspike\n-------------------------------------\n\nIf you are new to IRC you can use the pre-configures web-client you can\nfind https://kiwiirc.com/client/irc.freenode.net/#deltaspike[here].\n"
  },
  {
    "path": "site/src/main/asciidoc/documentation.adoc",
    "content": ":notoc:\n\n= Documentation\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Sources\n\nlink:/documentation/[DeltaSpike Documentation] is available with <<source#, DeltaSpike Source>>.\n\n== Format\n\nThe format used for DeltaSpike documentation is http://www.methods.co.nz/asciidoc/[ASCIIDOC] because it's easily\nexportable to PDF, HTML, and it's also easy to contribute. It can be used to export also to epub and also be used to write books\n\n== Rendering documentation as HTML\n\n\n_Requirenment:_ Have http://maven.apache.org/[Maven] installed.\n\nIf you cloned the source repository and want to render the documentation\nas HTML, you just need to run the following command:\n\n----------------------------\n$ cd REPO_ROOT/documentation\n$ mvn site\n----------------------------\n\nThe generate documentation will be available at `REPO_ROOT/documentation/target/site`\n\n== Contribute\n\n\nIf you would like to submit a documentation patch through Jira, you can\nhave a look at the <<suggested-git-workflows#,suggested approach>>.\n\n== Publish procedure (for committers only)\n\n\nIf you're a committer and want to publish the documentation at http://deltaspike.apache.org/documentation/[DeltaSpike Site] you have do the following steps:\n\nPut the following information in your ~/.m2/settings.xml file\n\n[source,xml]\n--------------------------------------\n<server>\n  <id>deltaspike-site</id>\n  <username><YOUR_USERNAME></username>\n  <password><YOUR_PASSWORD></password>\n</server>\n--------------------------------------\n\nTo publish to http://deltaspike.apache.org/staging/documentation[staging area], run:\n\n----------------------------\n$ mvn clean site-deploy -P staging\n----------------------------\n\nTo publish to http://deltaspike.apache.org/staging/documentation[production area], run:\n\n-----------------\n$ mvn clean site-deploy\n-----------------\n\nThen run:\n\nAfter log in to https://cms.apache.org/deltaspike/publish and click on the `Submit` button.\n"
  },
  {
    "path": "site/src/main/asciidoc/download.adoc",
    "content": ":notoc:\n\n= Download\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. https://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Latest Release\n\n\nv{latestStable}\n\n== Prerequisits\n\nApchache DeltaSpike-1.x supports JavaEE.\nThe minimum JavaEE version is JavaEE 6.\nThe minmium Java version until DeltaSpike-1.8.x is Java 6.\nThe minimum Java version for DeltaSpike-1.9.x is Java8.\n\nApache DeltaSpike 2.x targets JakartaEE.\nThe minimum JavaEE version is JakartaEE version is 9.\nThe minimum Java version for DeltaSpike-2.0.x is Java11.\n\n\n== Binary Distribution\n\n\n* https://www.apache.org/dyn/closer.lua/deltaspike/{latestStable}/distribution-full-{latestStable}.zip[distribution-full-{latestStable}.zip]\n* https://www.apache.org/dist/deltaspike/{latestStable}/distribution-full-{latestStable}.zip.asc[distribution-full-{latestStable}.zip.asc]\n* https://www.apache.org/dist/deltaspike/{latestStable}/distribution-full-{latestStable}.zip.sha512[distribution-full-{latestStable}.zip.sha512]\n* https://www.apache.org/dist/deltaspike/{latestStable}/distribution-full-{latestStable}.zip.sha1[distribution-full-{latestStable}.zip.sha1]\n\n* https://www.apache.org/dyn/closer.lua/deltaspike/{latestStable}/distribution-full-{latestStable}.tar.gz[distribution-full-{latestStable}.tar.gz]\n* https://www.apache.org/dist/deltaspike/{latestStable}/distribution-full-{latestStable}.tar.gz.asc[distribution-full-{latestStable}.tar.gz.asc]\n* https://www.apache.org/dist/deltaspike/{latestStable}/distribution-full-{latestStable}.tar.gz.sha512[distribution-full-{latestStable}.tar.gz.sha512]\n* https://www.apache.org/dist/deltaspike/{latestStable}/distribution-full-{latestStable}.tar.gz.sha1[distribution-full-{latestStable}.tar.gz.sha1]\n\n\n== Source Distribution\n\n\n* https://www.apache.org/dyn/closer.lua/deltaspike/{latestStable}/deltaspike-{latestStable}-source-release.zip[deltaspike-{latestStable}-source-release.zip]\n* https://www.apache.org/dist/deltaspike/{latestStable}/deltaspike-{latestStable}-source-release.zip.asc[deltaspike-{latestStable}-source-release.zip.asc]\n* https://www.apache.org/dist/deltaspike/{latestStable}/deltaspike-{latestStable}-source-release.zip.sha512[deltaspike-{latestStable}-source-release.zip.sha512]\n* https://www.apache.org/dist/deltaspike/{latestStable}/deltaspike-{latestStable}-source-release.zip.sha1[deltaspike-{latestStable}-source-release.zip.sha1]\n\n\n== Maven Dependencies\n\n\nDetails are available https://deltaspike.apache.org/documentation/configure.html#MavenProjects[here].\n\n\n== Previous Releases\n\n\nSee https://archive.apache.org/dist/deltaspike/[Release-Archive]\n\n\n== Verifying Releases\n\n\nIt is essential that you verify the integrity of any downloaded files using the PGP or MD5 signatures.\nFor more information on signing artifacts and why we do it, check out the\nhttps://www.apache.org/dev/release-signing.html[Release Signing FAQ].\n\nThe PGP signatures can be verified using PGP or GPG. First download the\nhttps://www.apache.org/dist/deltaspike/KEYS[KEYS]\nas well as the asc signature file for the artifact.\nMake sure you get these files from the\nhttps://www.apache.org/dist/deltaspike/[main distribution directory],\nrather than from a\nhttps://www.apache.org/dyn/closer.lua/deltaspike/[mirror]. Then verify\nthe signatures using e.g.:\n\n[subs=\"+attributes\"]\n------------------------------------------------------\n$ pgpk -a KEYS\n$ pgpv deltaspike-project-{latestStable}-source-release.zip.asc\n------------------------------------------------------\n\nor\n\n[subs=\"+attributes\"]\n-----------------------------------------------------\n$ pgp -ka KEYS\n$ pgp deltaspike-project-{latestStable}-source-release.zip.asc\n-----------------------------------------------------\n\nor\n\n[subs=\"+attributes\"]\n--------------------------------------------------------------\n$ gpg --import KEYS\n$ gpg --verify deltaspike-project-{latestStable}-source-release.zip.asc deltaspike-project-{latestStable}-source-release.zip\n--------------------------------------------------------------\n\nMore information can be found at the https://www.apache.org/info/verification.html#CheckingSignatures[ASF Checking Signatures page]"
  },
  {
    "path": "site/src/main/asciidoc/examples.adoc",
    "content": ":notoc:\n\n= See DeltaSpike in Action\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nA collection of ready-to-build Maven-based projects are provided to demonstrate the inclusion of DeltaSpike in applications. Each example showcases a different DeltaSpike feature and explores the mechanics of DeltaSpike implementation. You can use these examples to see DeltaSpike in action and learn how to add these capabilities to your own projects. The Maven-based project examples are available in `deltaspike-project-{latestStable}-source-release.zip`.\n\t\nTo begin using the projects, complete the following steps:\n\n. link:https://deltaspike.apache.org/download.html[Download `deltaspike-project-{latestStable}-source-release.zip`]\n. Extract the archive contents\n+\n[subs=\"+attributes\"]\n----\n$ unzip deltaspike-project-{latestStable}-source-release.zip\n----\n+\n. Build the projects\n+\n[subs=\"+attributes\"]\n----\n$ cd /path/to/deltaspike-project-{latestStable}/examples\n$ mvn clean package\n----\n\n== Next\n* To see more ready-to-deploy DeltaSpike examples and templates, see <<external#,External Examples>>.\n* To read how DeltaSpike is being used by developers, see <<articles#,Articles and Blogs>>."
  },
  {
    "path": "site/src/main/asciidoc/external.adoc",
    "content": "= External Examples and Templates\r\n\r\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\r\n\r\nA number of DeltaSpike examples and templates have been developed external to the DeltaSpike project. These extend the DeltaSpike resources from which you can see DeltaSpike in action. Brief information is given here about the examples and templates, with details of where they can be obtained from.\r\n\r\n== Books (free/online)\r\n\r\n**CDI@Work (chapter about DeltaSpike):** http://cdiatwork.irian.at/\r\n\r\nCDI@Work is a free online book about CDI as well as Apache DeltaSpike.\r\nIt covers basic information about CDI and DeltaSpike up to more advanced use-cases.\r\nAn example for the latter is a type-safe configuration (interface-only)\r\nwhich allows you to resolve the configured values even from dynamic config-sources like a database and\r\nstore them in a custom Config-Scoped cache which can be refreshed via CDI-events or a CRON based task or manually via JMX.\r\n\r\nThe https://github.com/CDIatWork/[GitHub account] contains repositories e.g. for the sample application called IdeaFork.\r\nThe commit-history follows the steps in the book. In most cases every commit translates to one step in the book.\r\n(Chapters are released once they are ready.)\r\n\r\n== Presentations\r\n\r\n=== Apache DeltaSpike: The CDI toolbox\r\nCDI portable extensions are one of greatest features of Java EE allowing the platform to be extended in a clean and portable way. But allowing extension is just part of the story. CDI opens the door to a whole new eco-system for Java EE, but it’s not the role of the specification to create these extensions.\r\nApache DeltaSpike is the project that leads this brand new eco-system by providing useful extension modules for CDI applications as well as tools to ease the creation of new ones.\r\nIn this session, we’ll start by presenting the DeltaSpike toolbox and show how it helps you to develop for CDI. Then we’ll describe the major extensions included in Deltaspike, including  'configuration', 'scheduling' and 'data'.\r\n\r\n\r\n**Slides:** http://www.slideshare.net/antoinesd/apache-deltaspike-the-cdi-toolbox\r\n\r\n**Video:** https://www.youtube.com/watch?v=QbNdFvNPvVU\r\n\r\n**Event:** http://www.meetup.com/JBoss-User-Group-Worldwide/events/218755922/\r\n\r\n=== DeltaSpike: CDI extensions of the world, unite!\r\nSeveral popular CDI extension frameworks like Seam 3 and MyFaces CODI have faded out over the years. But not to worry - their functionality is taken over by projects like Picketlink, Agorava, and mainly DeltaSpike, a new Apache project that wants CDI extension authors to unite in an effort to make the life of web application developers easier. Even without a five year plan!\r\n\r\n**Slides:** http://devconf.cz/filebrowser/download/414\r\n\r\n**Video:** https://www.youtube.com/watch?v=2FUNpzd1Nb8\r\n\r\n=== Apache DeltaSpike\r\nPresentation about Apache DeltaSpike\r\n\r\n**Slides:** http://www.slideshare.net/os890/apache-deltaspike\r\n\r\n=== MyFaces CODI and JBoss Seam3 become Apache DeltaSpike\r\nThese slides show how to use type-safe mechanisms provided by MyFaces CODI for developing JSF applications which are more type-safe and easier to maintain as well as common pitfalls. Beyond that there is an basic overview of Apache DeltaSpike.\r\n\r\n**Slides:** http://www.slideshare.net/os890/myfaces-codi-and-jboss-seam3-become-apache-deltaspike\r\n\r\n=== Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI\r\nThis talk is a detailed case study about the migration of a JSF-based web application from Spring 3 to Java EE 7 and CDI. It is presented at the JavaOne 2014 conference.\r\n\r\n**Slides:** http://www.slideshare.net/MarioLeanderReimer/migrating-a-jsfbased-web-application-from-spring-3-to-java-ee-7-and-cdi\r\n\r\n**Video:** https://parleys.com/play/543faae5e4b06e1184ae423a/about\r\n\r\n=== [de] Flexibilitaet mit CDI und Apache DeltaSpike\r\nPresentation about DeltaSpike\r\n\r\n**Slides:** http://www.slideshare.net/os890/flexibilitaet-mit-cdi-und-apache-delta-spike\r\n\r\n=== [pt-BR] Deixando de refazer a roda com Apache DeltaSpike\r\nCDI e DeltaSpike presentation in TDC - The Developers Conference 2015\r\n\r\n**Video and Slides:** http://www.infoq.com/br/presentations/deixando-de-refazer-a-roda-com-apache-deltaspike\r\n\r\n=== Apache Deltaspike the CDI Toolbox (Java One 2015)\r\n\r\n**Slides:** https://pt.slideshare.net/antoinesd/apache-deltaspike-the-cdi-toolbox-java-one-2015\r\n\r\n=== JavaOne 2015 - Rafael Benevides - Apache DeltaSpike, the CDI Toolbox\r\n\r\n**Video:** https://www.youtube.com/watch?v=3McmEi3cs_s\r\n\r\n=== Simplificando la persistencia de datos con Apache DeltaSpike Data (Java User Group de Nicaragua)\r\n\r\n**Slide:** https://speakerdeck.com/danieldiasjava/simplificando-la-persistencia-de-datos-con-apache-deltaspike-data\r\n\r\n**Video:** https://youtu.be/djM51tlJuLs\r\n\r\n**Example:** https://github.com/Daniel-Dos/danieldiasjava-palestras/tree/master/JUGNicaragua\r\n\r\n== Examples\r\n\r\n=== IdeaFork (full)\r\nThis example is a Java EE6 application which illustrates several features of CDI and DeltaSpike.\r\nIt covers features of all modules provided by DeltaSpike.\r\nThere are profiles to create web-archives for Apache TomEE, JBoss AS7 (and WildFly) and Oracle GlassFish3.\r\nThe complexity is mixed. There are some simple examples as well as some more advanced cases.\r\nThe repository contains every step (one commit is one step) described in the online-book.\r\n\r\n**Source code:** https://github.com/CDIatWork/IdeaFork\r\n\r\n=== IdeaFork (lite)\r\nThis example is based on IdeaFork (full),\r\nbut without some indirections which were needed to demonstrate different features of CDI and DeltaSpike (in a simple Application).\r\n\r\n**Source code (beta - work in progress):** https://github.com/CDIatWork/IdeaForkLite_Beta\r\n\r\n\r\n=== Confess 2012 Workshop Demo\r\nThis example was prepared for the Confess workshop and demonstrates how to use DeltaSpike instead of and side-by-side with MyFaces CODI. The secured web application demonstrates presenting users with differentiating content based on their account status.\r\n\r\n**Source code:** https://github.com/confess/confess2012_deltaspike\r\n\r\n=== Fullstack EE6+ with DeltaSpike\r\nSimple example based on Java EE6+ and DeltaSpike (tested with EE6 and EE7).\r\n\r\n**Source code:** https://github.com/os890/ee6-ds-demo\r\n\r\n=== Fullstack CODI to DeltaSpike\r\nThis pair of examples show how to achieve the most important MyFaces CODI features with DeltaSpike and also how to migrate a CODI project to DeltaSpike. The examples are basic, compacting core CODI features into just a few JSF pages, and are intended for deployment with TomEE.\r\n\r\n**Source code:** https://github.com/os890/tomee_mf_stack_001\r\n\r\n* CODI version in master branch\r\n* Migrated DeltaSpike version in codi2ds branch\r\n\r\n=== JBoss Quickstarts\r\nThe JBoss quickstarts are small working examples that demonstrate recommended practices for specific Java EE technology use cases. A subset of these quickstarts are dedicated to demonstrating DeltaSpike, including custom authorization restrictions using annotations, constructing and modifying beans, extending the influence of CDI using BeanManager, and deactivating DeltaSpike features.\r\n\r\n**Source code:** https://github.com/jboss-developer/jboss-wfk-quickstarts\r\n\r\n=== DeltaSpike Examples\r\nA collection of example applications demonstrating the features of the DeltaSpike project.\r\n\r\n**Source code:** https://github.com/rsmeral/deltaspike-examples\r\n\r\n=== [pt-BR] DeltaSpike microblog example\r\nApplication that shows a microblog using DeltaSpike\r\n\r\n**Source code:** https://github.com/rafabene/demo_deltaspike\r\n\r\n=== Why you should consider using Apache DeltaSpike\r\nBlog post demonstrating 5 features of Apache DeltaSpike\r\n\r\n**Blog post:** http://www.thedevpiece.com/why-you-should-consider-using-apache-deltaspike/\r\n\r\n=== [pt-BR] Rest Application with DeltaSpike Data\r\nSimple example based on MicroProfile(OpenApi,Payara-Micro) and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/Daniel-Dos/DanielDiasjava-Blog/tree/master/ProjetoDeltaSpike\r\n\r\n=== [pt-BR] CRUD-Deltaspike-CDI-Angular\r\nSimple CRUD example based on SparkJava and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/SouJava-Rio/soujava-rio-labs/tree/master/microframeworks/spark-samples/CRUD-Deltaspike-CDI-Angular\r\n\r\n=== [pt-BR] CRUD-Deltaspike-CDI-Angular\r\nSimple CRUD example based on JavaLin and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/Daniel-Dos/DanielDiasjava-Blog/tree/master/Projeto-Cloud/javalin\r\n\r\n=== [pt-BR] jax-rs-sample-cdi-deltaspike-data\r\nSimple CRUD example based on jax-rs(resteasy) and DeltaSpike-data for Tomcat\r\n\r\n**Source code:** https://github.com/SouJava-Rio/soujava-rio-labs/tree/master/jax-rs-samples/Jax-rs-deltaspike-angular2-4/jax-rs-sample-cdi-deltaspike-data\r\n\r\n=== [spanish] Oracle Helidon with DeltaSpike-Data\r\nSimple CRUD example based on Helidon and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/Daniel-Dos/danieldiasjava-palestras/tree/master/JUGNicaragua\r\n\r\n=== [pt-BR] Eclipse vertx with DeltaSpike-Data\r\nSimple example based on vertx and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/Daniel-Dos/DanielDiasjava-Blog/tree/master/Projeto-Cloud/vertx\r\n\r\n=== [pt-BR] Eclipse vertx with DeltaSpike-Data\r\nSimple example based on vertx and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/Daniel-Dos/DanielDiasjava-Blog/tree/master/Projeto-Cloud/vertx\r\n\r\n=== [pt-BR] Javalin with DeltaSpike-Data\r\nSimple example based on Javalin and DeltaSpike-data\r\n\r\n**Source code:** https://github.com/Daniel-Dos/DanielDiasjava-Blog/tree/master/Projeto-Cloud/javalin\r\n\r\n== Magazines\r\n\r\n=== [pt-BR] Brazilian Java Magazine\r\nApache DeltaSpike: CDI Programável\r\n\r\n**Online article:** http://www.devmedia.com.br/apache-deltaspike-cdi-programavel/31982\r\n\r\n== Interviews\r\n\r\n=== [pt-BR] InfoQ Brazil\r\nApache DeltaSpike, a API de extensions do CDI\r\n\r\n**Online interview:** http://www.infoq.com/br/interviews/entrevista-rafael-benevides-delta-spike\r\n\r\n=== [pt-BR] InfoQ Brazil\r\nO que é DeltaSpike?\r\n\r\n**Online interview:** https://www.youtube.com/watch?v=jtCuxfPxDE8\r\n\r\n== Templates\r\n=== Java SE + CDI + DS\r\n**Source code:** https://github.com/os890/javase-cdi-ds-project-template\r\n\r\n=== JSF + CDI + DS (Servlet-Container)\r\n**Source code:** https://github.com/os890/javaweb-cdi-ds-project-template\r\n\r\n=== EJB + CDI + DS (Module)\r\n**Source code:** https://github.com/os890/javaee_cdi_ejb_ds_project_template\r\n\r\n=== JSF + EJB + CDI + DS (EE-Server)\r\n**Source code:** https://github.com/os890/javaee_jsf_cdi_ejb_ds_project_template\r\n\r\n=== JSF + JPA + CDI + DS-Data (diff. EE-Server-Profiles)\r\n**Source code:** https://github.com/os890/javaee_jsf_cdi_jpa_data_ds_project_template\r\n\r\n=== JSF + JPA + CDI + DS-Data (Apache TomEE)\r\n**Source code:** https://github.com/os890/ds-data-project-template\r\n\r\n=== JSF + CDI + DS (Apache TomEE)\r\n**Source code:** https://github.com/os890/tomee-ds-project-template\r\n"
  },
  {
    "path": "site/src/main/asciidoc/index.adoc",
    "content": ":notoc:\n\n[options=\"header,footer\"]\n|===\n|| *About Apache DeltaSpike*\n| image:logo.png[image]\n| DeltaSpike consists of a number of portable CDI extensions that provide\nuseful features for Java application developers.\n\nWe will also ensure true portability! We are testing DeltaSpike on\ndifferent CDI implementations like Apache OpenWebBeans and JBoss Weld,\nand also on different Java EE servers like Apache Tomcat and TomEE,\nJBoss Enterprise, WildFly, GlassFish, Liberty, Oracle WebLogic and others.\n\nlink:documentation/overview.html[View details »]\n|===\n\n[cols=\"1,3,4\",options=\"header,footer\"]\n|===\n| |*Latest Award* | *Modules*\n| image:DukeChoice-100x176.png[image]\n| In 2014, DeltaSpike became a Duke’s Choice Award winner. The Duke’s\nChoice Awards celebrate extreme innovation in the world of Java\ntechnology and are granted to the most innovative projects using the\nJava platform.\n\n| CDI extensions created by the Apache DeltaSpike community are packaged\nas modules. They offer additional functionality not provided out of the\nbox by the CDI spec (Security, JPA, …)\n\nlink:/documentation/modules.html[View details »]\n\n|===\n\n[options=\"header,footer\"]\n|===\n|*News* | *Examples*\n| Apache DeltaSpike 2.0.1 supporting JakartaEE is now out!\n\nlink:/news.html[View details »]\n\n| See the following examples which are part of the project to discover how\nto use DeltaSpike project.\n\nlink:examples.html[View details »]\n|===\n"
  },
  {
    "path": "site/src/main/asciidoc/javadoc.adoc",
    "content": ":notoc:\n\n= Javadoc\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Latest version\n\n* link:/javadoc/{latestSnapshot}/[{latestSnapshot}]\n\n\n== Stable Release\n\n* link:/javadoc/{latestStable}/[{latestStable}]\n\n== Contribute\n\nIf you would like to submit a javadoc patch through Jira, you can have a\nlook at the <<suggested-git-workflows#,suggested approach>>.\n\n\n== Publish procedure (for committers only)\n\n\nIf you're a committer and want to publish the javadoc, you have do the\nfollowing steps:\n\nPut the following information in your ~/.m2/settings.xml file\n\n[source,xml]\n--------------------------------------\n<server>\n  <id>deltaspike-site</id>\n  <username><YOUR_USERNAME></username>\n  <password><YOUR_PASSWORD></password>\n</server>\n--------------------------------------\n\nThen run:\n\n\n[source,bash]\n-------------------------\n$ cd REPO_ROOT/deltaspike\n$ ./javadoc.sh\n-------------------------\n\nAfter log in to https://cms.apache.org/deltaspike/publish and click onthe `Submit` button.\n"
  },
  {
    "path": "site/src/main/asciidoc/migration-guide.adoc",
    "content": "= Migration Guide\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Apache MyFaces CODI to Apache DeltaSpike\n\n=== Example Overview\n\n\n* http://s.apache.org/xA[Fullstack CODI to DeltaSpike @ os890]\n\n\n=== Basically unchanged parts\n\n\nHere you can see features which were added and the concept itself didn't change (only the packages, config keys,...)\n\n==== Project-stage\n\n\nOnly the config key changed (TODO)\n\n\n==== Deactivatable and ClassDeactivator\n\n\nThe concept hasn't changed.\n\n\n==== CodiConfig\n\n\nThe concept hasn't changed.\n\n\n==== Annotation literals\n\n\nThe concept hasn't changed. We just added further implementations.\n\n\n==== BeanManagerProvider\n\n\nThe concept hasn't changed. We just splitted the functionality. The util\nmethods are available in BeanProvider and their name and signature have\nbeen unified.\n\n\n=== Extended concepts\n\n\nHere you can see features which were added and the concept itself\nchanged a bit or got merged with concepts from Seam3\n\n\n==== ConfiguredValueResolver\n\n\nHere we added more flexibility (esp. re-ordering the default lookup\nmechanisms). See `ConfigResolver`, `ConfigSourceProvider` and\n`ConfigSource`.\n\n\n==== ProjectStageActivated and ExpressionActivated\n\n\nWe merged them with a feature of Seam3 and now it's called `@Exclude`.\nThat means the basic functionality is still in place (nothing was\nremoved), but the logic is now inverse.\n\n\n==== DefaultAnnotation\n\n\n(In progress) We merge it with a similar helper of Seam-Solder to\nprovide custom values for annotation attributes.\n\n\n=== Postponed concepts\n\nWe couldn't agree on these features. If you find them useful, please\ncontact the mailing-list. If we see that users need it for reasons we\nmight haven't seen so far, we will discuss it again.\n\n\n==== BeanNames\n\n\n\n=== Dropped concepts\n\n\n\n==== Java 1.5 Support\n\n\n\n=== JSF Module\n\n\n==== Type-safe view config\n\n\n* Changed names\n* Annotations are optional\n\n... (TODO)\n\n\n== JBoss Seam 2 to Java EE 6 + DeltaSpike + other\n\nMigration of a Seam 2 application to Java EE 6 technologies and some alternatives including DeltaSpike is described along with a complete migrated Seam 2 application in the https://github.com/mareknovotny/seam-migration/wiki[Seam 2 Migration Wiki].\n\n\n== JBoss Seam 3 to Apache DeltaSpike\n\n(TODO)\n"
  },
  {
    "path": "site/src/main/asciidoc/news.adoc",
    "content": ":notoc:\n\n= Apache DeltaSpike News\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== DeltaSpike 2.0.1 (2025-08-11)\nThe Apache DeltaSpike team is pleased to announce the release of Apache DeltaSpike-2.0.1.\nThis is a JakartaEE based maintenance release.\nRelease notes can be found https://s.apache.org/DeltaSpike2.0.1[here]\n\n== DeltaSpike 2.0.0 (2024-03-29)\nThe Apache DeltaSpike team is pleased to announce the release of v2.0.0.\nThis is the first release to target JakartaEE specifications and thus the ``jakarta.enterprise `` packages.\nRelease notes can be found https://s.apache.org/DeltaSpike2.0.0[here]\n\n\n== 36th Release (1.9.4) (2020-06-12)\n\nThe Apache DeltaSpike team is pleased to announce the 36th release\n(v1.9.4).  Release notes can be found https://s.apache.org/DeltaSpike1.9.4[here]\n\n== 35th Release (1.9.3) (2020-01-27)\n\nThe Apache DeltaSpike team is pleased to announce the 35th release\n(v1.9.3).  Release notes can be found https://s.apache.org/DeltaSpike1.9.3[here]\n\n== 34th Release (1.9.2) (2019-12-13)\n\nThe Apache DeltaSpike team is pleased to announce the 34th release\n(v1.9.2).  Release notes can be found https://s.apache.org/DeltaSpike1.9.2[here]\n\n== 33th Release (1.9.1) (2019-08-19)\n\nThe Apache DeltaSpike team is pleased to announce the 33th release\n(v1.9.1).  Release notes can be found https://s.apache.org/DeltaSpike1.9.1[here]\n\n\n== 32th Release (1.9.0) (2018-09-18)\n\nThe Apache DeltaSpike team is pleased to announce the 32th release\n(v1.9.0).  Release notes can be found https://s.apache.org/DeltaSpike1.9.0[here]\n\n== 31th Release (1.8.2) (2018-06-01)\n\nThe Apache DeltaSpike team is pleased to announce the 31th release\n(v1.8.2).  Release notes can be found https://s.apache.org/DeltaSpike_1.8.2[here]\n\n== 30th Release (1.8.1) (2018-01-01)\n\nThe Apache DeltaSpike team is pleased to announce the 30th release\n(v1.8.1).  Release notes can be found https://s.apache.org/DeltaSpike_1.8.1[here]\n\n== 29th Release (1.8.0) (2017-06-01)\n\nThe Apache DeltaSpike team is pleased to announce the 29th release\n(v1.8.0).  Release notes can be found https://s.apache.org/DeltaSpike-1.8.0[here]\n\n== 28th Release (1.7.2) (06.11.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 28th release\n(v1.7.2).  Release notes can be found https://s.apache.org/DeltaSpike-1.7.2[here]\n\n== 27th Release (1.7.1) (20.07.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 27th release\n(v1.7.1).  Release notes can be found https://s.apache.org/DeltaSpike-1.7.1[here]\n\n== 26th Release (1.7.0) (19.06.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 26th release\n(v1.7.0).  Release notes can be found https://s.apache.org/DeltaSpike-1.7.0[here]\n\nPlease note that the previously announced end of Java 6 support has\nbeen postponed until the 2.0 line.\n\n== 25th Release (1.6.1) (23.04.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 25th release\n(v1.6.1).\n\n== 24th Release (1.6.0) (02.04.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 24th release\n(v1.6.0).\n\n== 23rd Release (1.5.4) (18.02.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 23rd release\n(v1.5.4).\n\n== 22nd Release (1.5.3) (05.02.2016)\n\nThe Apache DeltaSpike team is pleased to announce the 22nd release\n(v1.5.3).\n\n== 21st Release (1.5.2) (06.12.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 21st release\n(v1.5.2).\n\n== 20th Release (1.5.1) (24.10.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 20th release\n(v1.5.1).\n\n== 19th Release (1.5.0) (10.08.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 19th release\n(v1.5.0).\n\n== 18th Release (1.4.2) (19.07.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 18th release\n(v1.4.2).\n\n\n== 17th Release (1.4.1) (12.06.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 17th release\n(v1.4.1).\n\n== New Committer (01.06.2015)\n\nDaniel Cunha joined our development community.\n\n== 16th Release (1.4.0) (21.05.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 16th release\n(v1.4.0).\n\n== New PMC Member (21.04.2015)\n\nRafael Benevides joined our PMC.\n\n== New Committer (17.04.2015)\n\nRon Smeral joined our development community.\n\n== 15th Release (1.3.0) (10.03.2015)\n\nThe Apache DeltaSpike team is pleased to announce the 15th release\n(v1.3.0).\n\nThe http://s.apache.org/DeltaSpike_1.3.0[release notes] contains 31 JIRA tickets.\n\n== 14th Release (1.2.1) (20.12.2014)\n\nThe Apache DeltaSpike team is pleased to announce the 14th release\n(v1.2.1).\n\nThe http://s.apache.org/DeltaSpike_1.2.1[release notes] contains 19 JIRA tickets.\n\n\n== 13th Release (1.2.0) (30.11.2014)\n\nThe Apache DeltaSpike team is pleased to announce the 13th release\n(v1.2.0).\n\nThe http://s.apache.org/DeltaSpike_1.2.0[release notes] contains 22 JIRA tickets.\n\n== New PMC Member (20.11.2014)\n\nThomas Andraschko joined our PMC.\n\n== 12th Release (1.1.0) (01.11.2014)\n\n\nThe Apache DeltaSpike team is pleased to announce the 12th release (v1.1.0).\n\nThe http://s.apache.org/DeltaSpike_1.1.0[release notes] contains 24 JIRA tickets.\n\n\n== Duke's Choice Award (28.09.2014)\n\nWe won a https://blogs.oracle.com/java/entry/2014_duke_s_choice_award[Duke's Choice Award]!\n\n\n== 11th Release (1.0.3) (21.09.2014)\n\n\nThe Apache DeltaSpike team is pleased to announce the 11th release (v1.0.3).\n\nThe http://s.apache.org/DeltaSpike_1.0.3[release notes] contains 20 JIRA tickets.\n\n\n== 10th Release (1.0.2) (17.08.2014)\n\nThe Apache DeltaSpike team is pleased to announce the 10th release (v1.0.2).\n\nThe http://s.apache.org/DeltaSpike_1.0.2[release notes] contains 15 JIRA tickets.\n\n\n== 9th Release (1.0.1) (13.07.2014)\n\n\nThe Apache DeltaSpike team is pleased to announce the 9th release (v1.0.1).\n\nThe http://s.apache.org/DeltaSpike_1.0.1[release notes] contains 18 JIRA tickets.\n\n== 8th Release (1.0.0) (14.06.2014)\n\n\nThe Apache DeltaSpike team is pleased to announce the 8th release (v1.0.0).\n\nThe http://s.apache.org/DeltaSpike_1.0.0[release notes] contains 48 JIRA tickets.\n\n== New Committer (18.05.2014)\n\nRafael Benevides joined our development community.\n\n\n== 7th Release (0.7) (03.05.2014)\n\n\nThe Apache DeltaSpike team is pleased to announce the 7th release (v0.7).\n\nThe http://s.apache.org/DS-0.7-RNotes[release notes] contains 35 JIRA tickets.\n\n\n== 6th Release (0.6) (20.03.2014)\n\nThe Apache DeltaSpike team is pleased to announce the 6th release (v0.6).\n\nThe http://s.apache.org/DS-0.6-RNotes[release notes] contains 102 JIRA tickets.\n\n\n== New Committer (14.12.2013)\n\nThomas Andraschko joined our development community.\n\n\n== 5th Release (0.5) (18.09.2013)\n\n\nThe Apache DeltaSpike team is pleased to announce the 5th release (v0.5).\n\nThe http://s.apache.org/DS-0.5-RNotes[release notes] contains 29 JIRA tickets.\n\n\n== 4th Release (0.4) (31.05.2013)\n\n\nThe Apache DeltaSpike team is pleased to announce the fourth release (v0.4). \nThis is our first release as a top level project!\n\nThe http://s.apache.org/DS-0.4-RNotes[release notes] contains a large list of bug fixes and new features.\n\n\n== Graduation (28.05.2013)\n\n\nThe Apache DeltaSpike team is pleased to announce that we have complete graduation as a top level project.\n\n\n== 3rd Release (0.3 incubating) (22.08.2012)\n\n\nThe Apache DeltaSpike team is pleased to announce the second release (v0.3-incubating).\n\nThe http://s.apache.org/DeltaSpike_03incubating[release notes] contains 104 JIRA tickets.\n\n\n== New Committer (21.08.2012)\n\nBolesław Dawidowicz joined our development community.\n\n\n== New Committers (11.07.2012)\n\n\nCharles Moulliard and Romain Manni-Bucau joined our development community.\n\n\n== Apache CMS (30.05.2012)\n\nThe setup of the project-site in Apache CMS started.\n\n\n== 2nd Release (0.2 incubating) (22.04.2012)\n\n\nThe Apache DeltaSpike team is pleased to announce the second release (v0.2-incubating).\n\nThe http://s.apache.org/DeltaSpike_02incubating[release notes] contains 61 JIRA tickets.\n\n\n== 1st Release (0.1 incubating) (10.02.2012)\n\nThe Apache DeltaSpike team is pleased to http://s.apache.org/cTt[announce] the first release (v0.1-incubating).\n\nThe first release contains about 5 000 lines of code (including tests and 10 000 including comments). The http://s.apache.org/DeltaSpike_01incubating[release notes] contains 42 JIRA tickets.\n\n\n== Execution of integration tests with remote servers (01.02.2012)\n\n\nC4J helps us with nightly builds which deploy our integration tests to remote-servers (AS7 and GF3).\n\n== New Committer (29.01.2012)\n\n\nLukasz Lenart joined our development community.\n\n\n== New Committer (28.01.2012)\n\nChristian Kaltepoth joined our development community.\n\n\n== New Committer (27.01.2012)\n\n\nRudy De Busscher joined our development community.\n\n\n== Nabble Mirror (21.01.2012)\n\n\nDan Allen created a http://s.apache.org/deltaspike-dev_nabble[Nabble mirror] for the dev-list (based on http://incubator.apache.org/mail/deltaspike-dev/)\n\n\n== New Committers (13.01.2012)\n\nDan Allen and Lincoln Baxter III are our first committers after the initial committers.\n\n\n== GitHub Mirror (12.01.2012)\n\n\nThe infra team created our mirror (https://github.com/apache/incubator-deltaspike)\n\n\n== Creation of the Status Page (30.12.2011)\n\n\nWe created an initial version of our status page (http://incubator.apache.org/guides/website.html)\n\n\n== Nightly builds (29.12.2011)\n\n\nThe infra team added the GIT plugin to Jenkins and we created build jobs for nightly builds which get deployed to\nhttps://repository.apache.org/content/groups/snapshots/org/apache/deltaspike/\n\n\n== Sonar build (29.12.2011)\n\nGavin McDonald did the Sonar setup\n(https://analysis.apache.org/dashboard/index/org.apache.deltaspike:deltaspike-project)\n\n\n== First Commit (22.12.2011)\n\nThe infra team created our GIT repository and we made the first commit.\n\n\n== First JIRA ticket (13.12.2011)\n\n\nWe created our JIRA project and filed the first ticket.\n\n\n== First report 12.2011 (12.12.2011)\n\nWe submitted the first report to\nhttp://wiki.apache.org/incubator/December2011\n\n\n== Twitter Account\n\n\nWe created our Twitter account https://twitter.com/deltaspiketeam[@DeltaSpikeTeam]\n\n\n== Mailing-lists (8.12.2011)\n\nMatt Benson created our https://s.apache.org/Kpg[mailing-lists].\n\n\n== Vote closed (7.12.2011)\n\n\nThe vote to join the incubator was closed. There were 8 binding +1\nvotes, 3 non-binding +1 votes and no -1 votes. In parallel several other\nfolks showed up and told us that they are interested to join the effort.\n\nWe start with the following initial committers (and therefore PPMC\nmembers):\n\n* Andy Gibson\n* Antoine Sabot-Durand\n* Arne Limburg\n* Brian Leathem\n* Cody Lerum\n* David Blevins\n* George Gastaldi\n* Gerhard Petracek\n* Jakob Korherr\n* Jason Porter\n* John Ament\n* Jozef Hartinger\n* Ken Finnigan\n* Marius Bogoevici\n* Mark Struberg\n* Matthias Wessendorf\n* Pete Muir\n* Pete Royle\n* Rick Hightower\n* Shane Bryzak\n* Stuart Douglas\n\nOur mentors are:\n\n* David Blevins\n* Gerhard Petracek\n* Jim Jagielski\n* Mark Struberg\n* Matt Benson\n* Matthias Wessendorf\n\n\n== Vote to join the Incubator (4.12.2011)\n\n\nGerhard Petracek started the official http://s.apache.org/h8[vote].\n\n\n== Proposal (30.11.2011)\n\n\nAfter some discussions between the teams (of Apache MyFaces CODI, Seam3 and CDISource), Mark Struberg submitted the\nhttp://wiki.apache.org/incubator/DeltaSpikeProposal[proposal]. Since Spike couldn't be used as project-name, we agreed on DeltaSpike as initial code name (delta because it closes several gaps).\n"
  },
  {
    "path": "site/src/main/asciidoc/release-preparation.adoc",
    "content": ":notoc:\n\n= Reviewing an Apache Release\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nOnce a Release has been staged on http://repository.apache.org it must\nbe reviewed by each PMC member *before* casting his VOTE.\n\nThe following points need to be checked:\n\n* is the GPG signature fine?\n* is there a source archive?\n* can the source archive really be built?\n* is there a correct LICENSE and NOTICE file in each artifact (both\nsource and binary artifacts)?\n* does the NOTICE file contain all necessary attributions?\n* check the dependencies. We must not have any GPL dependencies and LGPL\nonly if they are optional, etc! See\nhttp://www.apache.org/legal/3party.html\n* do all the tests work?\n* if there is a TCK to run, does it succeed?\n* if there is a tag in the SCM, does it contain reproduceable sources?\n\n"
  },
  {
    "path": "site/src/main/asciidoc/source.adoc",
    "content": ":notoc:\n\n= Contribute to the DeltaSpike Source\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nIf you are looking to contribute to the DeltaSpike source, you must start with the latest version of the code base. DeltaSpike source is stored in the Apache Git repository at https://git-wip-us.apache.org/repos/asf/deltaspike.git\n\nIt is also important that you follow the git workflows we have established for the project to ensure efficient and clean collaboration as detailed here.\n\n== 1. Get the Source\n\n. Checkout the source\n+\n[source]\n----\ngit clone https://git-wip-us.apache.org/repos/asf/deltaspike.git\n----\n+\nor for a read-only mirror version\n+\n[source]\n----\ngit clone https://github.com/apache/deltaspike\n----\n+\n. Update the repository clone\n+\n[source]\n----\ngit pull --rebase\n----\n\n== 2. Make Additions and Changes to the Source\n\nCommits (and in the best case also patches), have to follow our\n\"formatting rules\". The following section provides settings for IDEs\nused by us.\n\n=== IntelliJ\n\nlink:http://deltaspike.apache.org/resources/files/settings.jar[Attached] you can find the settings\nfor formatting the source code. Import them via File | Import\nSettings\n\n=== Eclipse\n\nFor Eclipse you can use this\nlink:http://deltaspike.apache.org/resources/files/deltaspike-code-conventions.xml[Code Formatter Profile]. Import it via Window | Preferences | Java | Code Style | Formatter\n\n== 3. Build the Source\nAlways build and test your changes before you make pull requests to the DeltaSpike repository. For instructions on building the source and running Arquillian tests, see link:http://deltaspike.apache.org/documentation/build.html[Build and Test DeltaSpike from Source].\n\n\n== 4. Make a Pull Request\nEnsure your commits and pull requests follow the our established https://deltaspike.apache.org/suggested-git-workflows.html[DeltaSpike GIT workflow].\n\n== Git Resources\nFor general information about Git and using Git, see the following:\n\n* http://wiki.apache.org/couchdb/Git_At_Apache_Guide[Git At Apache Guide]\n* http://git-wip-us.apache.org[Git at The ASF]\n* http://git.or.cz/course/svn.html[Git - SVN Crash Course]\n* http://git-scm.com/book[Pro Git]\n* https://help.github.com/articles/which-remote-url-should-i-use[GitHub: Which remote URL should I use?]"
  },
  {
    "path": "site/src/main/asciidoc/steps_for_a_release.adoc",
    "content": "= Steps for a Release\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Preparations\n\n - Heads up on the mailing-lists\n\ne.g.:\n\n-----------------------------------------------------------------------------------------------------------------------\nfirst steps for the next release\n\nhi @ all,\n\nif there are no objections, i'll start with the first steps for the next release (review, documentation,...).\nit would be great to start with the release procedure next week.\n\nregards,\n[name]\n-----------------------------------------------------------------------------------------------------------------------\n\n - Check the jenkins builds\n - Create release notes and commit them to deltaspike/readme/ (format [ReleaseNotes][version].txt)\n\ntest at least:\n\n-----------------------------------------------------------------------------------------------------------------------\nmvn clean install -POWB\nmvn clean install -PWeld1\nmvn clean install -Prat\nmvn clean install -Ptomee-build-managed\nmvn clean install -Pjbossas-build-managed\nmvn clean install -Pwildfly-build-managed\nmvn clean install -Pglassfish-build-managed\n-----------------------------------------------------------------------------------------------------------------------\n\ndeploy a demo app especially with jsf-impl-ee6 to an ee6 server and check the logs (if there are no optional ee7+ classes)\n(https://github.com/os890/ee6-ds-demo can be used for it e.g.)\n\n== First steps\n\n-----------------------------------------------------------------------------------------------------------------------\n//install a version of git which is compatible with the release-plugin (e.g. v1.8.3.2)\ngit checkout -b ds-[release version]\n\nmvn release:prepare -Pdistribution -DreleaseProfiles=distribution\n\n//copy prepared workspace (to continue faster if an upload fails in the next step)\n\n//hint: dois not use -DdryRun=true -- since it can break the next step\nmvn release:perform -Pdistribution -DreleaseProfiles=distribution\n\n//!!!check the created commits including user-name and email\n\n// Verify the release in the staging repository:\n//login to https://repository.apache.org/ and go to \"Staging Repositories\"\n//check esp. .../org/apache/deltaspike/deltaspike/[version]/deltaspike-[version]-source-release.zip\n//close the repository\n\n//push the release-branch and tag to a third-party git repo\ngit remote add vote https://github.com/[user]/deltaspike-vote\ngit push -u vote master\ngit push vote ds-[release version]\ngit push vote --tags\n-----------------------------------------------------------------------------------------------------------------------\n\n== Vote\n\n=== Start the Vote\n\ne.g.:\n\n\n-----------------------------------------------------------------------------------------------------------------------\n[VOTE] Release of Apache DeltaSpike [version]\n\n\nHi,\n\nI was running the needed tasks to get the ... release of Apache DeltaSpike out.\nThe artifacts are deployed to Nexus [1] (and [2]).\n\nThe tag is available at [3] and will get pushed to the ASF repository once the vote passed.\n\nPlease take a look at the ... artifacts and vote!\n\nPlease note:\nThis vote is \"majority approval\" with a minimum of three +1 votes (see [4]).\n\n------------------------------------------------\n[ ] +1 for community members who have reviewed the bits\n[ ] +0\n[ ] -1 for fatal flaws that should cause these bits not to be released, and why..............\n------------------------------------------------\n\nThanks,\n[name]\n\n[1] https://repository.apache.org/content/repositories/...\n[2] https://repository.apache.org/content/repositories/.../org/apache/deltaspike/deltaspike/[version]/deltaspike-[version]-source-release.zip\n[3] https://github.com/[user]/deltaspike-vote/tree/deltaspike-[version]\n[4] http://www.apache.org/foundation/voting.html#ReleaseVotes\n-----------------------------------------------------------------------------------------------------------------------\n\n== Announce the Vote\n\n - Create a link to the release notes at http://s.apache.org (format DeltaSpike_[version])\n - Tweet about the vote via @DeltaSpikeTeam.\n\n== Perform the final release\n\n=== Close the Vote\n\nAfter 72 hours close the vote.\n\ne.g.:\n\n\n-----------------------------------------------------------------------------------------------------------------------\nResult (was: Re: [VOTE] Release of Apache DeltaSpike [version])\n\nthank you for voting!\n\nX binding +1 votes (pmc):\n[list]\n\nY non-binding +1 votes:\n[list]\n\nZ -1 votes\n[list]\n-----------------------------------------------------------------------------------------------------------------------\n\n\nIf the binding majority approved the vote continue.\n\n - Login to https://repository.apache.org/ and release the repository\n - Merge release branch into master and push the branch and tag to the ASF repository\n\n\nAlways do a merge in this case (not a rebase):\n\n-----------------------------------------------------------------------------------------------------------------------\ngit checkout master\ngit merge ds-[version]\ngit push origin ds-[version]\ngit push origin deltaspike-[version]\ngit push origin master\n-----------------------------------------------------------------------------------------------------------------------\n\n - Close the the JIRA tickets for the newly released version\n - Close the release in JIRA\n - Ensure the next version is available in JIRA\n - Wait some minutes and check http://repo2.maven.org/maven2/org/apache/deltaspike\n\n\n=== Upload Artifacts\n\nApache releases get published via Subversion.\n\n-----------------------------------------------------------------------------------------------------------------------\nsvn co https://dist.apache.org/repos/dist/release/deltaspike\nmkdir [version]\n//add and commit the artifacts (at least *source-release.zip + asc, md5, sha1)\n//use the artifacts from:\n//  http://repo1.maven.org/maven2/org/apache/deltaspike/deltaspike/[version]/\n//  http://repo1.maven.org/maven2/org/apache/deltaspike/distribution/distribution-full/[version]/\nsvn rm {old-version}\nsvn add {version}\nsvn commit -m \"Removing {old-version}, adding {version}\"\n-----------------------------------------------------------------------------------------------------------------------\n\nThe following `getrelease.sh` bash script can be used to download the release artifacts from maven.central:\n\n[script, getrelease.sh]\n-----------------------------------------------------------------------------------------------------------------------\n#!/bin/sh\nmkdir $1\ncd $1\n\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/deltaspike/${1}/deltaspike-${1}-source-release.zip\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/deltaspike/${1}/deltaspike-${1}-source-release.zip.asc\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/deltaspike/${1}/deltaspike-${1}-source-release.zip.md5\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/deltaspike/${1}/deltaspike-${1}-source-release.zip.sha1\n\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.tar.gz\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.tar.gz.asc\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.tar.gz.md5\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.tar.gz.sha1\n\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.zip\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.zip.asc\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.zip.md5\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}.zip.sha1\n\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}-tests.jar\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}-tests.jar.asc\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}-tests.jar.md5\ncurl -O https://repository.apache.org/content/groups/public/org/apache/deltaspike/distribution/distribution-full/${1}/distribution-full-${1}-tests.jar.sha1\n\n\nfor f in *.zip; do (sha1sum ${f}; cat ${f}.sha1;echo;echo;); done\nfor f in *.tar.gz; do (sha1sum ${f}; cat ${f}.sha1;echo;echo;); done\ncd ..\n-----------------------------------------------------------------------------------------------------------------------\n\n\n=== Check Downloads\n\n - http://www.eu.apache.org/dist/deltaspike\n - http://www.us.apache.org/dist/deltaspike\n\n=== Update CMS / site content\n\n==== Publish Javadoc of release\n\n - git checkout deltaspike-{version}\n - cd deltaspike && ./javadoc.sh\n\n==== Update site\n\n - git checkout master\n - Update the pom.xml (version.deltaspike.latest.stable and version.deltaspike.latest.snapshot)\n - Update site\\src\\main\\asciidoc\\index.adoc\n - Update site\\src\\main\\asciidoc\\news.adoc\n - git commit -m \"site update\"\n - git push\n\n==== Publish Javadoc of SNAPSHOT\n\n - git checkout master\n - cd deltaspike && ./javadoc.sh\n \n==== Publish site\n - git checkout master\n - mvn site deploy\n - mvn clean site-deploy -Pstaging\n - mvn clean site-deploy\n - Login to CMS\n - update workspace\n - publish content via https://cms.apache.org/deltaspike/publish\n\n=== Update report\n\n - https://reporter.apache.org/?deltaspike\n\n=== Announce the Release\n\n==== E-mails\n\n\n-----------------------------------------------------------------------------------------------------------------------\n[ANNOUNCE] Release of Apache DeltaSpike [version]\n\nThe Apache DeltaSpike team is pleased to announce the 6th release of DeltaSpike.\n\nApache DeltaSpike is  a suite of portable CDI (Contexts & Dependency Injection) extensions intended to make application development easier when working with CDI and Java EE.  Some of its key features include:\n\n- A core runtime that supports component configuration, type safe messaging and internationalization, and exception handling.\n- A suite of utilities to make programmatic bean lookup easier.\n- A plugin for Java SE to bootstrap both JBoss Weld and Apache OpenWebBeans outside of a container.\n- JSF integration, including backporting of JSF 2.2 features for Java EE 6.\n- JPA integration and transaction support.\n- A Data module, to create an easy to use repository pattern on top of JPA.\n- Quartz integration\n\nTesting support is also provided, to allow you to do low level unit testing of your CDI enabled projects.\n\nMore can be found on our website - https://deltaspike.apache.org\n\nDocumentation:\nhttps://deltaspike.apache.org/documentation/\n\nDownload:\nhttps://deltaspike.apache.org/download.html\n\nRelease Notes:\nhttps://s.apache.org/DeltaSpike_[version]\n\nEnjoy!\n\n[name]\n-----------------------------------------------------------------------------------------------------------------------\n\nWrite the e-mails to:\n\n - announce@apache.org\n - dev@deltaspike.apache.org\n - users@deltaspike.apache.org\n\n==== Twitter\n\ne.g.:\n\n-----------------------------------------------------------------------------------------------------------------------\n[ANNOUNCE] The Apache #DeltaSpike team is pleased to announce http://s.apache.org/DeltaSpike_[version]. Feel free to test it! Feedback is very welcome!\n-----------------------------------------------------------------------------------------------------------------------"
  },
  {
    "path": "site/src/main/asciidoc/suggested-git-workflows.adoc",
    "content": "= Suggested GIT workflows\n\n:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n== Avoid git-pull!\n\ngit-pull should never get invoked if you have dirty files lying around\nor if your branch is ahead of master. This will always lead to some\ndirty artifacts in the commit history:\n\n----------------------------------------------------------------------------\nMerge branch 'master' of http://git-wip-us.apache.org/deltaspike into master\n----------------------------------------------------------------------------\n\n\n== git pull --rebase\n\n\nAn easy version for getting rid of the auto-merges is using\n\n[source,bash]\n--------------------\n$ git pull --rebase\n--------------------\n\nPlease note that this sometimes trashes your working tree if there are\nunmergeable files around. Cleaning this up with a forced manual rebase\nis not something we would recommend for a git beginner.\n\n\n=== Working in an own branch\n\n\nThis is actually the suggested way to prevent auto-merges.\n\nCreate an own branch where you do your feature work. Either do all your\nwork in one branch or create one branch per feature you are working on.\n\n[source,bash]\n----------------------\n$ git branch mybranch\n----------------------\n\nAfter you finished your feature, `git-add` and `git-commit` your work.\nCheck with `git-status` that you don't have any dirty files and\nuncommitted changes around. You can use `git-stash` to 'backup'\nunfinished work.\n\nThen switch back to the master branch and pull changes done by other\ncommitters in the meantime.\n\n----------------------\n$ git checkout master\n$ git pull --rebase\n----------------------\n\nYou should now get all the changes done by other committers and the will\nget applied to your local master branch. Now go back to your private\nbranch and rebase your locally performed work to the HEAD of master.\n\n------------------------\n$ git checkout mybranch\n$ git rebase master\n------------------------\n\nIf you got conflicts, you will get lines with \">>>>\" added to those\nfiles. Resolve those conflicts manually, add them and finish the rebase.\n\nCheck with `git-status` and `gitk` if the merge went well and the\nhistory now contains your changes. If all is well, go back to the master\nbranch and merge your changes in.\n\n------------------------------------------------------------------------\n$ git pull --rebase     // (just for safety, you should see no changes)\n$ git checkout master\n$ git merge mybranch\n------------------------------------------------------------------------\n\nFinally you can push your changes to the ASF git repo\n\n-----------\n$ git push\n-----------\n\n== Contribution workflow\n\nPlease understand that our contribution workflow is designed for outside contributions.  They should represent your\nchanges and your changes alone.  Any other contributors should raise their own pull request or submit their own patch.\nCommitters should continue to follow the discussion flow for complex changes, and merge their changes when ready.\n\n=== Raising Pull Requests\n\nYou should use the following workflow if you plan to contribute features or bug fixes to Apache DeltaSpike via GitHub\n\nFirst, fork our repository https://github.com/apache/deltaspike[on github]\n\nSecond, clone it locally and add our upstream as a remote\n\n----------------------\n$ git clone https://github.com/<YOUR USERNAME>/deltaspike\n$ git remote add asf https://git-wip-us.apache.org/repos/asf/deltaspike.git\n----------------------\n\nThird, find a JIRA ticket to work on.  When you do, use that as your branch name\n\n---------------------------------\n$ git checkout -b DELTASPIKE-XXX\n---------------------------------\n\nNow you can start to work on your patch. When you are finished, commit\nyour changes. But don't forget to **add the name of the JIRA issue to\nthe commit message**.\n\n-------------------------------------------------\n$ git commit -am \"DELTASPIKE-XXX: Fixed some issue\"\n-------------------------------------------------\n\nOnce you're done with your changes, make sure you're up to date and rebase from master\n\n-------------------------------------------------\n$ git pull asf master --rebase\n-------------------------------------------------\n\nNext, push your branch to GitHub\n\n-------------------------------------------------\n$ git push origin DELTASPIKE-XXX\n-------------------------------------------------\n\nFinally, raise your PR.  If you go to your GitHub fork of DeltaSpike, you should see an option to create a PR\n\n=== Merging Pull Requests\n\nWhenever a PR gets created for DeltaSpike, an email is sent to the dev@deltaspike.  It will include the subject\n\n-------------------------------------------------\n[GitHub] deltaspike pull request #00: DELTASPIKE-XXX some changes\n-------------------------------------------------\n\nWhich will contain the instructions\n\n-------------------------------------------------\nYou can merge this pull request into a Git repository by running:\n\n$ git pull https://github.com/<GITHUB USERNAME>/deltaspike DELTASPIKE-XXX\n-------------------------------------------------\n\nAs long as you don't rebase, pushing the result of this pull will merge the change into our git repository and close the PR.  If there are any issues with the patch, you can monitor the build status from the PR, where we run some smoke tests against the commit to ensure its working.  Please make the requestor aware of any issues identified (e.g. code quality, formatting, missing tests, etc).\n\n=== Creating patches\n\nYou should use the following workflow, if you plan to contribute patches or new features to DeltaSpike.\n\nFirst update you local copy of the repository:\n\n----------------------\n$ git checkout master\n$ git pull --rebase\n----------------------\n\nThen create a new local branch for your work. It's good practice to name it after the corresponding JIRA issue.\n\n---------------------------------\n$ git checkout -b DELTASPIKE-XXX\n---------------------------------\n\nNow you can start to work on your patch. When you are finished, commit\nyour changes. But don't forget to **add the name of the JIRA issue to\nthe commit message**.\n\n-------------------------------------------------\n$ git commit -am \"DELTASPIKE-XXX: Fixed some issue\"\n-------------------------------------------------\n\nFor small patches we recommend to do a single commit containing your\nchanges. For larger contributions you should try to group your work into\nseparate sub-tasks that you can commit one by one.\n\nBefore you create your patch you should make sure that your local\nrepository is up to date with the master repository. This is very\nimportant especially if you work on your branch for a long time. Use the\nfollowing commands to pull the latest changes from the upstream\nrepository and rebase your branch against the current master.\n\n[source,bash]\n------------------------------\n$ git checkout master\n$ git pull --rebase\n$ git checkout DELTASPIKE-XXX\n$ git rebase master\n------------------------------\n\nNow you are ready to create your patch:\n\n[source,bash]\n--------------------------------------------------------------\n$ git checkout DELTASPIKE-XXX\n$ git format-patch --stdout master > ../DELTASPIKE-XXX.patch \n--------------------------------------------------------------\n\nPlease attach the resulting patch file to the correspoding JIRA issue.\n\n===Applying patches\n\n\nIf you are a committer and want to apply a patch you should do so in a\nseparate branch.\n\n---------------------------------\n$ git checkout -b DELTASPIKE-XXX\n---------------------------------\n\nThen apply the patch using `git-am` and rebase it against the master\nbranch.\n\n------------------------------------\n$ git am < ../DELTASPIKE-XXX.patch \n$ git rebase master\n------------------------------------\n\nAfter reviewing the changes and testing the code, the changes are ready\nto be merged into the master branch:\n\n-------------------------------\n$ git checkout master\n$ git merge DELTASPIKE-XXX\n$ git branch -d DELTASPIKE-XXX\n-------------------------------\n\n\n== Discussion workflow (optional)\n\n\nAll discussions which lead to a decision take place on the mailing list.\nSometimes it's required to show-case an idea especially if the solution is\nmore than a few lines. As shown above it makes sense to use local branches\nfor developing new parts. Git allows to push such local branches to a\npublic repository. So it's easier to share it with the community for\ndiscussing it. The following listings show an example in combination\nwith GitHub - for sure it works with any hosting platform like\nBitBucket, Google-Code,... The only important part here is that such\nbranches _NEVER_ get pushed to the main Apache repository to keep the\ncommit history as clean as possible.\n\n*Initial setup*\n\n[source,bash]\n----------------------------------------------------------------------------------\n$ git clone https://git-wip-us.apache.org/repos/asf/deltaspike.git ./\n$ git remote add discuss https://[username]@github.com/[username]/[repo-name].git\n$ git push -u discuss master\n----------------------------------------------------------------------------------\n\n*Branches for discussions*\n\n[source,bash]\n--------------------------------------------------\n$ git checkout -b DELTASPIKE-XXX\n//1-n commits\n$ git push discuss DELTASPIKE-XXX\n//share the link to the branch for the discussions\n--------------------------------------------------\n\n_If the community agrees on the suggested change, the implementation\nwill be applied to the origin master. A committer has to follow the\nsteps described above for the basic workflow to keep the commit history\nsimple, clean and straight. A contributor has to follow the steps\ndescribed above for creating a patch._\n\n*Delete the branch again*\n\n----------------------------------\n$ git push discuss :DELTASPIKE-XXX\n$ git branch -d DELTASPIKE-XXX\n----------------------------------\n"
  },
  {
    "path": "template/document.html.erb",
    "content": "<%#encoding:UTF-8%><!DOCTYPE html>\n<head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"description\" content=\"deltaspike-generate-pages\">\n    <meta name=\"author\" content=\"chm\">\n    <!-- No caching headers -->\n    <meta http-equiv=\"cache-control\" content=\"no-cache\"/>\n    <meta http-equiv=\"pragma\" content=\"no-cache\"/>\n    <meta http-equiv=\"expires\" content=\"-1\"/>\n\n    <title><%= document.name %></title>\n\n    <!--\n        Licensed to the Apache Software Foundation (ASF) under one\n        or more contributor license agreements.  See the NOTICE file\n        distributed with this work for additional information\n        regarding copyright ownership.  The ASF licenses this file\n        to you under the Apache License, Version 2.0 (the\n        \"License\"); you may not use this file except in compliance\n        with the License.  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n        Unless required by applicable law or agreed to in writing,\n        software distributed under the License is distributed on an\n        \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n        KIND, either express or implied.  See the License for the\n        specific language governing permissions and limitations\n        under the License.\n    -->\n\n    <!-- Styles -->\n    <link href=\"https://deltaspike.apache.org/resources/css/bootstrap.css\" rel=\"stylesheet\">\n    <link href=\"https://deltaspike.apache.org/resources/css/bootstrap-responsive.css\" rel=\"stylesheet\">\n    <link href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n\n    <%\n       def is_toc?\n         not (attributes.has_key?('notoc'))\n       end\n    %>\n\n    <% if is_toc? then %>\n        <!-- Tocify - nice dynamic autoscrolling TOC -->\n        <link href=\"https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/stylesheets/jquery.tocify.min.css\" rel=\"stylesheet\">\n        <script src=\"https://code.jquery.com/jquery-1.11.3.min.js\"></script>\n        <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js\"></script>\n        <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js\"></script>\n\n\n        <script type=\"text/javascript\">\n            $(function () {\n                $(\"#toc\").tocify({\n                    scrollTo: 50,\n                    extendPage: true,\n                    context: \"#doc-content\",\n                    selectors: \"h2,h3,h4,h5\"\n                });\n                $(\".fallback-toc\").hide();\n            });\n        </script>\n    <% end %>\n\n    <style type=\"text/css\">\n        <%= ::Asciidoctor::Stylesheets.instance.coderay_stylesheet_data %>\n\n        body {\n            padding-top: 60px;\n            padding-bottom: 40px;\n        }\n\n        .toc-like {\n            border-radius: 6px;\n            border: 1px solid #ccc;\n        }\n\n        .toc-like li {\n            line-height: 30px;\n            text-indent: 10px;\n        }\n\n        .toc-like li.custom-toc-header {\n            font-weight: bold;\n            background: #666;\n            color: white;\n            cursor: initial !important;\n            padding: 5px;\n        }\n\n        .toc-like li.custom-toc-header a {\n            color: white;\n            font-style: normal;\n            text-shadow: none;\n            padding: 0;\n        }\n\n        .toc-like li.custom-toc-header:hover a {\n            background: #666;\n        }\n\n        .page-title {\n            text-align: left;\n        }\n\n        #doc-content h2,\n        #doc-content h3,\n        #doc-content h4,\n        #doc-content h5,\n        #doc-content h6 {\n            padding-top: 0;\n            margin-top: 25px;\n            margin-bottom: 10px;\n            line-height: 1.4em;\n        }\n\n        #doc-content h2 {\n            border-bottom: 1px solid lightgrey;\n        }\n\n\n    </style>\n\n</head>\n\n<body>\n\n<div class=\"navbar navbar-fixed-top\">\n    <div class=\"navbar-inner\">\n        <div class=\"container\">\n            <a class=\"btn btn-navbar\" data-toggle=\"collapse\"\n               data-target=\".nav-collapse\"> <span class=\"icon-bar\"></span> <span\n            class=\"icon-bar\"></span> <span class=\"icon-bar\"></span>\n            </a>\n            <a class=\"brand logocolor\" href=\"<%= (attr :sitebasedir) %>/index.html\">Apache DeltaSpike</a>\n\n            <div class=\"nav-collapse\">\n\n                <%\n                   def active_page(page)\n                     docpage = attributes.has_key?('docpage') ? attributes['docpage'] : attributes['docname']\n                     'class=\"active\"' if docpage == page\n                   end\n                %>\n                <ul class=\"nav\">\n                    <li><a href=\"<%= (attr :sitebasedir) %>/index.html\">Home</a></li>\n                    <li <%= active_page(\"documentation\") %>><a href=\"<%= (attr :sitebasedir) %>/documentation\">Documentation</a></li>\n                    <li <%= active_page(\"javadoc\") %> ><a href=\"<%= (attr :sitebasedir) %>/javadoc.html\">Javadoc</a></li>\n                    <li <%= active_page(\"source\") %>><a href=\"<%= (attr :sitebasedir) %>/source.html\">Source</a></li>\n                    <li <%= active_page(\"download\") %>><a href=\"<%= (attr :sitebasedir) %>/download.html\">Download</a></li>\n                    <li <%= active_page(\"community\") %>><a href=\"<%= (attr :sitebasedir) %>/community.html\">Community</a></li>\n                    <!-- <li><a href=\"./support.html\">Support</a></li>  -->\n                    <li <%= active_page(\"news\") %>><a href=\"<%= (attr :sitebasedir) %>/news.html\">News</a></li>\n                </ul>\n            </div>\n            <!--/.nav-collapse -->\n            <form id=\"search-form\" action=\"https://www.google.com/search\"\n                  method=\"get\" class=\"navbar-search pull-right\">\n                <input value=\"deltaspike.apache.org\" name=\"sitesearch\"\n                       type=\"hidden\"> <input class=\"search-query\" name=\"q\"\n                                             id=\"query\" type=\"text\">\n            </form>\n        </div>\n    </div>\n</div>\n\n<div class=\"container\">\n    <div class=\"row-fluid\">\n\n        <%\n           $moduleDeps = 'moduledeps' unless defined? $moduleDeps\n           $moduleConf = 'moduleconf' unless defined? $moduleConf\n           $moduleBase = 'modulebase' unless defined? $moduleBase\n           $conf_link = \"https://github.com/apache/deltaspike/blob/master/deltaspike/%{base}/%{proj}/src/main/java/%{fqn}.java\" unless defined? $conf_link\n\n           # module dependencies\n           def dep_name(short_name)\n             short_name.tr('-', ' ').capitalize\n           end\n\n           def has_deps?\n             if attributes.has_key?($moduleDeps) && !(attributes[$moduleDeps].empty?)\n               attributes[$moduleDeps].split(%r{\\s*,\\s*}).size > 0\n             else\n               false\n             end\n           end\n\n           def deps_list()\n             attributes[$moduleDeps].split(%r{\\s*,\\s*})\n           end\n\n           # module configuration\n           def module_base()\n             if attributes.has_key?($moduleBase) && !(attributes[$moduleBase].empty?)\n               attributes[$moduleBase]\n             else\n               'modules/' + attributes['docname']\n             end\n           end\n\n           def conf_name(fqn)\n             fqn[fqn.rindex(\".\")+1..-1]\n           end\n\n           def conf_link(in_fqn)\n             $conf_link % { base: module_base(), proj: in_fqn.split(':')[0], fqn: in_fqn.split(':')[1].tr('.', '/') }\n           end\n\n           def has_conf?\n             if attributes.has_key?($moduleConf) && !(attributes[$moduleConf].empty?)\n               attributes[$moduleConf].split(%r{\\s*,\\s*}).size > 0\n             else\n               false\n             end\n           end\n\n           def conf_list()\n             attributes[$moduleConf].split(%r{\\s*,\\s*})\n           end\n        %>\n\n        <div class=\"<%= if is_toc? or has_deps? or has_conf? then\n                          'span8'\n                        else\n                          'span12'\n                        end %>\">\n            <div class=\"page-title\">\n                <h1><%= document.name %></h1>\n            </div>\n\n            <div id=\"doc-content\">\n                <%= document.content %>\n            </div>\n        </div>\n\n        <% if is_toc? or has_deps? or has_conf? then %>\n            <div class=\"span4\">\n                <div id=\"toc\">\n                    <div class=\"moduledeps\">\n                        <ul class=\"toc-like nav nav-list\">\n                            <% if has_deps? then %>\n                                <li class=\"custom-toc-header\">Depends on</li>\n                                <% deps_list().each { |dep| %>\n                                    <li><a href=\"<%= dep %>.html\"><%= dep_name(dep) %></a></li>\n                                <% } %>\n                            <% end %>\n                            <% if has_conf? then %>\n                                <li class=\"custom-toc-header\"><a href=\"core.html#_internal_configuration\">Configuration</a></li>\n                                <% conf_list().each { |conf| %>\n                                    <li><a href=\"<%= conf_link(conf) %>\"><%= conf_name(conf) %></a></li>\n                                <% } %>\n                            <% end %>\n                            <% if is_toc? && (has_deps? or has_conf?) then %>\n                                <li class=\"custom-toc-header\">Table of Contents</li>\n                            <% end %>\n                        </ul>\n                    </div>\n                </div>\n                <% if is_toc? then %>\n                    <div class=\"fallback-toc\">\n                        <%= converter.convert @document, 'outline', :toclevels => 4 %>\n                    </div>\n                <% end %>\n            </div>\n        <% end %>\n\n    </div>\n    <div class=\"row\">\n        <hr>\n        <footer>\n            <p>Copyright &copy; 2011-2025 The Apache Software Foundation,\n                Licensed under the Apache License, Version 2.0.</p>\n\n            <p>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p>\n        </footer>\n    </div>\n</div>\n\n</body>\n</html>\n"
  }
]